in reply to Re: pp (PAR-Packer) - how to access included data files
in thread pp (PAR-Packer) - how to access included data files

I wasn't really clear about the use of PAR_TEMP, given the advice not to use it in https://metacpan.org/dist/PAR/view/lib/PAR/Environment.pod .

I finally figured out that "/", which the doc says is the root under which included files are stored, could be computed at runtime by dirname($ENV{PAR_0}) . "/inc".

Replies are listed 'Best First'.
Re^3: pp (PAR-Packer) - how to access included data files
by bliako (Abbot) on Nov 07, 2022 at 09:27 UTC
    dirname($ENV{PAR_0}) . "/inc".

    Why you want to go low level when you have this? :

    # PAR::read_file() returns a file inside any loaded PARs my $conf = PAR::read_file('data/MyConfig.yaml');

    (from SYNOPSIS)

        sorted link thanks

      I must have overlooked read_file(). Thanks.

      In my case, the easiest approach was to doctor the @ARGV before processing it, as follows:

      if (exists $ENV{PAR_TEMP}){ # running via PAR/pp push @ARGV, "$ENV{PAR_TEMP}/inc/lex.dict"; }
Re^3: pp (PAR-Packer) - how to access included data files
by swl (Prior) on Nov 07, 2022 at 01:50 UTC

    The docs could be a bit clearer but my reading is that PAR_TEMP should not be assigned to but is fine to read from.

    Your approach will still work, though.