Skip Menu |

This queue is for tickets about the Data-Serializer CPAN distribution.

Report information
The Basics
Id: 34047
Status: resolved
Priority: 0/
Queue: Data-Serializer

People
Owner: Nobody in particular
Requestors: charles.gowing [...] novainfo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: retrieve broken with XML::Dumper
Date: Thu, 13 Mar 2008 10:44:47 -0400
To: "'bug-Data-Serializer [...] rt.cpan.org'" <bug-Data-Serializer [...] rt.cpan.org>
From: "Gowing, Charles" <charles.gowing [...] novainfo.com>
This may be related to bug #23901. First the basic info: Module version info Show quoted text
cpan> i Data::Serializer
CPAN: Storable loaded ok (v2.15) Going to read C:\DOCUME~1\CGowing\LOCALS~1\Temp\cpan\Metadata Database was generated on Wed, 12 Mar 2008 18:30:48 GMT Strange distribution name [Data::Serializer] Module id = Data::Serializer DESCRIPTION Generic interface to serializer modules CPAN_USERID NEELY (Neil A. Neely <neil@neely.cx>) CPAN_VERSION 0.43 CPAN_FILE N/NE/NEELY/Data-Serializer-0.43.tar.gz UPLOAD_DATE 2007-12-20 DSLIP_STATUS RdpOp (released,developer,perl,object-oriented,Standard-Perl) MANPAGE Data::Serializer:: - Modules that serialize data structures INST_FILE C:\strawberry-perl\perl\site\lib\Data\Serializer.pm INST_VERSION 0.43 Show quoted text
cpan> i XML::Dumper
Strange distribution name [XML::Dumper] Module id = XML::Dumper DESCRIPTION Converts XML from/to Perl code CPAN_USERID MIKEWONG (Mike Wong <mike_w3@pacbell.net>) CPAN_VERSION 0.81 CPAN_FILE M/MI/MIKEWONG/XML-Dumper-0.81.tar.gz UPLOAD_DATE 2006-04-05 DSLIP_STATUS ampO? (alpha,mailing-list,perl,object-oriented,) MANPAGE XML::Dumper - Perl module for dumping Perl objects from/to XML INST_FILE C:\strawberry-perl\perl\site\lib\XML\Dumper.pm INST_VERSION 0.81 Show quoted text
cpan> i XML::Parser
CPAN: Storable loaded ok (v2.15) Going to read C:\DOCUME~1\CGowing\LOCALS~1\Temp\cpan\Metadata Database was generated on Wed, 12 Mar 2008 18:30:48 GMT Strange distribution name [XML::Parser] Module id = XML::Parser DESCRIPTION Flexible fast parser with plug-in styles CPAN_USERID COOPERCL (Clark Cooper <clark@coopercc.net>) CPAN_VERSION 2.36 CPAN_FILE M/MS/MSERGEANT/XML-Parser-2.36.tar.gz UPLOAD_DATE 2007-11-20 DSLIP_STATUS bmcO? (beta,mailing-list,C,object-oriented,) MANPAGE XML::Parser - A perl module for parsing XML documents INST_FILE C:\strawberry-perl\perl\site\lib\XML\Parser.pm INST_VERSION 2.36 Perl version info I'm usign Strawberry Perl: C:\chas_sandbox\grammars>perl -v This is perl, v5.8.8 built for MSWin32-x86-multi-thread Copyright 1987-2006, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. I have expat installed from expat-win32bin-2.0.1.exe (no small feat in itself - check out http://www.mike-a-roni.com/2008/01/04/strawberry-perl-expat-xmlparser-and-you/) OS Vendor and Version I'm on Windows XP: C:\strawberry-perl\expat\Bin>ver Microsoft Windows XP [Version 5.1.2600] Now for the bug I'm trying to use store/retrieve with the XML::Dumper serializer and get: no element found at line 1, column 10, byte 10 at C:/strawberry-perl/perl/site/l ib/XML/Parser.pm line 187 I'm using this fairly straightforward harness to test it: #/usr/bin/perl -Wl use strict; use warnings; use Data::Dumper; use Data::Serializer; my $datatostore = ['samplecomplexdata', ['list','of','strings'], {hash=>'of',more=>'data'} ]; my $datafromretrieve; my $Dserializer = Data::Serializer->new(portable => '0',serializer => 'Data::Dumper'); my $outfile = 'data.out'; print Dumper($datatostore); $Dserializer->store( $datatostore, $outfile, '>>' ); $datafromretrieve = $Dserializer->retrieve( $outfile ); print Dumper($datafromretrieve); ####################################### #now as xml my $Xserializer = Data::Serializer->new(portable => '0',serializer => 'XML::Dumper'); $outfile = 'data.xml'; print Dumper($datatostore); $Xserializer->store( $datatostore, $outfile, '>>' ); $datafromretrieve = $Xserializer->retrieve( $outfile ); print Dumper($datafromretrieve); and getting the following output: C:\chas_sandbox\grammars>retrievedemo.pl $VAR1 = [ 'samplecomplexdata', [ 'list', 'of', 'strings' ], { 'hash' => 'of', 'more' => 'data' } ]; $VAR1 = [ 'samplecomplexdata', [ 'list', 'of', 'strings' ], { 'hash' => 'of', 'more' => 'data' } ]; $VAR1 = [ 'samplecomplexdata', [ 'list', 'of', 'strings' ], { 'hash' => 'of', 'more' => 'data' } ]; no element found at line 1, column 10, byte 10 at C:/strawberry-perl/perl/site/l ib/XML/Parser.pm line 187 C:\chas_sandbox\grammars> ----------------------------------------- Note: The information contained in this email and in any attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. The recipient should check this email and any attachments for the presence of viruses. Sender accepts no liability for any damages caused by any virus transmitted by this email. If you have received this email in error, please notify us immediately by replying to the message and delete the email from your computer. This e-mail is and any response to it will be unencrypted and, therefore, potentially unsecure. Thank you. NOVA Information Systems, Inc.

Message body is not shown because it is too large.

From: neil [...] neely.cx
Looks like the bug is in the interaction of store/retrieve and setting portable = 0. The current store/retrieve code is naive in that it only reads in the first line from the file - when portable is set to 0 and a structure is serialized its output can contain many more lines. This will definitely cause retrieve to fail. A work around is to leave portable enabled for now. I also note you were trying to append multiple structures (via '>>') to the same file. With the current implementation of retrieve that is only ever going to try to read in the first line and probably not do what you wish it to. What is your purpose for setting portable to 0 for this? I'd like to understand what you are trying to do with this before I making any changes. Thanks, Neil On Thu Mar 13 10:45:56 2008, charles.gowing@novainfo.com wrote: Show quoted text
> This may be related to bug #23901. First the basic info: > Module > version info
> cpan> i Data::Serializer
> CPAN: Storable loaded ok > (v2.15) > Going to read C:\DOCUME~1\CGowing\LOCALS~1\Temp\cpan\Metadata > Database was generated on Wed, 12 Mar 2008 18:30:48 GMT > Strange > distribution name [Data::Serializer] > Module id = Data::Serializer > DESCRIPTION Generic interface to serializer modules > CPAN_USERID > NEELY (Neil A. Neely <neil@neely.cx>) > CPAN_VERSION 0.43 > CPAN_FILE N/NE/NEELY/Data-Serializer-0.43.tar.gz > UPLOAD_DATE > 2007-12-20 > DSLIP_STATUS RdpOp (released,developer,perl,object- > oriented,Standard-Perl) > MANPAGE Data::Serializer:: - Modules > that serialize data structures > INST_FILE C:\strawberry- > perl\perl\site\lib\Data\Serializer.pm > INST_VERSION 0.43
> cpan> i XML::Dumper
> Strange distribution name [XML::Dumper] > Module > id = XML::Dumper > DESCRIPTION Converts XML from/to Perl code > CPAN_USERID MIKEWONG (Mike Wong <mike_w3@pacbell.net>) > CPAN_VERSION 0.81 > CPAN_FILE M/MI/MIKEWONG/XML-Dumper- > 0.81.tar.gz > UPLOAD_DATE 2006-04-05 > DSLIP_STATUS ampO? > (alpha,mailing-list,perl,object-oriented,) > MANPAGE > XML::Dumper - Perl module for dumping Perl objects from/to XML > INST_FILE C:\strawberry-perl\perl\site\lib\XML\Dumper.pm > INST_VERSION 0.81 > > >
> cpan> i XML::Parser
> CPAN: Storable loaded ok > (v2.15) > Going to read C:\DOCUME~1\CGowing\LOCALS~1\Temp\cpan\Metadata > Database was generated on Wed, 12 Mar 2008 18:30:48 GMT > Strange > distribution name [XML::Parser] > Module id = XML::Parser > DESCRIPTION Flexible fast parser with plug-in styles > CPAN_USERID > COOPERCL (Clark Cooper <clark@coopercc.net>) > CPAN_VERSION 2.36 > CPAN_FILE M/MS/MSERGEANT/XML-Parser-2.36.tar.gz > UPLOAD_DATE > 2007-11-20 > DSLIP_STATUS bmcO? (beta,mailing-list,C,object- > oriented,) > MANPAGE XML::Parser - A perl module for parsing > XML documents > INST_FILE C:\strawberry- > perl\perl\site\lib\XML\Parser.pm > INST_VERSION 2.36 > > Perl > version info > I'm usign Strawberry Perl: > C:\chas_sandbox\grammars>perl -v > > This is perl, v5.8.8 built for > MSWin32-x86-multi-thread > > Copyright 1987-2006, Larry Wall > > Perl > may be copied only under the terms of either the Artistic License or > the > GNU General Public License, which may be found in the Perl 5 > source kit. > > Complete documentation for Perl, including FAQ lists, > should be found on > this system using "man perl" or "perldoc perl". > If you have access to the > Internet, point your browser at > http://www.perl.org/, the Perl Home Page. > > I have expat installed > from expat-win32bin-2.0.1.exe (no small feat in itself - check out > http://www.mike-a-roni.com/2008/01/04/strawberry-perl-expat-xmlparser- > and-you/) > > OS Vendor and Version > I'm on Windows XP: > C:\strawberry- > perl\expat\Bin>ver > > Microsoft Windows XP [Version 5.1.2600] > > Now > for the bug > I'm trying to use store/retrieve with the XML::Dumper > serializer and get: > no element found at line 1, column 10, byte 10 at > C:/strawberry-perl/perl/site/l > ib/XML/Parser.pm line 187 > > I'm using > this fairly straightforward harness to test it: > #/usr/bin/perl -Wl > use strict; > use warnings; > use Data::Dumper; > use Data::Serializer; > my $datatostore = ['samplecomplexdata', > ['list','of','strings'], > {hash=>'of',more=>'data'} > ]; > my $datafromretrieve; > my $Dserializer > = Data::Serializer->new(portable => '0',serializer => > 'Data::Dumper'); > my $outfile = 'data.out'; > > print > Dumper($datatostore); > $Dserializer->store( > $datatostore, > $outfile, > '>>' > ); > $datafromretrieve = $Dserializer->retrieve( > $outfile > ); > print Dumper($datafromretrieve); > ####################################### > #now as xml > my $Xserializer > = Data::Serializer->new(portable => '0',serializer => > 'XML::Dumper'); > $outfile = 'data.xml'; > > print Dumper($datatostore); > $Xserializer->store( > $datatostore, > $outfile, > '>>' > ); > $datafromretrieve = $Xserializer->retrieve( > $outfile > ); > print > Dumper($datafromretrieve); > > and getting the following output: > C:\chas_sandbox\grammars>retrievedemo.pl > $VAR1 = [ > 'samplecomplexdata', > [ > 'list', > 'of', > 'strings' > ], > { > 'hash' => 'of', > 'more' => 'data' > } > ]; > $VAR1 = [ > 'samplecomplexdata', > [ > 'list', > 'of', > 'strings' > ], > { > 'hash' => 'of', > 'more' => 'data' > } > ]; > $VAR1 = [ > 'samplecomplexdata', > [ > 'list', > 'of', > 'strings' > ], > { > 'hash' => 'of', > 'more' => 'data' > } > ]; > > no element found at line 1, column 10, byte 10 at > C:/strawberry-perl/perl/site/l > ib/XML/Parser.pm line 187 > C:\chas_sandbox\grammars> > ----------------------------------------- > Note: The information > contained in this email and in any > attachments is intended only for the person or entity to which it > is addressed and may contain confidential and/or privileged > material. Any review, retransmission, dissemination or other use > of, or taking of any action in reliance upon, this information by > persons or entities other than the intended recipient is > prohibited. The recipient should check this email and any > attachments for the presence of viruses. Sender accepts no > liability for any damages caused by any virus transmitted by this > email. If you have received this email in error, please notify us > immediately by replying to the message and delete the email from > your computer. This e-mail is and any response to it will be > unencrypted and, therefore, potentially unsecure. Thank you. NOVA > Information Systems, Inc.
Subject: RE: [rt.cpan.org #34047] retrieve broken with XML::Dumper
Date: Thu, 13 Mar 2008 11:31:21 -0400
To: "'bug-Data-Serializer [...] rt.cpan.org'" <bug-Data-Serializer [...] rt.cpan.org>
From: "Gowing, Charles" <charles.gowing [...] novainfo.com>
Thanks for the propmt response. No worries on the '>>'; that was just for the quick-n-dirty harness. Re: protable, I was hoping to have Data::Serializer dump my data to XML in a way an admin could tweak it for his purposes, then deserialize the modified XML into different data of the same format. Portable=>'1' makes data.xml, well, not XML. If it weren't for the human readable requirement (well, nice-to-have feature), I'd use Data::Dumper. Show quoted text
-----Original Message----- From: Neil A. Neely via RT [mailto:bug-Data-Serializer@rt.cpan.org] Sent: Thursday, March 13, 2008 11:25 AM To: Gowing, Charles Subject: [rt.cpan.org #34047] retrieve broken with XML::Dumper <URL: http://rt.cpan.org/Ticket/Display.html?id=34047 > Looks like the bug is in the interaction of store/retrieve and setting portable = 0. The current store/retrieve code is naive in that it only reads in the first line from the file - when portable is set to 0 and a structure is serialized its output can contain many more lines. This will definitely cause retrieve to fail. A work around is to leave portable enabled for now. I also note you were trying to append multiple structures (via '>>') to the same file. With the current implementation of retrieve that is only ever going to try to read in the first line and probably not do what you wish it to. What is your purpose for setting portable to 0 for this? I'd like to understand what you are trying to do with this before I making any changes. Thanks, Neil On Thu Mar 13 10:45:56 2008, charles.gowing@novainfo.com wrote:
> This may be related to bug #23901. First the basic info: > Module > version info
> cpan> i Data::Serializer
> CPAN: Storable loaded ok > (v2.15) > Going to read C:\DOCUME~1\CGowing\LOCALS~1\Temp\cpan\Metadata > Database was generated on Wed, 12 Mar 2008 18:30:48 GMT > Strange > distribution name [Data::Serializer] > Module id = Data::Serializer > DESCRIPTION Generic interface to serializer modules > CPAN_USERID > NEELY (Neil A. Neely <neil@neely.cx>) > CPAN_VERSION 0.43 > CPAN_FILE N/NE/NEELY/Data-Serializer-0.43.tar.gz > UPLOAD_DATE > 2007-12-20 > DSLIP_STATUS RdpOp (released,developer,perl,object- > oriented,Standard-Perl) > MANPAGE Data::Serializer:: - Modules > that serialize data structures > INST_FILE C:\strawberry- > perl\perl\site\lib\Data\Serializer.pm > INST_VERSION 0.43
> cpan> i XML::Dumper
> Strange distribution name [XML::Dumper] > Module > id = XML::Dumper > DESCRIPTION Converts XML from/to Perl code > CPAN_USERID MIKEWONG (Mike Wong <mike_w3@pacbell.net>) > CPAN_VERSION 0.81 > CPAN_FILE M/MI/MIKEWONG/XML-Dumper- > 0.81.tar.gz > UPLOAD_DATE 2006-04-05 > DSLIP_STATUS ampO? > (alpha,mailing-list,perl,object-oriented,) > MANPAGE > XML::Dumper - Perl module for dumping Perl objects from/to XML > INST_FILE C:\strawberry-perl\perl\site\lib\XML\Dumper.pm > INST_VERSION 0.81 > > >
> cpan> i XML::Parser
> CPAN: Storable loaded ok > (v2.15) > Going to read C:\DOCUME~1\CGowing\LOCALS~1\Temp\cpan\Metadata > Database was generated on Wed, 12 Mar 2008 18:30:48 GMT > Strange > distribution name [XML::Parser] > Module id = XML::Parser > DESCRIPTION Flexible fast parser with plug-in styles > CPAN_USERID > COOPERCL (Clark Cooper <clark@coopercc.net>) > CPAN_VERSION 2.36 > CPAN_FILE M/MS/MSERGEANT/XML-Parser-2.36.tar.gz > UPLOAD_DATE > 2007-11-20 > DSLIP_STATUS bmcO? (beta,mailing-list,C,object- > oriented,) > MANPAGE XML::Parser - A perl module for parsing > XML documents > INST_FILE C:\strawberry- > perl\perl\site\lib\XML\Parser.pm > INST_VERSION 2.36 > > Perl > version info > I'm usign Strawberry Perl: > C:\chas_sandbox\grammars>perl -v > > This is perl, v5.8.8 built for > MSWin32-x86-multi-thread > > Copyright 1987-2006, Larry Wall > > Perl > may be copied only under the terms of either the Artistic License or > the > GNU General Public License, which may be found in the Perl 5 > source kit. > > Complete documentation for Perl, including FAQ lists, > should be found on > this system using "man perl" or "perldoc perl". > If you have access to the > Internet, point your browser at > http://www.perl.org/, the Perl Home Page. > > I have expat installed > from expat-win32bin-2.0.1.exe (no small feat in itself - check out > http://www.mike-a-roni.com/2008/01/04/strawberry-perl-expat-xmlparser- > and-you/) > > OS Vendor and Version > I'm on Windows XP: > C:\strawberry- > perl\expat\Bin>ver > > Microsoft Windows XP [Version 5.1.2600] > > Now > for the bug > I'm trying to use store/retrieve with the XML::Dumper > serializer and get: > no element found at line 1, column 10, byte 10 at > C:/strawberry-perl/perl/site/l > ib/XML/Parser.pm line 187 > > I'm using > this fairly straightforward harness to test it: > #/usr/bin/perl -Wl > use strict; > use warnings; > use Data::Dumper; > use Data::Serializer; > my $datatostore = ['samplecomplexdata', > ['list','of','strings'], > {hash=>'of',more=>'data'} > ]; > my $datafromretrieve; > my $Dserializer > = Data::Serializer->new(portable => '0',serializer => > 'Data::Dumper'); > my $outfile = 'data.out'; > > print > Dumper($datatostore); > $Dserializer->store( > $datatostore, > $outfile, > '>>' > ); > $datafromretrieve = $Dserializer->retrieve( > $outfile > ); > print Dumper($datafromretrieve); > ####################################### > #now as xml > my $Xserializer > = Data::Serializer->new(portable => '0',serializer => > 'XML::Dumper'); > $outfile = 'data.xml'; > > print Dumper($datatostore); > $Xserializer->store( > $datatostore, > $outfile, > '>>' > ); > $datafromretrieve = $Xserializer->retrieve( > $outfile > ); > print > Dumper($datafromretrieve); > > and getting the following output: > C:\chas_sandbox\grammars>retrievedemo.pl > $VAR1 = [ > 'samplecomplexdata', > [ > 'list', > 'of', > 'strings' > ], > { > 'hash' => 'of', > 'more' => 'data' > } > ]; > $VAR1 = [ > 'samplecomplexdata', > [ > 'list', > 'of', > 'strings' > ], > { > 'hash' => 'of', > 'more' => 'data' > } > ]; > $VAR1 = [ > 'samplecomplexdata', > [ > 'list', > 'of', > 'strings' > ], > { > 'hash' => 'of', > 'more' => 'data' > } > ]; > > no element found at line 1, column 10, byte 10 at > C:/strawberry-perl/perl/site/l > ib/XML/Parser.pm line 187 > C:\chas_sandbox\grammars> > ----------------------------------------- > Note: The information > contained in this email and in any > attachments is intended only for the person or entity to which it > is addressed and may contain confidential and/or privileged > material. Any review, retransmission, dissemination or other use > of, or taking of any action in reliance upon, this information by > persons or entities other than the intended recipient is > prohibited. The recipient should check this email and any > attachments for the presence of viruses. Sender accepts no > liability for any damages caused by any virus transmitted by this > email. If you have received this email in error, please notify us > immediately by replying to the message and delete the email from > your computer. This e-mail is and any response to it will be > unencrypted and, therefore, potentially unsecure. Thank you. NOVA > Information Systems, Inc.
----------------------------------------- Note: The information contained in this email and in any attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. The recipient should check this email and any attachments for the presence of viruses. Sender accepts no liability for any damages caused by any virus transmitted by this email. If you have received this email in error, please notify us immediately by replying to the message and delete the email from your computer. This e-mail is and any response to it will be unencrypted and, therefore, potentially unsecure. Thank you. NOVA Information Systems, Inc.
Your goal makes a lot of sense, and more generically the functionality you are looking for is in raw_serialize and raw_deserialize, they work in the native data type with no Data::Serializer markup involved. What you need on top of this is some new methods: raw_store and raw_retrieve which would utilize the raw_serialize and raw_deserialize functionality and manage the file storage aspects as well. I'll try to get those methods in and a new version uploaded to CPAN by tomorrow (Friday 3/14). On Thu Mar 13 11:32:09 2008, charles.gowing@novainfo.com wrote: Show quoted text
> Thanks for the propmt response. No worries on the '>>'; that was just > for the quick-n-dirty harness. > > Re: protable, I was hoping to > have Data::Serializer dump my data to XML in a way an admin could > tweak it for his purposes, then deserialize the modified XML into > different data of the same format. Portable=>'1' makes data.xml, > well, not XML. If it weren't for the human readable requirement > (well, nice-to-have feature), I'd use Data::Dumper. > -----Original Message----- > From: Neil A. Neely via RT [mailto:bug- > Data-Serializer@rt.cpan.org] > Sent: Thursday, March 13, 2008 11:25 > AM > To: Gowing, Charles > Subject: [rt.cpan.org #34047] retrieve > broken with XML::Dumper > > > > <URL: > http://rt.cpan.org/Ticket/Display.html?id=34047 > > > > Looks like > the bug is in the interaction of store/retrieve and setting > portable = 0. The > current store/retrieve code is naive in that it > only reads in the first line from the file - when > portable is set > to 0 and a structure is serialized its output can contain many more > lines. This > will definitely cause retrieve to fail. > > A work > around is to leave portable enabled for now. > > I also note you > were trying to append multiple structures (via '>>') to the same > file. With the > current implementation of retrieve that is only > ever going to try to read in the first line and > probably not do > what you wish it to. > > What is your purpose for setting portable > to 0 for this? I'd like to understand what you are > trying to do > with this before I making any changes. > > Thanks, > Neil > > > On Thu > Mar 13 10:45:56 2008, charles.gowing@novainfo.com wrote:
> > This
> may be related to bug #23901. First the basic info:
> > Module > >
> version info
> > cpan> i Data::Serializer
> > CPAN: Storable loaded
> ok
> > (v2.15) > > Going to read
> C:\DOCUME~1\CGowing\LOCALS~1\Temp\cpan\Metadata
> > Database was
> generated on Wed, 12 Mar 2008 18:30:48 GMT
> > Strange > >
> distribution name [Data::Serializer]
> > Module id =
> Data::Serializer
> > DESCRIPTION Generic interface to serializer
> modules
> > CPAN_USERID > > NEELY (Neil A. Neely <neil@neely.cx>)
> > CPAN_VERSION 0.43
> > CPAN_FILE N/NE/NEELY/Data-Serializer-
> 0.43.tar.gz
> > UPLOAD_DATE > > 2007-12-20 > > DSLIP_STATUS
> RdpOp (released,developer,perl,object-
> > oriented,Standard-Perl)
> > MANPAGE Data::Serializer:: - Modules
> > that serialize
> data structures
> > INST_FILE C:\strawberry- > >
> perl\perl\site\lib\Data\Serializer.pm
> > INST_VERSION 0.43 > >
> cpan> i XML::Dumper
> > Strange distribution name [XML::Dumper] > >
> Module
> > id = XML::Dumper > > DESCRIPTION Converts XML from/to
> Perl code
> > CPAN_USERID MIKEWONG (Mike Wong
> <mike_w3@pacbell.net>)
> > CPAN_VERSION 0.81 > > CPAN_FILE
> M/MI/MIKEWONG/XML-Dumper-
> > 0.81.tar.gz > > UPLOAD_DATE 2006-
> 04-05
> > DSLIP_STATUS ampO? > > (alpha,mailing-list,perl,object-
> oriented,)
> > MANPAGE > > XML::Dumper - Perl module for dumping
> Perl objects from/to XML
> > INST_FILE C:\strawberry-
> perl\perl\site\lib\XML\Dumper.pm
> > INST_VERSION 0.81 > > > > > > > >
> cpan> i XML::Parser
> > CPAN: Storable loaded ok > > (v2.15) > > Going
> to read C:\DOCUME~1\CGowing\LOCALS~1\Temp\cpan\Metadata
> > Database
> was generated on Wed, 12 Mar 2008 18:30:48 GMT
> > Strange > >
> distribution name [XML::Parser]
> > Module id = XML::Parser > >
> DESCRIPTION Flexible fast parser with plug-in styles
> >
> CPAN_USERID
> > COOPERCL (Clark Cooper <clark@coopercc.net>) > >
> CPAN_VERSION 2.36
> > CPAN_FILE M/MS/MSERGEANT/XML-Parser-
> 2.36.tar.gz
> > UPLOAD_DATE > > 2007-11-20 > > DSLIP_STATUS
> bmcO? (beta,mailing-list,C,object-
> > oriented,) > > MANPAGE
> XML::Parser - A perl module for parsing
> > XML documents > >
> INST_FILE C:\strawberry-
> > perl\perl\site\lib\XML\Parser.pm > >
> INST_VERSION 2.36
> > > > Perl > > version info > > I'm usign
> Strawberry Perl:
> > C:\chas_sandbox\grammars>perl -v > > > > This is
> perl, v5.8.8 built for
> > MSWin32-x86-multi-thread > > > > Copyright
> 1987-2006, Larry Wall
> > > > Perl > > may be copied only under the
> terms of either the Artistic License or
> > the > > GNU General
> Public License, which may be found in the Perl 5
> > source kit. > >
> > Complete documentation for Perl, including FAQ lists,
> > should
> be found on
> > this system using "man perl" or "perldoc perl". > >
> If you have access to the
> > Internet, point your browser at > >
> http://www.perl.org/, the Perl Home Page.
> > > > I have expat
> installed
> > from expat-win32bin-2.0.1.exe (no small feat in itself
> - check out > perl-expat-xmlparser-
> > and-you/) > > > > OS Vendor and Version > >
> I'm on Windows XP:
> > C:\strawberry- > > perl\expat\Bin>ver > > > >
> Microsoft Windows XP [Version 5.1.2600]
> > > > Now > > for the bug > >
> I'm trying to use store/retrieve with the XML::Dumper
> > serializer
> and get:
> > no element found at line 1, column 10, byte 10 at > >
> C:/strawberry-perl/perl/site/l
> > ib/XML/Parser.pm line 187 > > > >
> I'm using
> > this fairly straightforward harness to test it: > >
> #/usr/bin/perl -Wl
> > use strict; > > use warnings; > > use
> Data::Dumper;
> > use Data::Serializer; > > my $datatostore =
> ['samplecomplexdata',
> > ['list','of','strings'], > >
> {hash=>'of',more=>'data'}
> > ]; > > my $datafromretrieve; > > my
> $Dserializer
> > = Data::Serializer->new(portable =>
> '0',serializer =>
> > 'Data::Dumper'); > > my $outfile = 'data.out';
> >
> > print > > Dumper($datatostore); > > $Dserializer->store( > >
> $datatostore,
> > $outfile, > > '>>' > > ); > > $datafromretrieve =
> $Dserializer->retrieve(
> > $outfile > > ); > > print
> Dumper($datafromretrieve);
> >
> #######################################
> > #now as xml > > my
> $Xserializer
> > = Data::Serializer->new(portable =>
> '0',serializer =>
> > 'XML::Dumper'); > > $outfile = 'data.xml'; > >
> > print Dumper($datatostore);
> > $Xserializer->store( > >
> $datatostore,
> > $outfile, > > '>>' > > ); > >
> $datafromretrieve = $Xserializer->retrieve(
> > $outfile > > );
> > print
> > Dumper($datafromretrieve); > > > > and getting the
> following output:
> > C:\chas_sandbox\grammars>retrievedemo.pl > >
> $VAR1 = [
> > 'samplecomplexdata', > > [ > >
> 'list',
> > 'of', > > 'strings' > > ], > >
> {
> > 'hash' => 'of', > > 'more' => 'data' > > }
> > ];
> > $VAR1 = [ > > 'samplecomplexdata', > >
> [
> > 'list', > > 'of', > > 'strings' > >
> ],
> > { > > 'hash' => 'of', > > 'more' =>
> 'data'
> > } > > ]; > > $VAR1 = [ > >
> 'samplecomplexdata',
> > [ > > 'list', > > 'of',
> > 'strings'
> > ], > > { > > 'hash'
> => 'of',
> > 'more' => 'data' > > } > > ]; > > > >
> no element found at line 1, column 10, byte 10 at
> > C:/strawberry-
> perl/perl/site/l
> > ib/XML/Parser.pm line 187 > >
> C:\chas_sandbox\grammars>
> >
> -----------------------------------------
> > Note: The information
> > contained in this email and in any
> > attachments is intended
> only for the person or entity to which it
> > is addressed and may
> contain confidential and/or privileged
> > material. Any review,
> retransmission, dissemination or other use
> > of, or taking of any
> action in reliance upon, this information by
> > persons or entities
> other than the intended recipient is
> > prohibited. The recipient
> should check this email and any
> > attachments for the presence of
> viruses. Sender accepts no
> > liability for any damages caused by
> any virus transmitted by this
> > email. If you have received this
> email in error, please notify us
> > immediately by replying to the
> message and delete the email from
> > your computer. This e-mail is
> and any response to it will be
> > unencrypted and, therefore,
> potentially unsecure. Thank you. NOVA
> > Information Systems,
> Inc. > > > > > > > ----------------------------------------- > Note: > The information contained in this email and in any > attachments is intended only for the person or entity to which it > is addressed and may contain confidential and/or privileged > material. Any review, retransmission, dissemination or other use > of, or taking of any action in reliance upon, this information by > persons or entities other than the intended recipient is > prohibited. The recipient should check this email and any > attachments for the presence of viruses. Sender accepts no > liability for any damages caused by any virus transmitted by this > email. If you have received this email in error, please notify us > immediately by replying to the message and delete the email from > your computer. This e-mail is and any response to it will be > unencrypted and, therefore, potentially unsecure. Thank you. NOVA > Information Systems, Inc.
Subject: RE: [rt.cpan.org #34047] retrieve broken with XML::Dumper
Date: Thu, 13 Mar 2008 14:19:39 -0400
To: "'bug-Data-Serializer [...] rt.cpan.org'" <bug-Data-Serializer [...] rt.cpan.org>
From: "Gowing, Charles" <charles.gowing [...] novainfo.com>
Excellent. I agree with your design. Show quoted text
-----Original Message----- From: Neil A. Neely via RT [mailto:bug-Data-Serializer@rt.cpan.org] Sent: Thursday, March 13, 2008 12:39 PM To: Gowing, Charles Subject: [rt.cpan.org #34047] retrieve broken with XML::Dumper <URL: http://rt.cpan.org/Ticket/Display.html?id=34047 > Your goal makes a lot of sense, and more generically the functionality you are looking for is in raw_serialize and raw_deserialize, they work in the native data type with no Data::Serializer markup involved. What you need on top of this is some new methods: raw_store and raw_retrieve which would utilize the raw_serialize and raw_deserialize functionality and manage the file storage aspects as well. I'll try to get those methods in and a new version uploaded to CPAN by tomorrow (Friday 3/14). On Thu Mar 13 11:32:09 2008, charles.gowing@novainfo.com wrote:
> Thanks for the propmt response. No worries on the '>>'; that was just > for the quick-n-dirty harness. > > Re: protable, I was hoping to > have Data::Serializer dump my data to XML in a way an admin could > tweak it for his purposes, then deserialize the modified XML into > different data of the same format. Portable=>'1' makes data.xml, > well, not XML. If it weren't for the human readable requirement > (well, nice-to-have feature), I'd use Data::Dumper. > -----Original Message----- > From: Neil A. Neely via RT [mailto:bug- > Data-Serializer@rt.cpan.org] > Sent: Thursday, March 13, 2008 11:25 > AM > To: Gowing, Charles > Subject: [rt.cpan.org #34047] retrieve > broken with XML::Dumper > > > > <URL: > http://rt.cpan.org/Ticket/Display.html?id=34047 > > > > Looks like > the bug is in the interaction of store/retrieve and setting > portable = 0. The > current store/retrieve code is naive in that it > only reads in the first line from the file - when > portable is set > to 0 and a structure is serialized its output can contain many more > lines. This > will definitely cause retrieve to fail. > > A work > around is to leave portable enabled for now. > > I also note you > were trying to append multiple structures (via '>>') to the same > file. With the > current implementation of retrieve that is only > ever going to try to read in the first line and > probably not do > what you wish it to. > > What is your purpose for setting portable > to 0 for this? I'd like to understand what you are > trying to do > with this before I making any changes. > > Thanks, > Neil > > > On Thu > Mar 13 10:45:56 2008, charles.gowing@novainfo.com wrote:
> > This
> may be related to bug #23901. First the basic info:
> > Module > >
> version info
> > cpan> i Data::Serializer
> > CPAN: Storable loaded
> ok
> > (v2.15) > > Going to read
> C:\DOCUME~1\CGowing\LOCALS~1\Temp\cpan\Metadata
> > Database was
> generated on Wed, 12 Mar 2008 18:30:48 GMT
> > Strange > >
> distribution name [Data::Serializer]
> > Module id =
> Data::Serializer
> > DESCRIPTION Generic interface to serializer
> modules
> > CPAN_USERID > > NEELY (Neil A. Neely <neil@neely.cx>)
> > CPAN_VERSION 0.43
> > CPAN_FILE N/NE/NEELY/Data-Serializer-
> 0.43.tar.gz
> > UPLOAD_DATE > > 2007-12-20 > > DSLIP_STATUS
> RdpOp (released,developer,perl,object-
> > oriented,Standard-Perl)
> > MANPAGE Data::Serializer:: - Modules
> > that serialize
> data structures
> > INST_FILE C:\strawberry- > >
> perl\perl\site\lib\Data\Serializer.pm
> > INST_VERSION 0.43 > >
> cpan> i XML::Dumper
> > Strange distribution name [XML::Dumper] > >
> Module
> > id = XML::Dumper > > DESCRIPTION Converts XML from/to
> Perl code
> > CPAN_USERID MIKEWONG (Mike Wong
> <mike_w3@pacbell.net>)
> > CPAN_VERSION 0.81 > > CPAN_FILE
> M/MI/MIKEWONG/XML-Dumper-
> > 0.81.tar.gz > > UPLOAD_DATE 2006-
> 04-05
> > DSLIP_STATUS ampO? > > (alpha,mailing-list,perl,object-
> oriented,)
> > MANPAGE > > XML::Dumper - Perl module for dumping
> Perl objects from/to XML
> > INST_FILE C:\strawberry-
> perl\perl\site\lib\XML\Dumper.pm
> > INST_VERSION 0.81 > > > > > > > >
> cpan> i XML::Parser
> > CPAN: Storable loaded ok > > (v2.15) > > Going
> to read C:\DOCUME~1\CGowing\LOCALS~1\Temp\cpan\Metadata
> > Database
> was generated on Wed, 12 Mar 2008 18:30:48 GMT
> > Strange > >
> distribution name [XML::Parser]
> > Module id = XML::Parser > >
> DESCRIPTION Flexible fast parser with plug-in styles
> >
> CPAN_USERID
> > COOPERCL (Clark Cooper <clark@coopercc.net>) > >
> CPAN_VERSION 2.36
> > CPAN_FILE M/MS/MSERGEANT/XML-Parser-
> 2.36.tar.gz
> > UPLOAD_DATE > > 2007-11-20 > > DSLIP_STATUS
> bmcO? (beta,mailing-list,C,object-
> > oriented,) > > MANPAGE
> XML::Parser - A perl module for parsing
> > XML documents > >
> INST_FILE C:\strawberry-
> > perl\perl\site\lib\XML\Parser.pm > >
> INST_VERSION 2.36
> > > > Perl > > version info > > I'm usign
> Strawberry Perl:
> > C:\chas_sandbox\grammars>perl -v > > > > This is
> perl, v5.8.8 built for
> > MSWin32-x86-multi-thread > > > > Copyright
> 1987-2006, Larry Wall
> > > > Perl > > may be copied only under the
> terms of either the Artistic License or
> > the > > GNU General
> Public License, which may be found in the Perl 5
> > source kit. > >
> > Complete documentation for Perl, including FAQ lists,
> > should
> be found on
> > this system using "man perl" or "perldoc perl". > >
> If you have access to the
> > Internet, point your browser at > >
> http://www.perl.org/, the Perl Home Page.
> > > > I have expat
> installed
> > from expat-win32bin-2.0.1.exe (no small feat in itself
> - check out > perl-expat-xmlparser-
> > and-you/) > > > > OS Vendor and Version > >
> I'm on Windows XP:
> > C:\strawberry- > > perl\expat\Bin>ver > > > >
> Microsoft Windows XP [Version 5.1.2600]
> > > > Now > > for the bug > >
> I'm trying to use store/retrieve with the XML::Dumper
> > serializer
> and get:
> > no element found at line 1, column 10, byte 10 at > >
> C:/strawberry-perl/perl/site/l
> > ib/XML/Parser.pm line 187 > > > >
> I'm using
> > this fairly straightforward harness to test it: > >
> #/usr/bin/perl -Wl
> > use strict; > > use warnings; > > use
> Data::Dumper;
> > use Data::Serializer; > > my $datatostore =
> ['samplecomplexdata',
> > ['list','of','strings'], > >
> {hash=>'of',more=>'data'}
> > ]; > > my $datafromretrieve; > > my
> $Dserializer
> > = Data::Serializer->new(portable =>
> '0',serializer =>
> > 'Data::Dumper'); > > my $outfile = 'data.out';
> >
> > print > > Dumper($datatostore); > > $Dserializer->store( > >
> $datatostore,
> > $outfile, > > '>>' > > ); > > $datafromretrieve =
> $Dserializer->retrieve(
> > $outfile > > ); > > print
> Dumper($datafromretrieve);
> >
> #######################################
> > #now as xml > > my
> $Xserializer
> > = Data::Serializer->new(portable =>
> '0',serializer =>
> > 'XML::Dumper'); > > $outfile = 'data.xml'; > >
> > print Dumper($datatostore);
> > $Xserializer->store( > >
> $datatostore,
> > $outfile, > > '>>' > > ); > >
> $datafromretrieve = $Xserializer->retrieve(
> > $outfile > > );
> > print
> > Dumper($datafromretrieve); > > > > and getting the
> following output:
> > C:\chas_sandbox\grammars>retrievedemo.pl > >
> $VAR1 = [
> > 'samplecomplexdata', > > [ > >
> 'list',
> > 'of', > > 'strings' > > ], > >
> {
> > 'hash' => 'of', > > 'more' => 'data' > > }
> > ];
> > $VAR1 = [ > > 'samplecomplexdata', > >
> [
> > 'list', > > 'of', > > 'strings' > >
> ],
> > { > > 'hash' => 'of', > > 'more' =>
> 'data'
> > } > > ]; > > $VAR1 = [ > >
> 'samplecomplexdata',
> > [ > > 'list', > > 'of',
> > 'strings'
> > ], > > { > > 'hash'
> => 'of',
> > 'more' => 'data' > > } > > ]; > > > >
> no element found at line 1, column 10, byte 10 at
> > C:/strawberry-
> perl/perl/site/l
> > ib/XML/Parser.pm line 187 > >
> C:\chas_sandbox\grammars>
> >
> -----------------------------------------
> > Note: The information
> > contained in this email and in any
> > attachments is intended
> only for the person or entity to which it
> > is addressed and may
> contain confidential and/or privileged
> > material. Any review,
> retransmission, dissemination or other use
> > of, or taking of any
> action in reliance upon, this information by
> > persons or entities
> other than the intended recipient is
> > prohibited. The recipient
> should check this email and any
> > attachments for the presence of
> viruses. Sender accepts no
> > liability for any damages caused by
> any virus transmitted by this
> > email. If you have received this
> email in error, please notify us
> > immediately by replying to the
> message and delete the email from
> > your computer. This e-mail is
> and any response to it will be
> > unencrypted and, therefore,
> potentially unsecure. Thank you. NOVA
> > Information Systems,
> Inc. > > > > > > > ----------------------------------------- > Note: > The information contained in this email and in any > attachments is intended only for the person or entity to which it > is addressed and may contain confidential and/or privileged > material. Any review, retransmission, dissemination or other use > of, or taking of any action in reliance upon, this information by > persons or entities other than the intended recipient is > prohibited. The recipient should check this email and any > attachments for the presence of viruses. Sender accepts no > liability for any damages caused by any virus transmitted by this > email. If you have received this email in error, please notify us > immediately by replying to the message and delete the email from > your computer. This e-mail is and any response to it will be > unencrypted and, therefore, potentially unsecure. Thank you. NOVA > Information Systems, Inc.
----------------------------------------- Note: The information contained in this email and in any attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. The recipient should check this email and any attachments for the presence of viruses. Sender accepts no liability for any damages caused by any virus transmitted by this email. If you have received this email in error, please notify us immediately by replying to the message and delete the email from your computer. This e-mail is and any response to it will be unencrypted and, therefore, potentially unsecure. Thank you. NOVA Information Systems, Inc.
I just uploaded Data::Serializer version .44 to CPAN with several changes in place. It should be publicly available shortly. First off: retrieve now reads in the whole file instead of just the first line. This is reverse compatible with the default use of store. Secondly: The constructor can now have a flag of raw that you can set to a true value in order for the output to be in the native serializer format. So to pull off what you are looking for: my $xml = Data::Serializer->new(serializer => 'XML::Dumper', raw => 1); $xml->store($data,$file); and to retrieve it, use the same constructor and: $thawed = $xml->retrieve($file);
Subject: RE: [rt.cpan.org #34047] retrieve broken with XML::Dumper
Date: Fri, 14 Mar 2008 13:29:20 -0400
To: "'bug-Data-Serializer [...] rt.cpan.org'" <bug-Data-Serializer [...] rt.cpan.org>
From: "Gowing, Charles" <charles.gowing [...] novainfo.com>
Thanks again for the prompt reaponse. Is there any place I should go to "rate" you as module maintainer? ----------------------------------------- Note: The information contained in this email and in any attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. The recipient should check this email and any attachments for the presence of viruses. Sender accepts no liability for any damages caused by any virus transmitted by this email. If you have received this email in error, please notify us immediately by replying to the message and delete the email from your computer. This e-mail is and any response to it will be unencrypted and, therefore, potentially unsecure. Thank you. NOVA Information Systems, Inc.