Can't run a program from a PAR archive

2009-04-20 Thread Octavian Râşniţă

Hi,

I've created a .par archive with a Catalyst app under Windows XP Pro with 
Perl 5.10.0 but I can't run a program from that archive because it gives an 
error.

I think PAR might not use a certain module which is needed...

Here is the error:

E:\web\T7parl t7.par script/t7_server.pl
Can't locate mro.pm in @INC (@INC contains: CODE(0x135753c) 
C:\DOCUME~1\Octavian

\LOCALS~1\Temp\par-Octavian\cache-31f47a759bf1a2dca3b4eddab5538c327ccea7f2\inc\l
ib 
C:\DOCUME~1\Octavian\LOCALS~1\Temp\par-Octavian\cache-31f47a759bf1a2dca3b4edd
ab5538c327ccea7f2\inc\arch 
C:\DOCUME~1\Octavian\LOCALS~1\Temp\par-Octavian\cache
-31f47a759bf1a2dca3b4eddab5538c327ccea7f2\inc CODE(0x11e6594) 
e:\lucru\catalyst\

support\lib . CODE(0x11e6044)) at MRO/Compat.pm line 38.
BEGIN failed--compilation aborted at MRO/Compat.pm line 44.
Compilation failed in require at Class/MOP.pm line 9.
BEGIN failed--compilation aborted at Class/MOP.pm line 9.
Compilation failed in require at Moose/Exporter.pm line 10.
BEGIN failed--compilation aborted at Moose/Exporter.pm line 10.
Compilation failed in require at Moose.pm line 16.
BEGIN failed--compilation aborted at Moose.pm line 16.
Compilation failed in require at Catalyst/Engine/HTTP.pm line 3.
BEGIN failed--compilation aborted at Catalyst/Engine/HTTP.pm line 3.
Compilation failed in require at ./script/t7_server.pl line 6.
BEGIN failed--compilation aborted at ./script/t7_server.pl line 7.
E:\web\T7

Thank you.

Octavian



Re: Can't run a program from a PAR archive

2009-04-20 Thread Roderich Schupp
2009/4/20 Octavian Râşniţă orasn...@gmail.com:
 I've created a .par archive with a Catalyst app under Windows XP Pro with
 Perl 5.10.0 but I can't run a program from that archive because it gives an
 error.
 I think PAR might not use a certain module which is needed...

 Can't locate mro.pm in @INC (@INC contains: CODE(0x135753c)

OK, looks like mro.pm is missing.

For starters, can you re-create the par file explicitly requesting this module,
e.g. if you used pp to create it then add -M mro to the command line.
If that works we can look into why this dependency was missed.
BTW, did you specify -B when you created the .par?

Cheers, Roderich


Re: Can't run a program from a PAR archive

2009-04-20 Thread Octavian Râşniţă

From: Roderich Schupp roderich.sch...@googlemail.com

2009/4/20 Octavian Râşniţă orasn...@gmail.com:

I've created a .par archive with a Catalyst app under Windows XP Pro with
Perl 5.10.0 but I can't run a program from that archive because it gives 
an

error.
I think PAR might not use a certain module which is needed...



Can't locate mro.pm in @INC (@INC contains: CODE(0x135753c)



OK, looks like mro.pm is missing.


mro seems to be a perl pragma starting with Perl 5.9.

For starters, can you re-create the par file explicitly requesting this 
module,

e.g. if you used pp to create it then add -M mro to the command line.
If that works we can look into why this dependency was missed.
BTW, did you specify -B when you created the .par?


I created the .par archive of that Catalyst app using:

perl Makefile.PL
nmake
nmake test
nmake catalyst_par

For the moment I don't know where to look to see what code is executed when 
doing nmake catalyst_par.



Cheers, Roderich


Thank you.

Octavian



Re: Can't run a program from a PAR archive

2009-04-20 Thread Octavian Râşniţă

From: Roderich Schupp roderich.sch...@googlemail.com
2009/4/20 Octavian Râşniţă orasn...@gmail.com:

I created the .par archive of that Catalyst app using:

perl Makefile.PL
nmake
nmake test
nmake catalyst_par


OK, you probably started off developing your app by running

catalyst.pl

right? That created a skeleton file tree including the Makefile.PL above.
If you run perl Makefile.PL this generates a stanza:

catalyst_par :: all
   $(NOECHO) $(PERL) -Ilib \
  -Minc::Module::Install -MModule::Install::Catalyst \
  -eCatalyst::Module::Install::_catalyst_par('', 'Foo-Bar',
 { CLASSES = [], CORE = 0, ENGINE = 'CGI',
   MULTIARCH = 0, SCRIPT = '', USAGE = q## } )

Hence make catalyst_par eventually invokes
Catalyst::Module::Install::_catalyst_par
(which is from Module::Install::Catalyst) which generates the .par by 
calling

App::Packer::PAR. The problem is the parameter CORE = 0.
This tells PAR _not_ to pack any Perl core modules into the .par file.
Now for Perl 5.10, mro.pm _is_ a core module. So your .par file is not
fully self contained and won't run under parl.exe on a machine that
doesn't have perl (5.10) installed.

To fix add catalyst_par_core(1) to Makefile.PL _before_
the call to catalyst() and re-run perl Makefile.PL. This should
change CORE = 0 to CORE = 1in the generated Makefile
and result in a .par containing (amon other stuff) mro.pm.

Thank you. This way it works (even though not well), however I don't think I 
should add that line, because I tried to run the perl script from the PAR 
archive on the same machine it was created, immediately after creating it, 
in the same location it was created.

And here I use Perl 5.10.0...

Thank you.

Octavian




Re: Can't run a program from a PAR archive

2009-04-20 Thread Roderich Schupp
2009/4/20 Octavian Râşniţă orasn...@gmail.com:

 Thank you. This way it works (even though not well), however I don't think I
 should add that line, because I tried to run the perl script from the PAR
 archive on the same machine it was created, immediately after creating it,
 in the same location it was created.
 And here I use Perl 5.10.0...

Look at the error message from your original post:

Can't locate mro.pm in @INC (@INC contains: CODE(0x135753c) C:\DOCUME~1\Octavian
\LOCALS~1\Temp\par-Octavian\cache-31f47a759bf1a2dca3b4eddab5538c327ccea7f2\inc\l
ib C:\DOCUME~1\Octavian\LOCALS~1\Temp\par-Octavian\cache-31f47a759bf1a2dca3b4edd
ab5538c327ccea7f2\inc\arch C:\DOCUME~1\Octavian\LOCALS~1\Temp\par-Octavian\cache
-31f47a759bf1a2dca3b4eddab5538c327ccea7f2\inc CODE(0x11e6594) e:\lucru\catalyst\

@INC does _not_ contain any directory from your Perl installation (see the ouput
of perl -V of what to expect). And that's correct, since you ran
this script under
parl.exe which is a self-contained perl loader, i.e. one executable
that includes:

- a custom perl interpreter including the perl shared library
(libperl510.dll or similar)
- the minimal set of Perl modules that are needed to use PAR.pm

(All @INC members
C:\DOCUME~1\Octavian\LOCALS~1\Temp\par-Octavian\cache-31f47a759bf1a2dca3b4eddab5538c327ccea7f2\...
plus one of the CODE refs
come from parl.exe. The other CODE ref is for useing modules packed
into your .par.)

Anyway, stuff run under parl.exe isn't supposed to use stuff from any
installed perl.
If you want to use your original .par on a machine with Perl 5.10 installed,
don't run it under parl, but under _perl_, probably a line like

perl -MPAR t7.par t7_server.pl

should do the trick (perldoc PAR has more information).

Cheers, Roderich