Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Error in File::Basename

by Scarborough (Hermit)
on Sep 28, 2005 at 10:44 UTC ( [id://495690]=perlquestion: print w/replies, xml ) Need Help??

Scarborough has asked for the wisdom of the Perl Monks concerning the following question:

Hello fellow monks,
Really perplexed here but may be a obvious mistake can anyone see it.

my $data = XMLin("C:\\core\\jobs_1.xml"); #works perfectly my $filename = $config->{'DRIVE'}.$config->{'JOBS_XML_FILE'} print $filename."\n"; my $data = XMLin($filename); __OUTPUT__ C:\\core\\jobs_1.xml panic: pp_match start/end pointers at C:/Perl/lib/File/Basename.pm lin +e 186.
Needless to say I am panicing a little.
Updated code
use strict; my $config = XMLin("config.xml"); my $data = XMLin("C:\\core\\jobs_1.xml"); #works perfectly my $config = XMLin("config.xml"); my $filename = $config->{'DRIVE'}.$config->{'JOBS_XML_FILE'} $filename =~ s/\\\\/\\/g; print $filename."\n"; my $data = XMLin($filename); __OUTPUT__ C:\core\jobs_1.xml panic: pp_match start/end pointers at C:/Perl/lib/File/Basename.pm lin +e 186.
And I'm still getting the same message;
Update 2 Thanks to all the monks who have answered here. perl -v gave

This is perl, v5.8.3 built for MSWin32-x86-multi-thread (with 8 registered patches, see perl -V for more detail) Copyright 1987-2003, Larry Wall Binary build 809 provided by ActiveState Corp. http://www.ActiveState. +com ActiveState is a division of Sophos. Built Feb 3 2004 00:28:51

But this is not the problem. After some investigation I found the problem must be in Komodo which I am using to edit and run this program. When I ran it at the command line no problems XMLin read the file and and the program continued on its merry way. Strange

Replies are listed 'Best First'.
Re: Error in File::Basename
by holli (Abbot) on Sep 28, 2005 at 10:51 UTC
    In an expression like $filename = "C:\\core\\jobs_1.xml" you only use the double backslashes to escape a single backslash.
    Here $var really contains C:\core\jobs_1.xml.

    But your $filename contains the double backslashes (as shown by the print statement), and that could be the reason for your problem.


    holli, /regexed monk/
Re: Error in File::Basename
by GrandFather (Saint) on Sep 28, 2005 at 10:55 UTC

    In your first line of code you assign something to $data, but don't use it. Then you assign something to $filename, but we can't tell what because you don't define $config or show us where it comes from.

    Is there some important code missing here. Like use strict; use warnings; usesomeModuleand a line that shows use where $config came from?


    Perl is Huffman encoded by design.
Re: Error in File::Basename
by Steve_p (Priest) on Sep 28, 2005 at 16:58 UTC

    The panic itself is caused by an eval statement which is probably executed somewhere in the XMLin() call. Unfortunately, without also having the data in the files, $filename and config.xml, and what versions of Perl or the modules you are using, your problem a cannot be resolved.

Re: Error in File::Basename
by dcd (Scribe) on Sep 28, 2005 at 19:40 UTC
    The panic message you printed reports an error in File::Basename, but you should also indicate the version number of perl, and where you got it
    perl -V
    output would be valuable.
    As others have said, the function XMLin is not part of the core perl, so it is very difficult for anyone to reproduce the problem without more information. Do you think you could reproduce the problem without XMLin? (obviously, there must be some other code that you didn't reproduce in your post, right :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://495690]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-04-25 13:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found