Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^5: Convertion Perl Script to Exe with PAR::Packer pp

by marchiore (Initiate)
on Jul 25, 2014 at 12:56 UTC ( [id://1095041]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Convertion Perl Script to Exe with PAR::Packer pp
in thread Convertion Perl Script to Exe with PAR::Packer pp

i have tried
pp -x -o -a "jofalista.xlsx" gmail_att.pl
but without success. If i package the file with -a can i change the xlsx after the compilation?? UPDATE: it works when i change in the script "__FILE__" to "$0" but i can't change the information in the xlsx. is it possible?

Replies are listed 'Best First'.
Re^6: Convertion Perl Script to Exe with PAR::Packer pp
by Corion (Patriarch) on Jul 25, 2014 at 12:59 UTC

    No. You get the file embedded in the compiled result.

    Maybe you want to explain some more about why you're packaging things and what problems you're actually trying to solve?

      The problem is: i create this script to send files attached on a e-mail. The e-mail list is xlsx where i have the colunm 0 with the name and colunm is the e-mail to send than i see the name of the file (is the same value of colunm 0) and send the e-mail. The problem is if i need to change the xlsx i'll have to convert again but this script will run on the user pc.

        Aah - that makes it clearer:

        my $diretorioScript = dirname(__FILE__); my $excel = Spreadsheet::XLSX->new( "$diretorioScript\\jofalista.x +lsx", );

        dirname(__FILE__) is not what you want, because the program will be expanded under C:\TEMP or somewhere.

        What you want is documented in PAR::Environment. I guess $ENV{PAR_PROGNAME} is what you want.

        my $diretorioScript= $ENV{PAR_PROGNAME} # running under PAR || dirname($0); # running directly

        Is there some reason the xlsx file needs to be included in the .exe file? This xlsx file is really part of the program's input, not the program itself. I would suggest enhancing your program to allow the user to specify the xlsx files to use.

        At the very least, I would look for a way to discover the location of the .exe file then look for the xlsx file there.

        Another option would be to tell the users to put the xlsx file in their "My Documents" folder. On Win7, you can find this with:

        $ENV{USERPROFILE} . "\\My Documents\\"

        On other versions of MS Windows, open a cmd window and type set to get a list of the environment variables. Then you can find the one that gets you the closest. Use that and modify the appended path as needed.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-20 00:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found