Re: How to Run/Convert(?) Script Built on 5.8.4 to 5.004
by jettero (Monsignor) on May 08, 2007 at 15:08 UTC
|
It really depends on the code. There's no automatic way if that's what you mean.
Most things should run just fine. Some 5.8.x standard modules will be missing but will be available on CPAN. Others will be problematic to say the least. Cool syntaxes like open my $in, "<", $filename will likely have to be uncoolized... And now I'm rambling. But you see what I mean.
| [reply] [d/l] |
|
Some 5.8.x standard modules will be missing but will be available on CPAN
If that "some" includes; Encode, utf8 and friends, they can not be installed on legacy perl. Anything unicode related will not work or will not be correct.
Also there is an "our()" issue. If this is used, all must be replaced with "use vars"...
| [reply] |
Re: How to Run/Convert(?) Script Built on 5.8.4 to 5.004
by grinder (Bishop) on May 08, 2007 at 16:28 UTC
|
I need to run them on a office server where Perl 5.004 was installed
You might be interested in a talk Sébastien Aperghis-Tramoni gave at the Nordic Perl Workshop 2007 entitled Old Perls and New Code. It sounds like it covers the problem you're facing.
• another intruder with the mooring in the heart of the Perl
| [reply] |
Re: How to Run/Convert(?) Script Built on 5.8.4 to 5.004
by swampyankee (Parson) on May 08, 2007 at 15:47 UTC
|
Well, the first thing I'd try (as part of my Brute Force & Ignorance™ testing style) is to see which of your scripts work on the office server without change. You may luck out and have no work to do or find that the work is trivial.
If that doesn't work and you think changing the scripts is too much work, you could try convincing the sysadmin who manages your office server to install Perl 5.8 (recommended course).
emc
Insisting on perfect safety is for people who don't have the balls to live in the real world.
—Mary Shafer, NASA Dryden Flight Research Center
| [reply] |
Re: How to Run/Convert(?) Script Built on 5.8.4 to 5.004
by Albannach (Monsignor) on May 08, 2007 at 16:04 UTC
|
You might try using pp to package your scripts on your development machine with your development version of Perl, and they should run with your development version on the other machine, albeit with much slower startup times. pp can be fussy at times, but if your scripts aren't too odd this could be a very easy solution.
Note: I use pp often for target machines with no Perl installed at all, and I believe but am not certain that this approach will leave the old 5.004 installation unharmed (and hopefully the permissions are correctly set to ensure this) but I can't guarantee it.
--
I'd like to be able to assign to an luser
| [reply] |
Re: How to Run/Convert(?) Script Built on 5.8.4 to 5.004
by Limbic~Region (Chancellor) on May 08, 2007 at 17:07 UTC
|
neversaint,
This sounds like it might be a great (ab)?use of a Code::Critic policy. I do not know of any conversion routines and, quite frankly, I wouldn't trust them if they did exist.
Simply correcting issues identified by perl -Mstrict -wc script.pl is not going to cut the mustard but it is probably a good start. The problem arises when the code is valid (it compiles) but does not behave the same. That is why you should have a test-suite that works with the oldest version of Perl you intend to support.
| [reply] [d/l] |
Re: How to Run/Convert(?) Script Built on 5.8.4 to 5.004
by Burak (Chaplain) on May 08, 2007 at 19:14 UTC
|
| [reply] |
Re: How to Run/Convert(?) Script Built on 5.8.4 to 5.004
by NiJo (Friar) on May 08, 2007 at 17:45 UTC
|
Perlcc creates and compiles C code from your script. My suggestion is to compile in the 5.8.4 environment and deploy on (but don't use) 5.004. If you are using the same platform and if it is an standaolen type of script it might be feasible. But this is an experimental feature that requires full testing. | [reply] |
|
| [reply] [d/l] |
Re: How to Run/Convert(?) Script Built on 5.8.4 to 5.004
by ddn123456 (Pilgrim) on May 09, 2007 at 07:53 UTC
|
Alternatively as a quick workaround you could compile them into executables with the perl development kit.
Or even put them into 1 structured script either OO or procedural) with the possibility to launch the required internal functions & subprocedures by passing on specific commandline parameters. Then you can compile this into 1 general executable with the perl development kit.
Like this all required perl binaries and script code are compiled and the dependency on a perl platform is skipped for production environment.
The pdk only takes the minimum it needs to create the executable so you may end up with a file far smaller than the size of your perl installation.
In development environment however you will still need it.
Regards.
ddn123456 | [reply] |
Re: How to Run/Convert(?) Script Built on 5.8.4 to 5.004
by Moron (Curate) on May 09, 2007 at 15:09 UTC
|
perl -c works under 5.004 I think - identify each type of error with this and make a manual change e.g.
open my $fh, "<file.txt" or die "blah $!\n";
produces with perl -c (can run perl -c on anything including .pm files)
Can't use an undefined value as filehandle reference at blah.pl line 1
+23
So you resolve it with...
use FileHandle
# ...
my $fh = new FileHandle();
$fh -> open( "< file.txt" ) or die "blah $!\n";
It shouldn't take too long -- if there are too many, write a converter that implicitly splits by assigning $/ = ';', pattern-matches for each issue and does the conversion - it's not much work actually.
You'll also have to read release notes of intervening versions.
__________________________________________________________________________________
^M Free your mind! | [reply] [d/l] [select] |