For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > March 2005 > XML Generator DBI









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author XML Generator DBI
Mike Lesser

2005-03-19, 3:56 pm

Hi all. I'm messing with XML & MySQL, and I may have run into a newbie
snag.

I'm using XML::Generator ::DBI with XML::Handler::YAWriter, in the
same manner that I've seen in tutorials, the MySQL Cookbook, and other
assorted places.

> $writer = XML::Handler::YAWriter->new (AsString => 1);
> $query = 'SELECT cd_airdate, cd_copies, cd_hilites FROM cds WHERE
> cd_labeled=0
> ORDER BY cd_airdate';
> $generator = XML::Generator::DBI->new( dbh =>$dbh,
> Handler =>$writer,
> RootElement=>"Creators",
> Indent=>1,
> QueryElement => '');
> $xml_output = $generator->execute($query);


According to the XML::Gen perldoc, "Nulls are handled by excluding
either
the attribute or the tag." The XML looks and works just fine. No prob.

However,when I use the -w option with the shebang, I get a couple
warnings
for each record of the database. They're all about the same:

"Use of uninitialized value in string eq at
/Library/Perl/5.8.1/XML/Generator/
DBI.pm line 180."

Now it seems to me that if nulls are supposed to be handled by the
modules, then
why the warnings? Is it normal for modules to put out warnings during
their
normal function? I'm used to C/C++ environments where you normally
eliminate
any warning that appears.

Mike

Graeme St. Clair

2005-03-21, 3:55 pm

-w is kind of pan-galactic and influences modules you're calling, regardless
of their own 'warnings' settings. Try 'use warnings' without -w. See p861
in the camel 3rd edition.

HTH, GStC.

-----Original Message-----
From: Mike Lesser [mailto:exceptions@earthlink.net]
Sent: Saturday, March 19, 2005 11:41 AM
To: Perl Beginners
Subject: XML Generator DBI

Hi all. I'm messing with XML & MySQL, and I may have run into a newbie snag.

I'm using XML::Generator ::DBI with XML::Handler::YAWriter, in the same
manner that I've seen in tutorials, the MySQL Cookbook, and other assorted
places.

> $writer = XML::Handler::YAWriter->new (AsString => 1); $query =
> 'SELECT cd_airdate, cd_copies, cd_hilites FROM cds WHERE cd_labeled=0
> ORDER BY cd_airdate';
> $generator = XML::Generator::DBI->new( dbh =>$dbh,
> Handler =>$writer,
> RootElement=>"Creators",
> Indent=>1,
> QueryElement => '');
> $xml_output = $generator->execute($query);


According to the XML::Gen perldoc, "Nulls are handled by excluding either
the attribute or the tag." The XML looks and works just fine. No prob.

However,when I use the -w option with the shebang, I get a couple warnings
for each record of the database. They're all about the same:

"Use of uninitialized value in string eq at
/Library/Perl/5.8.1/XML/Generator/
DBI.pm line 180."

Now it seems to me that if nulls are supposed to be handled by the modules,
then why the warnings? Is it normal for modules to put out warnings during
their normal function? I'm used to C/C++ environments where you normally
eliminate any warning that appears.

Mike


--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org For additional
commands, e-mail: beginners-help@perl.org <http://learn.perl.org/>
<http://learn.perl.org/first-response>

Mike Lesser

2005-03-23, 3:56 pm


> -w is kind of pan-galactic and influences modules you're calling,
> regardless
> of their own 'warnings' settings. Try 'use warnings' without -w. See
> p861
> in the camel 3rd edition.
>
> HTH, GStC.
>

That's exactly what I needed to hear. Thank you Graeme!

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com