[comp.lang.perl] Recent patches

ripley@opal.cs.tu-berlin.de (Hans-Ch. Eckert) (08/22/90)

Hello folks.

In the recent patches, there have been many lines starting with 'Subject:'.
Is there any reason for this? Using 'grep ^Subj *' in the spool-directory
to search for the patches and other interesting things is impossible :-(

Greetings,
				RIPLEY
--
Greetings from RIPLEY | UUCP: ripley@tubopal.UUCP (ripley@opal.cs.tu-berlin.de)
Hans-Christian Eckert |         ...!unido!tub!opal!ripley (Europe) 
D-1000 Berlin 30      |         ...!pyramid!tub!opal!ripley (World)
Regensburger Str. 2   | BITNET: ripley%tubopal@DB0TUI11.BITNET (saves $$$)

merlyn@iwarp.intel.com (Randal Schwartz) (08/22/90)

In article <RIPLEY.90Aug22043124@kubus.cs.tu-berlin.de>, ripley@opal (Hans-Ch. Eckert) writes:
| In the recent patches, there have been many lines starting with 'Subject:'.
| Is there any reason for this? Using 'grep ^Subj *' in the spool-directory
| to search for the patches and other interesting things is impossible :-(

Larry's trying to keep you from using grep, knowing that Perl will do
the job.  Use:

	perl -ne 'print "$ARGV: $_" if /^Subject:/; close(ARGV) if /^$/' *

instead.  It's probably faster anyway, since you don't have to look
all the way through each file.

:-)

print "Just another Perl [book] hacker,"
-- 
/=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!"=/

roy@cs.umn.edu (Roy M. Silvernail) (08/23/90)

merlyn@iwarp.intel.com (Randal Schwartz) writes:

> Larry's trying to keep you from using grep, knowing that Perl will do
> the job.  Use:
> 
> 	perl -ne 'print "$ARGV: $_" if /^Subject:/; close(ARGV) if /^$/' *
> 
> instead.  It's probably faster anyway, since you don't have to look
> all the way through each file.

OK, I'm a Perl novice (MS-DOS version, PL18, 4dos), but this line gives
me a problem. Perl hands me

Can't open perl script "$ARGV: $_": No such file or directory

when I try it. I have also tried under command.com, and I diddled with
whitespace and paramaters (-n -e, and so on), but no dice. Is this just
the DOS curse?

Placing it in a script file, ala

while (<>) {
        print "$ARGV: $_" if /^Subject:/;
        close(ARGV) if /^$/;
        }

works just fine when I invoke 'perl myscript *'. Why is the command line
version blowing up?
--
    Roy M. Silvernail   | #include <stdio.h>                 | Does virtual
    now available at:   | main(){                            | reality need
 cybrspc!roy@cs.umn.edu |  float x=1;                        | swap space?
(cyberspace... be here!)|  printf("Just my $%.2f.\n",x/50);} | -- me

ripley@opal.cs.tu-berlin.de (Hans-Ch. Eckert) (08/23/90)

In article <1990Aug22.062517.25360@iwarp.intel.com> merlyn@iwarp.intel.com (Randal Schwartz) writes:

   Larry's trying to keep you from using grep, knowing that Perl will do
   the job.  Use:

	   perl -ne 'print "$ARGV: $_" if /^Subject:/; close(ARGV) if /^$/' *

   instead.  It's probably faster anyway, since you don't have to look
   all the way through each file.

Tough luck as Perl is not available on the university's net :-(
(That's why I had to wait for the ST-Port to be able to print the refguide !)

Greetings,
				RIPLEY
--
Greetings from RIPLEY | UUCP: ripley@tubopal.UUCP (ripley@opal.cs.tu-berlin.de)
Hans-Christian Eckert |         ...!unido!tub!opal!ripley (Europe) 
D-1000 Berlin 30      |         ...!pyramid!tub!opal!ripley (World)
Regensburger Str. 2   | BITNET: ripley%tubopal@DB0TUI11.BITNET (saves $$$)

merlyn@iwarp.intel.com (Randal Schwartz) (08/23/90)

In article <18PBo1w162w@cybrspc>, cybrspc!roy@cs (Roy M. Silvernail) writes:
| > 	perl -ne 'print "$ARGV: $_" if /^Subject:/; close(ARGV) if /^$/' *
| OK, I'm a Perl novice (MS-DOS version, PL18, 4dos), but this line gives
| me a problem. Perl hands me
| 
| Can't open perl script "$ARGV: $_": No such file or directory
| 
| when I try it. I have also tried under command.com, and I diddled with
| whitespace and paramaters (-n -e, and so on), but no dice. Is this just
| the DOS curse?

I suspect it is, since you said it works if you put it into a file.
Too bad.  I ran the line right from my emacs buffer to test it, so I
*know* it works fine under a *real* shell. :-)

I'd guess your shell is completely ignoring the single quotes, because
that's the sort of error you'd get from a real shell if you left the
single quotes off.  Too bad (he mutters again).

Doesn't BASH work under Messy-Dos?  (I don't touch anything that has a
braindamaged 4004-upward-compatible segmented chip in it, so I
couldn't tell you.)

print "Just another Perl [book] hacker," # sorry... I'll think of something else soon
-- 
/=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!"=/

merlyn@iwarp.intel.com (Randal Schwartz) (08/23/90)

In article <RIPLEY.90Aug23015126@troll.cs.tu-berlin.de>, ripley@opal (Hans-Ch. Eckert) writes:
| Tough luck as Perl is not available on the university's net :-(
| (That's why I had to wait for the ST-Port to be able to print the refguide !)

Foo!  Bring it up yourself.  That's how it's been around me up until
last month (when I finally convinced myself to bite the bullet and
install it in the public directories).

Really.  Configure handles most of the hard work.  All you need is a
tall C compiler and an asterisk to steer her by.  If you want the
kits, I'll mail'em to you.  (Just him, guys... I'm not a human
mailserver!)

@a=("cker,","er Pe","Just ","rl ha","anoth");for(2,4,1,3,0){print@a[$_];}
-- 
/=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!"=/

roy@cs.umn.edu (Roy M. Silvernail) (08/24/90)

merlyn@iwarp.intel.com (Randal Schwartz) writes:

> I'd guess your shell is completely ignoring the single quotes, because
> that's the sort of error you'd get from a real shell if you left the
> single quotes off.  Too bad (he mutters again).

T'would seem so. I even tried using backtick (`) quoting under 4dos, and
still had problems. Strangely enough, a small batch file showed that the
` quoting _does_ deliver the whole string to 4dos as a single argument.
Perl, though, doesn't seem to accept it. (joining in the muttering)

> Doesn't BASH work under Messy-Dos?

I don't know... I've tried the script under ms_sh (recently posted to
c.b.i.p), and I get the same results. Backtick quoting under ms_sh gives
2 shell errors, and Perl thinks the first file in the expanded * is a
script (ignoring the command-line script altogether). If I had the
sources to BASH, I might try porting to MS-DOS. I haven't seen them,
though. (BASH was my shell of choice when I was news admin on a 386/ix
box)

> (I don't touch anything that has a
> braindamaged 4004-upward-compatible segmented chip in it, so I
> couldn't tell you.)

And if I had something superior to it, I'd certainly be running it...
unfortunately, I'm stuck in DOS 'till I can finagle something else.
Anybody got a spare Sun? :-)

Thanks for the hints, Randal.
--
    Roy M. Silvernail   | #include <stdio.h>                 | Does virtual
    now available at:   | main(){                            | reality need
 cybrspc!roy@cs.umn.edu |  float x=1;                        | swap space?
(cyberspace... be here!)|  printf("Just my $%.2f.\n",x/50);} | -- me

darrylo@hpnmdla.HP.COM (Darryl Okahata) (08/24/90)

In comp.lang.perl, roy@cybrspc.HP.COM writes:

> merlyn@iwarp.intel.com (Randal Schwartz) writes:
> 
> > I'd guess your shell is completely ignoring the single quotes, because
> > that's the sort of error you'd get from a real shell if you left the
> > single quotes off.  Too bad (he mutters again).
> 
> T'would seem so. I even tried using backtick (`) quoting under 4dos, and
> still had problems. Strangely enough, a small batch file showed that the
> ` quoting _does_ deliver the whole string to 4dos as a single argument.
> Perl, though, doesn't seem to accept it. (joining in the muttering)

     Usually, when MSDOS programs are executed, all arguments are
*CONCANTENATED* into a single line (which *must* be less than 128
characters -- the ^&%$~#@%?! maximum allowed length of a command line),
and this line is passed to the MSDOS program to be executed.  With C,
the MSDOS startup code (the dos equivalent to /lib/crt0.o) must then
parse this line and convert it into argc and argv, which are then passed
to main().

     I'll bet that it is this second parsing of the command line (the
first, I imagine, is done by 4dos) that is causing your problems.  The
solution is to:

     1. Prevent the shell (4dos, in this case?) from interpreting quote
        characters; these characters should be passed verbatim to the
        MSDOS program.

     2. Modify your MSDOS startup routine to do proper argc/argv
        processing with quotes.  I know that this can be done under
        both MicroSoft and Turbo C, although I do not have any source
        code to do this.

     -- Darryl Okahata
	UUCP: {hplabs!, hpcea!, hpfcla!} hpnmd!darrylo
	Internet: darrylo%hpnmd@hp-sde.sde.hp.com

DISCLAIMER: this message is the author's personal opinion and does not
constitute the support, opinion or policy of Hewlett-Packard or of the
little green men that have been following him all day.

roy@cs.umn.edu (Roy M. Silvernail) (08/26/90)

darrylo@hpnmdla.HP.COM (Darryl Okahata) writes:

>      I'll bet that it is this second parsing of the command line (the
> first, I imagine, is done by 4dos) that is causing your problems.  The
> solution is to:
> 
>      1. Prevent the shell (4dos, in this case?) from interpreting quote
>         characters; these characters should be passed verbatim to the
>         MSDOS program.

This isn't a problem for single quotes, as they aren't important to
4dos.

>      2. Modify your MSDOS startup routine to do proper argc/argv
>         processing with quotes.  I know that this can be done under
>         both MicroSoft and Turbo C, although I do not have any source
>         code to do this.

Aha! I hadn't thought of this idea. Turbo C comes with source to the
startup code. My only problem may be getting Perl to compile under
Turbo. I've heard that it won't.

Thanks, Darryl, for clearing up my confusion.
--
    Roy M. Silvernail   | #include <stdio.h>                 | Does virtual
    now available at:   | main(){                            | reality need
 cybrspc!roy@cs.umn.edu |  float x=1;                        | swap space?
(cyberspace... be here!)|  printf("Just my $%.2f.\n",x/50);} | -- me

darrylo@hpnmdla.HP.COM (Darryl Okahata) (08/26/90)

In comp.lang.perl, roy@cybrspc.HP.COM writes:

> Aha! I hadn't thought of this idea. Turbo C comes with source to the
> startup code. My only problem may be getting Perl to compile under
> Turbo. I've heard that it won't.

     I know that it did not compile under Turbo C 1.0 (an ancient
version) because the large switch statement produced by yacc/bison
caused Turbo C to run out of memory.  I haven't tried it under the
latest Turbo C++ 1.0, although I imagine that it still won't compile (I
used Turbo C++ to compile the output from yacc, and Turbo C++ still ran
out of memory).

     -- Darryl Okahata
	UUCP: {hplabs!, hpcea!, hpfcla!} hpnmd!darrylo
	Internet: darrylo%hpnmd@hp-sde.sde.hp.com

DISCLAIMER: this message is the author's personal opinion and does not
constitute the support, opinion or policy of Hewlett-Packard or of the
little green men that have been following him all day.