[comp.lang.perl] Patch 9 from outer space

merlyn@iwarp.intel.com (Randal Schwartz) (02/19/90)

In article <7105@jpl-devvax.JPL.NASA.GOV>, lwall@jpl-devvax (Larry Wall) writes:
| P.S. Here's the scoop: if argv[0] contains "perl", and #!WHATEVER doesn't
| contain "perl", it will invoke WHATEVER for you.  It will even throw
| in the first argument after WHATEVER like it's supposed to.  Note that
| it recognizes "perl" anywhere in the WHATEVER, not just at the end.

So if I go...

perl <<EOF
#!/some/interpreter foo bar bletch long-args more-long-args
stuff for some interpreter
EOF

...I can get by the stupid 32 char two arg restriction in the kernel?
Nifty.  S'pose that's one way.  'course, it means invoking Perl first
(and even a shell, given this!).  Durn.

And just how *large* is patch9 up to now?  Must I reserve another 4Meg
to hold the sources (or patches)?

print pack('C25', reverse unpack('C25', ',rekcah lreP rehtona tsuJ'));
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/

tneff@bfmny0.UU.NET (Tom Neff) (02/19/90)

In case anyone was wondering WHY I wanted a way to force Perl to pass
things on to /bin/sh or whatever -- I am planning to define Perl as the
interpreter of choice in a few environments like Chip Salzenberg's Deliver
program.  Many of my delivery scripts are naturals for Perl, and the
rewrite is under way.  But why waste the time loading /bin/sh first
and then changing to Perl?  Etcetera.

Actually we could generalize this even further, like using it in vi(1),
if Perl respected the "-c" switch like SH and CSH.

	perl -c "myscript.pl arg1 arg2..."

should behave just like

	perl myscript.pl arg1 arg2...

...anyway I think I hear my Mommy calling :-) so I won't say anything about
Patch 9 >MMMMPPPHH!<

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (02/20/90)

In article <1990Feb18.190513.464@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes:
: So if I go...
: 
: perl <<EOF
: #!/some/interpreter foo bar bletch long-args more-long-args
: stuff for some interpreter
: EOF
: 
: ...I can get by the stupid 32 char two arg restriction in the kernel?
: Nifty.  S'pose that's one way.  'course, it means invoking Perl first
: (and even a shell, given this!).  Durn.

Sorry, I implemented the two arg restriction.  (But not the 32 char
restriction.)

: And just how *large* is patch9 up to now?

I don't know till I make the diffs, actually.  I'm speaking figuratively
when I say >>patch9.

: Must I reserve another 4Meg to hold the sources (or patches)?

Someone suggested another partition might be in order...

Larry

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (02/20/90)

In article <15187@bfmny0.UU.NET> tneff@bfmny0.UU.NET (Tom Neff) writes:
: Actually we could generalize this even further, like using it in vi(1),
: if Perl respected the "-c" switch like SH and CSH.
: 
: 	perl -c "myscript.pl arg1 arg2..."
: 
: should behave just like
: 
: 	perl myscript.pl arg1 arg2...

Except that the -c argument to sh is a legal sh script, and the -c argument
to csh is a legal csh script.  So the -c argument to perl should be a legal
perl script.  And "myscript.pl arg1 arg2" isn't.

 	perl -c "system 'myscript.pl arg1 arg2...';"

would be legal perl.  Of course, that might end up executing /bin/sh again.

You might say that you want it to act as if it were a shell.  But what if
you say

 	perl -c "myscript.pl arg1 arg2 | myotherscript.pl arg1 arg2"

Should perl handle that?  How much shell syntax do I put into perl?

Larry

tneff@bfmny0.UU.NET (Tom Neff) (02/20/90)

In article <7113@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes:
>You might say that you want it to act as if it were a shell.  But what if
>you say
>
> 	perl -c "myscript.pl arg1 arg2 | myotherscript.pl arg1 arg2"
>
>Should perl handle that?  How much shell syntax do I put into perl?

I was afraid he'd ask that :-) ;-)

I suppose it'd be a royal PITA to add that kind of thing.  All I can point
out is that if it WERE added, Perl would come that much closer to being
the universally flexible shell it's already darn close to now.

I, uh, wouldn't hold up Patch 9 for it.............................