in reply to "PAR'ing" XML configs?

You need to use the -a option to pp.

     -a, --addfile=FILE|DIR
         Add an extra file into the package.  If the file is a
         directory, recursively add all files inside that
         directory, with links turned into actual files.

         By default, files are placed under "/" inside the
         package with their original names.  You may override
         this by appending the target filename after a ";", like

             % pp -a "old_filename.txt;new_filename.txt"
             % pp -a "old_dirname;new_dirname"

         You may specify "-a" multiple times.


Oh Lord, won’t you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, won’t you burn me a Knoppix CD ?
(Missquoting Janis Joplin)

Replies are listed 'Best First'.
Re^2: "PAR'ing" XML configs?
by davidrw (Prior) on Aug 08, 2005 at 15:45 UTC
    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 open FILE, $ENV{PAR_TEMP} . "/inc/" . "test.txt"; while(<FILE>){ print; } close FILE;

      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:

      <opt date="test> <test>This is a test</test> <company id="test" /> </opt>
      #!/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

      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!

Re^2: "PAR'ing" XML configs?
by guice (Scribe) on Aug 08, 2005 at 15:44 UTC

    Nice! Then do I access the file like I normally would: $xml=XMLin("config.xml")? Or do I access it via "/config.xml"?

    Thanks again though, this is one step I needed, which I actually forgot about. The problem I was facing was referencing the file...

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