Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: "PAR'ing" XML configs?

by davidrw (Prior)
on Aug 08, 2005 at 15:45 UTC ( #481918=note: print w/replies, xml ) Need Help??


in reply to Re: "PAR'ing" XML configs?
in thread "PAR'ing" XML configs?

Yes, but what OP needs is a way then, from the perl script, to know where the included file is in order to read it. This part of the FAQ led me to look at $ENV{PAR_TEMP} and see what the directory structure was and where the added test.txt was placed.
# pp -o a.exe -a test.txt test.pl #test.pl: open FILE, $ENV{PAR_TEMP} . "/inc/" . "test.txt"; while(<FILE>){ print; } close FILE;

Replies are listed 'Best First'.
Re^3: "PAR'ing" XML configs?
by guice (Scribe) on Aug 08, 2005 at 16:13 UTC

    That's it. Thanks!

    Everything is extraced under the $ENV{PAR_TEMP}/inc/. I was able to successfully create a test script using the following:

    test.xml
    <opt date="test> <test>This is a test</test> <company id="test" /> </opt>
    test.pl
    #!/usr/bin/perl use strict; use XML::Simple; use Data::Dumper; my $xml = new XML::Simple; my $ret = $xml->($ENV{'PAR_TEMP'} . "/inc/test.xml"); print Dumper($ret);
    Compiled with: pp -o test.exe -a test.xml test.pl

    Moved the PAR package to another directory and ran it. It ran successfully.

    I guess for testing, one can check to see if PAR_TEMP is set. If it's not, assume a command line run else assume PAR run, since the PATH to your file will definatly be different based on a PAR or command line run.

    -- philip
    We put the 'K' in kwality!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2022-11-28 21:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?