On Sat, Jun 02, 2012 at 12:57:22 -0400 , Shawn H Corey wrote:
> On 12-06-02 12:23 PM, sono...@fannullone.us wrote:
> >     Is it possible to use a shebang line, like #!/usr/bin/env perl, so
> >     that scripts will use the currently selected version of Perl with
> >     perlbrew?  According to the help, it appears that perlbrew only
> >     changes the version for the CLI:
> >
> >
> >COMMAND: SWITCH
> >     Usage: perlbrew switch [<name>  ]
> >
> >     Switch to the given version, and makes it the default for this and all
> >     future terminal sessions.
> >
> >
> >     Right now, I'm hardcoding the version of Perl in my scripts, like:
> >
> >#!/Users/marc/perl5/perlbrew/perls/perl-5.16.0/bin/perl
> >
> >but it's an inconvenience to change the shebang line in all my
> >scripts just to try a different version.  It would be nice if
> >perlbrew took care of that as well.
> >
> >     It seems like it should do this automatically, so maybe I don't have
> >     something set up correctly, but googling hasn't helped.
> >
> >Thanks,
> >Marc
> 
> I don't know anything inside perlbrew that will help, but you could do this:
> 
> sudo ln -s /Users/marc/perl5/perlbrew/perls/perl-5.16.0/bin/perl
> /usr/local//bin/perl
> 
> Then change your shebangs to: #!/usr/local/bin/perl
> 
> This has the advantage of not having to run your profile to get the
> correct version of perl and when you upgrade, you just have to change
> the symlink to upgrade all your scripts.

And the disadvantage of clobbering whatever's in /usr/local/bin/perl,
defeating the point of perlbrew in the first place.

Don't do that.

Yes, the `#!/usr/bin/env perl` shebang should do. I've used it with
perlbrew myself.

-- 
Chris Nehren           | Coder, Sysadmin, Masochist
Shadowcat Systems Ltd. | http://shadowcat.co.uk/

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to