ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-xml
perl-xml
RE: POSSIBLE BUG in XML::Simple
by Grant McLean other posts by this author
Sep 3 2002 9:31PM messages near this date
view in the new Beta List Site
RE: :SAX and Filters | ANNOUNCE: XML::LibXSLT 1.52
Hi Nicky

I tried running your code on a Linux box and had no problem.

If I read it right, your failure occurs only after 55 failed
backtick evaluations?(!?)

It really does look like your XML::SAX::PurePerl installation
is broken.  Here's a simple script to test it:

  #!/usr/bin/perl

  package MyHandler;

    use XML::SAX::Base;

    @MyHandler::ISA = qw( XML::SAX::Base );

    sub start_element { print $_[1]-> {Name}, "\n"; }

  package main;

    use XML::SAX::PurePerl;

    my $handler = MyHandler-> new();
    my $parser = XML::SAX::PurePerl-> new(Handler => $handler);

    $parser-> parse_string('<hello><world/></hello>');

You mention that you have XML::Parser installed, but from
the looks of the output  you also have XML::SAX installed
so XML::Simple is using it by preference and is not using
XML::Parser (or expat) at all.

You could force XML::Simple to ignore SAX and use XML::Parser
by adding this line after 'use XML::Simple;':

  $XML::Simple::PRE­FERRED_PARSER = 'XML::Parser';

Alternatively, you could install XML::SAX::Expat.

I'd also recommend ssh over rsh :-)

Good luck

Grant

==========================================================
Grant McLean     | The Web - A Division of KPMG Consulting
grantm@[...].nz |  Level 6, 20 Customhouse Quay, Box 1195
+64 4 495 8250   |  Wellington, New Zealand  www.web.co.nz



>  -----Original Message-----
>  From: Nikola Janceski [mailto:nikola_janceski@[...].com]
>  Sent: Wednesday, September 04, 2002 8:04 AM
>  To: Perl XML (E-mail)
>  Cc: 'grantm@cpan.org'
>  Subject: POSSIBLE BUG in XML::Simple
>  
>  
>  Hey folks,
>  	I think I finally resolved my issue with my "strange 
>  error" posts
>  from a few weeks ago. It has rotted my brains trying to 
>  breakdown the code
>  to it's simpliest form where the action still occurs. And I have
>  replicatable code now. I have CCed the author/copyrighter.
>  
>  I need someone to confirm if it's a bug on different OS platforms and
>  versions of rsh. You might want to look at this when you have 
>  a few minutes
>  to spare.
>  
>  The Error:
>  ----------
>  Can't locate object method "new" via package 
>  "XML::SAX::PurePerl" (perhaps
>  you forgot to load "XML::SAX::PurePerl"?) at
>  /somepath/perl-5.6.1-unix/lib/perl5/site_perl/5.6.1/XML/SAX/Pa
>  rserFactory.pm
>  line 37.
>  
>  [but I have expat installed correctly]
>  
>  Here are my specs:
>  ------------------
>  SunOS host1 5.6 Generic_105181-29 sun4u sparc SUNW,Ultra-80
>  rsh is from OS distribution and according to the man pages is (14 July
>  1994).
>  Perl 5.6.1 with XML::Simple1.08_01, XML-Parser-2.31, 
>  expat-1.95.4 and other
>  modules not related to this.
>  
>  The code:
>  ---------
>  # your perl here
>  use XML::Simple;
>  
>  my $XML_FILE = "/u/njancesk/test.xml";
>  die "Can't read $XML_FILE\n" if !-r "$XML_FILE"; #check permissions
>  
>  while ($n++ < 55 ){ ## error on 55 or greater when rsh
>  `IAmNotACommand`; # some command that doesn't exist 
>  (originally was a typo)
>  # yeah I know I should be checking $! and $? (the work around)
>  }
>  
>  my $SHOW = XMLin("$XML_FILE", forcearray => 1 );
>  __END__
>  
>  
>  $XML_FILE contains:
>  -------------------
>  <opt>
>    <AAAA date="8/12/2002" show="1" name="V3.1.5" />
>    <BBBB date="8/12/2002" show="1" name="V3.1.5" />
>    <CCCC date="8/12/2002" show="1" name="V3.1.9" />
>  </opt>
>  
>  
>  Steps to replicate:
>  -------------------
>  1. run a command line rsh to the host you are on with the 
>  script path as the
>  command.
>  ie. /bin/rsh host1 /u/njancesk/pl.pl
>  2. see the error, if you didn't see the error try making the 
>  55 in the while
>  loop a bigger number.
>  
>  
>  Strange thing is this ONLY happens when you run the script via an rsh
>  command line. if the number is less than 55 the error doesn't 
>  occur. if it's
>  run on the command line without rsh on the same host, no error occurs.
>  
>  I don't know if it's a bug with the module, core perl, or 
>  rsh, but this is
>  by far the wackiest possible bug I have run into. I depleted 
>  20 hours trying
>  to fix this error in my script, which I found a work around.
>  
>  Thank you for your help and contributions!
>  
>  Nikola Janceski
>  
>  Thinking is easy, it's implementing ideas and putting 
>  thoughts to paper that
>  is difficult.
>  -- Nicky J. from da' Bronx
>  
>  
>  --------------------------------------------------------------
>  --------------
>  --------------------
>  The views and opinions expressed in this email message are 
>  the sender's
>  own, and do not necessarily represent the views and opinions of Summit
>  Systems Inc.
>  
>  _______________________________________________
>  Perl-XML mailing list
>  Perl-XML@[...].com
>  To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>  
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved