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

I've got a Perl script that I need to run with a different interpreter. Unfortunately, I can't change the code at all, I can only run it from a wrapper script. So I'm trying a line like this:

/new/perl script.pl

But I get this error:

/old/perl: relocation error: (blahblah)/DBI/DBI.so: undefined symbol: Perl_get_sv

I made a local copy of the script and manually changed the #! to point to /new/perl. This works fine. So why's it still running /old/perl when I make the switch from the command line?

---
A fair fight is a sign of poor planning.

Replies are listed 'Best First'.
Re: Sidestepping the Shebang
by sgifford (Prior) on Nov 02, 2005 at 17:08 UTC
    As Perl Mouse mentioned, Perl interprets the shebang line itself for various reasons. To work around that, how about removing that line altogether:
    tail +2 script.pl |/new/perl
Re: Sidestepping the Shebang
by Perl Mouse (Chaplain) on Nov 02, 2005 at 16:53 UTC
    Unlike most interpreters, Perl does pay attention to the she-bang line, and it may fire up the interpreter mentioned on it if it thinks that isn't some form of perl.

    Could you tell us the exact she-bang line, and tell us the exact command line you give that fails? The OS might be useful as well.

    Perl --((8:>*
      Sure thing.

      Shebang line:
      #!/usr/bin/perl

      Command line:
      /tmp/perl -x /home/sprad/test/broken.pl

      This is on a Linux box. Red Hat 7.2, if it makes a difference. Bash shell. I've tried it with and without the -x flag, no difference.

      ---
      A fair fight is a sign of poor planning.

        That means perl shouldn't fire up "/usr/bin/perl", so that isn't the problem. I'm afraid I can't further help you - I don't think I can replicate your behaviour (I often run with a different version of perl than mentioned on the she-bang line, and never have problems with it.)
        Perl --((8:>*
Re: Sidestepping the Shebang
by Delusional (Beadle) on Nov 03, 2005 at 11:07 UTC
    Perhaps the information found on the mySQL support pages will help you.

    On second though, perhaps not. Miss read the information...