in reply to Opinions on migrating Perl scripts from 5.005 to 5.8.1?

If the 5.005 program is reasonably well-written, it is likely to run under 5.8.1 without modification. The newer perl has more features, but is backward compatable with 5.005. At worst, 5.8 is a little more free with warnings.

That's no reason not to improve the program, it just lets you stop when you run out of time :)

After Compline,
Zaxo

  • Comment on Re: Opinions on migrating Perl scripts from 5.005 to 5.8.1?

Replies are listed 'Best First'.
Re: Re: Opinions on migrating Perl scripts from 5.005 to 5.8.1?
by Lori713 (Pilgrim) on Sep 22, 2003 at 18:30 UTC
    Your reply intrigued me, so I changed the shebang line just to see what would happen. After a couple of changes ("EQ" to "eq", etc.), I get the following error message:

    Can't call method "ct_execute" on an undefined value at /local/www/htdocs/scripts/pimgmt/nc_pf_58mainmenu.pl line 3717.

    Here's the main script that calls various subroutines (notice no use strict; at this point in time but I'm hoping to change that once I dig in):

    #!/usr/local/bin/perl5_8 use CGI; use CGI ':standard'; use CGI::Carp qw(fatalsToBrowser); use vars qw($CGI); use Sybase::CTlib; $CGI = new CGI(); # Get parameters based on login, etc. &get_parms($CGI); # When global employee id ($g_empid) is blank, # initialization routines are bypassed and you drop out. if ( $g_empid eq "" ) { &valid_user; } # Clear the STDOUT buffers so MIME can get out; print html headers $|=1; print "content-type: text/html\n\n"; # Display Campus Main Menu and begin main processing &main_process;
    And here's the subroutine where the error message is generated:
    sub valid_user() { # INITIALIZATION STEP 1: # Check system availability &set_db_env; $get_results=0; $sql = "select STATUS , MESSAGE FROM $g_pfsec_db.dbo.NC_PF_STATUS "; $db_avail= new Sybase::CTlib $g_pfsecid,$g_pfsecpw,$g_pfsecsrv; $db_avail->ct_execute($sql) ; <====THIS IS LINE 3717 while ( $db_avail->ct_results($restype) == CS_SUCCEED ) { next unless $db_avail->ct_fetchable($restype); while ( ($dbf_STATUS, $dbf_MESSAGE) = $db_avail->ct_fetch ) { $get_results++; $app_status = "$dbf_STATUS"; if ( $dbf_STATUS eq "U" ) { $|=1; print "content-type: text/html\n\n"; &top_hdrs; &display_msg($dbf_MESSAGE); exit; } }
    So, I dug around here for some answers... and have read a lot (the rods and cones in my eyes are going nuts staring at a white screen for so long). I'm getting the impression the database doesn't like how I'm speaking to it, but that's only a guess. Do I need to tweak something because of the new version of Perl? Thanks for any help you can provide! Lori

      That sounds like Sybase::CTlib is not yet installed for perl 5.8.

      Update: The names of the functions might change, but I wouldn't expect it outside a major version change. The default exports might change, though. I don't use Sybase, can't advise on that. Try checking all your db calls for errors. The messages may clarify the problem, and that is an excellent improvement for your rewrite.

      After Compline,
      Zaxo

        I confirmed that it is installed in 5.8. Maybe the Sybase::CTlib has a different version and I need to tweak some of the key words (i.e., maybe something used to be called "fred" but now it's "freddy")? Could that be it?

      It sure looks as if $db_avail= new Sybase::CTlib $g_pfsecid,$g_pfsecpw,$g_pfsecsrv failed and as $db_avail now does not contain a valid reference to an object, $db_avail->ct_execute($sql) gives you this error. So it seems Sybase::CTlib is loaded but does not work.

      This may or not may be due to the fact that Sybperl (of which Sybase::CTlib is/was a part) is not ported to all systems.

      M. Peppler, author of Sybperl, writes on his website:

      Note: Recent versions of ActiveState (perl 5.8.x) don't offer PPMs for sybperl or DBD::Sybase any more. As a replacement there is a PPM repository maintained by perlmonk's "crazyinsomniac" at http://crazyinsomniac.perlmonks.org/perl/ppm/. I have not used these packages, so I can't comment on how well they work.

      Could it perhaps be that an old version of Sybperl was installed? A search on CPAN showed no hits for Sybase::CTlib anymore (except Apache::Sybase::CTlib), not even in the Sybperl distribution.

      I suggest you contact the author of Sybperl and ask for his comments.

      CountZero

      "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

        Thanks for the info. Just something I'd like to clarify for my own self... ;-)

        Does it matter that I get this error message on our Unix box? I thought ActiveState Perl was only on Windows... or am I not seeing the whole picture of how this stuff works together? (wouldn't be the first, nor will it be, the last!).