Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

use 5.005 with perl v5.16.3

by sijaanh (Initiate)
on Aug 04, 2021 at 07:38 UTC ( [id://11135605]=perlquestion: print w/replies, xml ) Need Help??

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

Hi,

I'm trying to run a perl script from a machine which has perl v5.16.3.

I'm getting the following errors:

panic: attempt to copy freed scalar 1915c08 to 19c24f0 at /perl/perl_f +or_sij/JSON/backportPP.pm line 10. Compilation failed in require at (eval 35) line 2. at /tools/siji_general.pm line 809. Compilation failed in require at /tools/siji_general.pm line 809. BEGIN failed--compilation aborted at /tools/siji_general.pm line 809. Compilation failed in require at /tmp/mv.pl line 44.

Line 10 of backportPP.pm is the following: use 5.005;

Line 809 of siji_general.pm is the following: use JSON;

I have no idea what is the issue here, can anyone explain how can I overcome this?

Thanks

Replies are listed 'Best First'.
Re: use 5.005 with perl v5.16.3
by hippo (Bishop) on Aug 04, 2021 at 08:30 UTC

    Welcome to the monastery, sijaanh. As you have provided no code the advice will have to be somewhat general in nature.

    Try to compile each of /perl/perl_for_sij/JSON/backportPP.pm, /tools/siji_general.pm and /tmp/mv.pl in isolation in that order. The first one that fails is where the problem really lies. Then apply the Basic debugging checklist to the file which failed.

    If you cannot resolve it that way, you could present an SSCCE - noting that the first S stands for "short". Nobody is going to want to wade through 1000 lines of siji_general.pm as it stands.

    Good luck.


    🦛

      Okay I found when it happens" In /siji_general.pm this give the compilation error above:

      use lib "//perl/perl_for_siji"; use JSON;

      But this does not:

      use JSON; use lib "//perl/perl_for_siji";

      What might be the issue and how can I solve it without changing the code at all. Thanks

        That means you've got two (probably different) versions of JSON in /perl/perl_for_siji and in the standard library locations (@INC), and the one in /perl/perl_for_siji appears to be broken somehow. There are different ways to try and debug and fix this, however, it's unclear to me why you even need libraries from /perl/perl_for_siji, so you'd need to explain your installation more for us to be able to give good advice.

Re: use 5.005 with perl v5.16.3
by kcott (Archbishop) on Aug 04, 2021 at 21:19 UTC

    G'day sijaanh,

    Welcome to the Monastry.

    [Please note: Writing sloppy, "couldn't care less" posts, like you have above, will simply be ignored by many, and possibly downvoted. You would've been presented with a "Preview" screen and yet you chose to post what we see above. See "How do I post a question effectively?" for a better way to handle this.]

    I get the impression from your post that you don't fully understand either "use VERSION" or "require VERSION". I don't have the vintage versions of Perl that you've mention; however, the following should provide useful examples (note that perle provides lots of feedback if problems are encountered).

    $ alias perle alias perle='perl -Mstrict -Mwarnings -Mautodie=:all -MCarp::Always -E +' $ perlbrew list * perl-5.34.0 perl-5.33.5 perl-5.32.0 perl-5.30.0 $ perle 'use 5.034; no warnings "experimental::try"; use feature "try" +; try { 1 == 2 } catch($e) { }' $ perlbrew switch perl-5.32.0 $ perle 'use 5.034; no warnings "experimental::try"; use feature "try" +; try { 1 == 2 } catch($e) { }' Perl v5.34.0 required--this is only v5.32.0, stopped at -e line 1. main::BEGIN() called at -e line 1 eval {...} called at -e line 1 BEGIN failed--compilation aborted at -e line 1.

    Ask further (and better) questions if you need more help with any of this.

    — Ken

Re: use 5.005 with perl v5.16.3
by Anonymous Monk on Aug 05, 2021 at 09:41 UTC
    What happens if you run this program
    use JSON;

      use JSON; is a statement, not a program. What happens if you provide a program to run?

      Win8 Strawberry 5.8.9.5 (32) Thu 08/05/2021 14:31:49 C:\@Work\Perl\monks >perl -MJSON -e print(1) 1 Win8 Strawberry 5.8.9.5 (32) Thu 08/05/2021 14:33:13 C:\@Work\Perl\monks >perl -e "use JSON; print(1)" 1 Win8 Strawberry 5.8.9.5 (32) Thu 08/05/2021 14:33:41 C:\@Work\Perl\monks >perl -e "use strict; use warnings; use JSON; print(1)" 1


      Give a man a fish:  <%-{-{-{-<

        I suppose it's a matter of semantics ("what constitutes a program?") but I disagree with you. A program consisting of just use JSON; executes a whole bunch of code, any of which could fail for various reasons. That's why the other AM asked.

A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11135605]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-20 09:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found