http://qs321.pair.com?node_id=345469


in reply to Re: Re: Re: Re: Ensuring forward compatibility
in thread Ensuring forward compatibility

Changing shebangs should be no problem for an abbot.
#! /usr/bin/perl use strict; use warnings; use File::Find; File::Find->find(&main::wanted, '/'); sub wanted { if (-T $File::Find::name) { open ("FILE", "< $File::Find::name") or die ("$!: Could not open " . $File::Find::name); my $first_line = <FILE>"; unless ($first_line =~ m(^\#\!\s{0,1}/usr/bin/perl\n$) { return 0; } $first_line =~ s[perl][perl5]i; while (<FILE>) { $first_line .= $_; } close ("FILE") or die ("Could not close file " . $File::Find::name . " because $!"); # create a temp file so if we get interrupted # we won't lose our data `cp $File::Find::name $File::Find::name~`; open ("FILE", "> $File::Find::name") or die("Can't open $File::Find::name for " . "writing because $!"); print FILE $first_line; close ("FILE") or die ("Cannot close $File::Find::name " . "because $!"); # get rid of the temp file unlink ("$File::Find::name~"); } }

Want to support the EFF and FSF by buying cool stuff? Click here.

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: Ensuring forward compatibility
by kelan (Deacon) on Apr 15, 2004 at 18:28 UTC

    I would personally have no problem doing something like this (or even recommending it to a supervisor if Perl 6 were being considered), but I can picture a lot of people grumbling if Larry were to mandate it as The Way Forward.

    Again, I support a move like this that would separate the binary names. It would make the whole "How do we decide if it's Perl 5 or 6?" question moot. It's the masses that I imagine are (or would be) opposed to the idea that are keeping us in this mess.

      I'm just pointing out that it doesn't have to be done by the development team. I plan on using the above script, or one similar to it, to separate Perl 5 and Perl 6 for some time to come. Of course, I suppose you need to know that you can change what the Perl Binary is installed as in the ./configure script in order to do this. Perhaps it would make sense for this to be the standard in the installation. It wouldn't be hard for people creating new code to point to /usr/bin/perl6, and it would be very easy for the Perl compiler to differentiate between Perl 5 and Perl 6

      Want to support the EFF and FSF by buying cool stuff? Click here.