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

Hello Monks,

I need your help again.

I have several questions on pp.

1. Since par files are essentially zipped archives, they should be cross platform. However, I read in the documentation that the Binary file (I am assuming it meant the par file) created by pp should be used on the same o/s where it was created. If par file is cross platform then it should not matter which platform it was generated, right?

2. I tried pp the following two ways, however both methods give me out of memory error.

2a.

pp --multiarch --output=t1.par script\main.pl<br> par t1.par

2b.

pp -P -o t1.pl script\main.pl<br> perl t1.pl

My script, main.pl is not complicated. It is barely 200 lines long. What may be happening here?

3. I have a set of scripts which get called from main.pl. Should I include the called scripts in just one par file?

As addtional information, I should mention that my scripts are coded in a very simple way. The were not created as module. I hope that should not matter. I am currently using Strawberry Perl 5.10 on Win XP.

Thanks so much.

Ash

Replies are listed 'Best First'.
Re: Quesion on PAR::Packer
by afoken (Chancellor) on Mar 30, 2009 at 19:37 UTC

    1 and 3: PAR packs your file, the required modules and DLLs into a ZIP file. The DLLs won't work on other platforms, sometimes, they don't even work on another computer with the same platform. Only pure-perl PARs may be cross-platform.

    2. Show us the actual error message, show us the script.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      Hello Alex,

      Thanks so much for responding.

      1. I did not know that DLL is included in the zip. So I believe that -d switch should remove the dll?

      3. Code: Pease see below. The error message is:
      Memory Overflow!

      #!/user/bin/perl # A perpetual run flag ($PERPETUAL_RUN variable) can be set to "Y" so +that the # script keeps running perpetually until shutdown manually. # IMPORTANT: This script requires the following packages: # Date::Formatter use strict; #use warnings; use Config::IniFiles; use Date::Formatter; use IO::Handle; use Cwd; use Fcntl qw(:flock); use IPC::Run3; # Variables # Configurable: my $PERPETUAL_RUN="N"; my $SLEEP_TIME=30; # In seconds. # Variables from configuration file my $ORA_USER; my $ORA_PWD; my $ORA_SERVER; # Variables from Oracle itself my $ORA_DIR_NAME_PHYSICAL; my $GZIPPER_COMMAND; my $MIMENCODER_COMMAND; # Local and temporary variable my $AMA_DIR; my $AMA_MIME_LOG_FILE; my $WORK_DIR; my $AMA_INI="ama.ini"; my $AMA_SECTION="AMA"; my $AMA_AUTO_SECTION="AMA_AUTO_GENERATED"; my $AMA_MIME_LOCK_FILE="ama_mime_lock.txt"; my $AMA_SUBSYSTEM="MIME"; my $AMA_SMTP_AGENT_SCRIPT="ama_smtp_agent.pl"; my $AMA_MIME_SCRIPT="_temp_mime.pl"; # This script is generated automa +tically. From config parameter. my $CURR_DT = Date::Formatter->now(); my $FHLOCK; my $Config; # Sqlplus variables my @SQLPLUSCMD; my $SQLSTMT; my $SQLOUPUT; my $v1; sub MyEval { my $RET; $RET=`@_`; eval($RET); return 0; } sub PrintLog { my $C_DT; $C_DT=Date::Formatter->now(); $C_DT->createDateFormatter("(YYYY)-(MM)-(DD) (hh):(mm):(ss)"); print $C_DT." ".$_[0]."\n"; return 0; } sub LockActive { PrintLog "Another copy of $0 is already running. Exiting.\n"; exit(1); } sub GetOraConfigParam { my $TEMP1=`perl _get_config_param.pl "$_[0]" "$_[1]"`; if (length($TEMP1) > 1) { $TEMP1=substr($TEMP1,0,length($TEMP1)-1); } return $TEMP1; } sub strReplace { # @PARAM $subject The string that we are operating on. # @PARAM $search String that you want to replace. # @PARAM $replace Replacement string. # @PARAM $count (optional) Limit the number of instances to replace +. my $subject = shift; # the scalar we are +operating on my $search = shift; # what to find my $replace = shift; # what to replace it + with if (! defined $subject) { return -1; } my $count = shift; if (! defined $count) { $count = -1; } # start iterating my ($i,$pos) = (0,0); while ( (my $idx = index( $subject, $search, $pos )) != -1 ) { substr( $subject, $idx, length($search) ) = $replace; $pos=$idx+length($replace); if ($count>0 && ++$i>=$count) { last; } } return $subject; } sub FixFolderName { # Fixes the folder names with backslashes to forward slashes (Windows +platform specific). return (strReplace($_[0],'\\','/')); } # Main code starts here # Set the local variables $CURR_DT->createDateFormatter("(YYYY)(MM)(DD)"); $AMA_DIR=cwd(); $WORK_DIR=$AMA_DIR."/work"; $AMA_MIME_LOG_FILE=$AMA_DIR."/log/mime".$CURR_DT.".txt"; $AMA_MIME_LOCK_FILE=$AMA_DIR."/lock/".$AMA_MIME_LOCK_FILE; $AMA_SMTP_AGENT_SCRIPT=$AMA_DIR."/".$AMA_SMTP_AGENT_SCRIPT; # Make work directory mkdir ($WORK_DIR,"755"); # Make log directory mkdir ($AMA_DIR."/log","755"); # Make lock directory mkdir ($AMA_DIR."/lock","755"); # Open log files in extend mode. open OUTPUT, '>>', $AMA_MIME_LOG_FILE or die $!; open ERROR, '>>', $AMA_MIME_LOG_FILE or die $!; # Redirect the stdout and stderr to log files now. #STDOUT->fdopen( \*OUTPUT, 'w' ) or die $!; STDOUT->autoflush(1); #STDERR->fdopen( \*OUTPUT, 'w' ) or die $!; STDERR->autoflush(1); PrintLog ("AMA session started. Arguments passed ".@ARGV); $Config = new Config::IniFiles( -file => "$AMA_INI", -nocase => 1); $ORA_USER=$Config->val($AMA_SECTION,"ORA_USER"); $ORA_PWD=$Config->val($AMA_SECTION,"ORA_PWD"); $ORA_SERVER=$Config->val($AMA_SECTION,"ORA_SERVER"); $v1="Hello There"; print $v1; open my $pipe_fh, '|-', 'sqlplus.exe -s scott/tiger@butthead' or die "Can't open pipe: $!"; print {$pipe_fh} <<'END_OF_SQL' set echo off set lines 1000 set trims on set serverout on size 999999 set feed off select * from emp; --select * from dept; --exec dbms_output.put_line(\'$v1\'); -- Will not work because variab +les do not expand. exec dbms_output.put_line('Hello There'); exit; END_OF_SQL ; close $pipe_fh; print "End of report.\n"

      Ash