Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl 5.6 vs 5.8

Status
Not open for further replies.

Newposter

Technical User
May 9, 2002
735
0
0
US
Anyone notice problems running scripts that worked in 5.6 and Redhat 6.2, under 5.8 and Redhat 8.0? I have guestbook scripts that worked in the older versions, but which give global errors for the variables on a new server with these newer programs. Permissions and paths are all correct. Do I have to rewrite the scripts just because of the newer versions? Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
What are the global errors? You might have had packages installed under 5.6.1 that aren't in 5.8.0 yet, but that's just a guess. ----------------------------------------------------------------------------------
...but I'm just a C man trying to see the light
 
I got errors when using perl 5.8 under RedHat 8.0 too. Perl 5.8 works fine under Redhat 7.1, 7.2, and I think the problem is on Redhat 8.0. I don't know what causes the problem, Hope someone find it out for me too.

Here is an example of perl scrip that work fine on Tru64, Digital, Redhat 7.1, 7.2, 7.3 except one Redhat 8.0:

-----------------
#!/usr/bin/perl -w

open (IN, "./in.txt") || die "Could not open: $!";
$line = <IN>;
chomp ($line);

@la = split /\s*\|\s*/, $line;

for (my $i=0; $i<@la; $i++) {
print &quot;$la[$i]\n&quot;;
}
-----------------


in.txt file (one continuous line)
-----------
ID |MOMID|DADID|SEX|AGERISK |DIS|d1s2660 |d1s214 |d1s450 |d1s2667 |d1s2697 |
-------------
 
I'll have to go home to find the exact error text, but it referenced Global Errors for each variable $userip, $username, etc. that is in the script. There was an error for each instance. Rewriting the variables to my $userip, my $username, etc. eliminated the errors one at a time. But I'm not going to rewrite 100+ lines of code that all worked properly when it was run on a 3rd party host with Redhat 6.2 and Perl 5.6. Something has changed to make a good script go bad, so I'd like to understand it first before going the hard route.

I have successfully run a test script hello.pl, and it worked (displayed the &quot;Hello, world!&quot; message), so I know the permissions are OK and Perl is installed and executes. The guestbook script did initiate email, and I don't have Sendmail configured, so I commented out all affected lines - no correlation. Newposter
&quot;Good judgment comes from experience. Experience comes from bad judgment.&quot;
 
Is there a possibility that use strict; is at the top of your script?
 
That's how I trapped all these errors. But it wouldn't run before I put that in. It just enabled me to see what was tripping me up. I just don't understand why yet, because the script ran fine before and is unchanged. Newposter
&quot;Good judgment comes from experience. Experience comes from bad judgment.&quot;
 
Hi Newposter,

use strict will generate a compile time error for any variables that are not declared with a my statement, aren't fully qualified, or aren't imported.

Working/Not working - dunno.
Can you do a diff on the two files?

PaulTEG

 
There are no differences.

I just read, however, that PERL 5.8 has &quot;improvements&quot; that render some previous script files useless and requires recompiling. So I think I'll head over to the Linux server forum and find out how to uninstall 5.8 and install 5.6 in its place. Newposter
&quot;Good judgment comes from experience. Experience comes from bad judgment.&quot;
 
I seem to recall a way you can force a script to run as a previous version of perl. Can anyone help me as to what it could be? It might just be something I read in the early apocalypses about perl 6 backwards compat. ----------------------------------------------------------------------------------
...but I'm just a C man trying to see the light
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top