[15539] in Perl-Users-Digest
Perl-Users Digest, Issue: 2949 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 4 16:13:22 2000
Date: Thu, 4 May 2000 11:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <957463515-v9-i2949@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 4 May 2000 Volume: 9 Number: 2949
Today's topics:
Re: [RegExp] Matching UPPERCASE words ... (Ilya Zakharevich)
Re: BUG? Get comand line parameter with ActiveState Per <dewitt@jlab.org>
Re: Calling `J' (Iverson's J, _not_ Java) from perl <perin@panix.com>
Re: Calling `J' (Iverson's J, _not_ Java) from perl <DNess@Home.Com>
Re: Can anyone recommend a good book (Jon S.)
Re: CGI and Radio buttons (brian d foy)
Re: CGI and Radio buttons <bmb@ginger.libs.uga.edu>
Re: CGI and Radio buttons <godzilla@stomp.stomp.tokyo>
Re: CGI and Radio buttons <lr@hpl.hp.com>
Re: CGI and Radio buttons <jeff@vpservices.com>
Re: CGI and Radio buttons <godzilla@stomp.stomp.tokyo>
Re: CGI and Radio buttons <andrew.mcguire@walgreens.com>
Re: CGI and Radio buttons <godzilla@stomp.stomp.tokyo>
Re: CGI and Radio buttons (Jerome O'Neil)
Re: CGI and Radio buttons (Jerome O'Neil)
file upload <jlee@totalise.co.uk>
Re: finding and replacing a string <andrew.mcguire@walgreens.com>
Re: Help counting things with Perl <ew@epl.org>
Re: How can I declare variables in the command line at <ak@dasburo.de>
Re: How can I declare variables in the command line at nobull@mail.com
Re: How can I declare variables in the command line at <lr@hpl.hp.com>
Re: How can I declare variables in the command line at <sid@eurekanet.com>
Re: How can I install perl modules under Windows ? <lr@hpl.hp.com>
Re: How can I run auto-download file in browser ? <lr@hpl.hp.com>
how do I open it (Crisper)
Re: how do I open it <andrew.mcguire@walgreens.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 4 May 2000 15:45:51 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: [RegExp] Matching UPPERCASE words ...
Message-Id: <8es5vf$qjs$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Bart Lateur
<bart.lateur@skynet.be>],
who wrote in article <391b5d22.8935308@news.skynet.be>:
> > for my $char (map chr, 0..255) {
> > push @a, $char if $char =~ /\w/ and uc $char eq $char;
> > }
> > my $pat = join '', @a;
> > /[$pat]+/;
> >
> >and hope that "]" and "-" are not uppercase chars in the given locale. ;-]
>
> I would hope that "]" and "-" are not matched by /\w/.
Even if they *are* word characters in the given locale?!!
Ilya
------------------------------
Date: Thu, 04 May 2000 11:17:28 -0400
From: Shane Dewitt <dewitt@jlab.org>
Subject: Re: BUG? Get comand line parameter with ActiveState Perl
Message-Id: <39119488.590AAC8B@jlab.org>
almost samething happened to me, my command pipes are empty :(
when i run 2 perl scripts in a pipe the STDIN is empty
im using windows2000, also i got the same error in envent log.
Markus Enders wrote:
> Hi Clinton,
>
> "Clinton A. Pierce" wrote:
>
> > Post code please.
>
> There is really no need to post code. @ARGV has no centents, though it
> should have one.
>
> But if you want, I just wrote a small script, to check it:
>
> #!/usr/bin/perl
>
> print "Get command line parameters....\n";
>
> print "Anzahl:".$#ARGV."\n";
> print "Parameter:\n";
>
> foreach $parameter (@ARGV) {
> print $parameter."\n";
> }
>
> > If you claim to have a bug, show us.
>
> The problem is, I do not know, why this error occured. It occured
> suddenly, as I described in my posting.
>
> After I deinstalled the whole PERL and installed it again, it worked. I
> just wonder, without doing anything on the machine: why did the error
> occur.
> Under Windows NT there is a message in the "Ereignismonitor"
> (eventmonitor). It's about the same time, when this error occured:
> event-id 5000 and event-id 5001:
> perlSE.dll detached by process ID 228
>
> Both events occured in the same second.
>
> I'd really know, what happened. It is quite important to us, that the
> scripts are running (they are doing some batch processing).
>
> Ciao
> Markus
--
Shane Dewitt Email: dewitt@jlab.org
TR 53C Phone: 757-269-7592
------------------------------
Date: 04 May 2000 11:50:47 -0400
From: Lewis Perin <perin@panix.com>
Subject: Re: Calling `J' (Iverson's J, _not_ Java) from perl
Message-Id: <pc7r9bi1fhk.fsf@panix6.panix.com>
David Ness <DNess@Home.Com> writes:
> ISI's `J' programming language (broadly speaking Iverson's follow-on to APL)
> provides a .DLL `server' that can be called to run J code and to very
> effectively handle array computations. Are there any perl functions available
> for calling a `J' server?
If nobody's implemented an interface to the DLL (I'm assuming this is
for a 32-bit Microsoft OS) you can do it yourself with the module
Win32::API that comes with recent ActiveState Perl builds.
/Lew
--
Lew Perin / perin@mail.med.cornell.edu / perin@acm.org
www.panix.com/~perin/
------------------------------
Date: Thu, 04 May 2000 17:41:45 GMT
From: David Ness <DNess@Home.Com>
Subject: Re: Calling `J' (Iverson's J, _not_ Java) from perl
Message-Id: <3911B65C.4F698983@Home.Com>
Lewis Perin wrote:
>
> David Ness <DNess@Home.Com> writes:
>
> > ISI's `J' programming language (broadly speaking Iverson's follow-on to APL)
> > provides a .DLL `server' that can be called to run J code and to very
> > effectively handle array computations. Are there any perl functions available
> > for calling a `J' server?
>
> If nobody's implemented an interface to the DLL (I'm assuming this is
> for a 32-bit Microsoft OS) you can do it yourself with the module
> Win32::API that comes with recent ActiveState Perl builds.
>
> /Lew
> --
I (think I) understand this. However, the `J Server' (it is a .DLL) communicates
complex structures by wrapping and un-wrapping its communications with
`stuff'. To create and remove this you need intimate understanding (I think) of
the way J handles this stuff, and it is precisely this work that I would like to
avoid doing if anyone else has dealt with the problem.
Anyway, thanks for taking the trouble to respond.
------------------------------
Date: Thu, 04 May 2000 17:32:36 GMT
From: jonceramic@nospammiesno.earthlink.net (Jon S.)
Subject: Re: Can anyone recommend a good book
Message-Id: <3911b3ca.15159399@news.earthlink.net>
On Tue, 2 May 2000 19:20:46 -0400, tadmc@metronet.com (Tad McClellan)
wrote:
>On Tue, 02 May 2000 22:22:30 GMT, Jon S. <jonceramic@nospammiesno.earthlink.net> wrote:
>
>>The O'Reilly Perl books get you started great and teach
> ^^^^^^^^^^
>>you Perl great, but for this newbie, they are a little short on
>>specifics for web use.
>
>
>Because they are *Perl* books, not web books.
>
>Get a book about the web if you want to read stuff about the web :-)
>
>Perl is not the web. The web is not Perl.
>
>Perl was getting work done before the CGI even existed.
I know. As a newbie, I've read or paged through them all. Learning
Perl explains the situation right up front. That was why I posted
what I did. After all, it was the original poster who wanted to learn
Perl for CGI in a week and everyone else who suggested the O'Reilly
series on Perl.
BTW, why hasn't anyone just gone ahead and just created
comp.lang.perl.cgi or comp.lang.perl.www and got it over with already?
After all, what unsuspecting newbie would know that a .misc group was
really an .only.ask.about.pure.perl.or.you.might.get.flamed group?
Jon
------------------------------
Date: Thu, 04 May 2000 11:19:52 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: CGI and Radio buttons
Message-Id: <brian-0405001119520001@171.new-york-76-77rs.ny.dial-access.att.net>
In article <MPG.137b24b03f322c8c98a9f4@nntp.hpl.hp.com>, Larry Rosler <lr@hpl.hp.com> wrote:
>In article <brian-0405000245440001@187.new-york-63-64rs.ny.dial-
>access.att.net> on Thu, 04 May 2000 02:45:44 -0400, brian d foy
><brian@smithrenaud.com> says...
>> In article <3910FC92.1D9A37@stomp.stomp.tokyo>, "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
>> > foreach $i (0 .. $#in)
>> > {
>> > $in[$i] =~ s/\+/ /g;
>> > ($key, $value) = split (/=/,$in[$i],2);
>> > ($value eq "") && next;
>> > $key =~ s/%(..)/pack ("c",hex($1))/ge;
>> > $value =~ s/%(..)/pack ("c",hex($1))/ge;
>> > $in{$key} .= $value;
>> there's a bug i haven't seen in the other bad CGI parsers.
>> just concatenate all of the values so you can't tell what
>> the original values are.
>The bug would bite only if two or more parameters had the same name.
and if that isn't true, then the concatenation is misleading.
what is a maintenance programmer supposed to think about that?
--
brian d foy
Perl Mongers <URI:http://www.perl.org>
CGI MetaFAQ
<URI:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 4 May 2000 11:20:44 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: CGI and Radio buttons
Message-Id: <Pine.A41.4.10.10005041117440.21122-100000@ginger.libs.uga.edu>
On Thu, 4 May 2000, brian d foy wrote:
> In article <MPG.137b24b03f322c8c98a9f4@nntp.hpl.hp.com>, Larry Rosler <lr@hpl.hp.com> wrote:
> >The bug would bite only if two or more parameters had the same name.
>
> you mean, like radio buttons?
I hesitate to point out that only one radio button in a given set of them
can be checked. At least that is the normal behavior. Obviously, I don't
hesitate enough. Oops, "perl"; there, my note is on topic now.
--
Brad
------------------------------
Date: Thu, 04 May 2000 09:35:27 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: CGI and Radio buttons
Message-Id: <3911A6CF.7E853B9@stomp.stomp.tokyo>
brian d foy wrote:
> <MPG.137b24b03f322c8c98a9f4@nntp.hpl.hp.com>,
> Larry Rosler <lr@hpl.hp.com> wrote:
> >In article <brian-0405000245440001@187.new-york-63-64rs.ny.dial-
> >access.att.net> on Thu, 04 May 2000 02:45:44 -0400, brian d foy
> ><brian@smithrenaud.com> says...
> >> In article <3910FC92.1D9A37@stomp.stomp.tokyo>,
> >> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> >> > foreach $i (0 .. $#in)
> >> > {
> >> > $in[$i] =~ s/\+/ /g;
> >> > ($key, $value) = split (/=/,$in[$i],2);
> >> > ($value eq "") && next;
> >> > $key =~ s/%(..)/pack ("c",hex($1))/ge;
> >> > $value =~ s/%(..)/pack ("c",hex($1))/ge;
> >> > $in{$key} .= $value;
>
> >> there's a bug i haven't seen in the other bad CGI parsers.
> >> just concatenate all of the values so you can't tell what
> >> the original values are.
> >The bug would bite only if two or more parameters had the same name.
This is correct. A skilled and aware programmer
knows better than to use the same parameter name
more than once in a program for different inputs,
regardless of local, my or other styles.
> and if that isn't true, then the concatenation is misleading.
> what is a maintenance programmer supposed to think about that?
Only thought here is why you consistently disseminate
false and misleading information. This read/parse
routine is the basic foundation of cgi.pm. Your
attempts to spread hatred via technology only
serve to highlight how little you know about Perl.
Godzilla!
------------------------------
Date: Thu, 4 May 2000 09:57:31 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: CGI and Radio buttons
Message-Id: <MPG.137b4bd87540fb9e98a9f6@nntp.hpl.hp.com>
In article <brian-0405001119520001@171.new-york-76-77rs.ny.dial-
access.att.net> on Thu, 04 May 2000 11:19:52 -0400, brian d foy
<brian@smithrenaud.com> says...
> In article <MPG.137b24b03f322c8c98a9f4@nntp.hpl.hp.com>, Larry Rosler <lr@hpl.hp.com> wrote:
> >In article <brian-0405000245440001@187.new-york-63-64rs.ny.dial-
> >access.att.net> on Thu, 04 May 2000 02:45:44 -0400, brian d foy
> ><brian@smithrenaud.com> says...
> >> In article <3910FC92.1D9A37@stomp.stomp.tokyo>, "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> >> > foreach $i (0 .. $#in)
> >> > {
> >> > $in[$i] =~ s/\+/ /g;
> >> > ($key, $value) = split (/=/,$in[$i],2);
> >> > ($value eq "") && next;
> >> > $key =~ s/%(..)/pack ("c",hex($1))/ge;
> >> > $value =~ s/%(..)/pack ("c",hex($1))/ge;
> >> > $in{$key} .= $value;
>
> >> there's a bug i haven't seen in the other bad CGI parsers.
> >> just concatenate all of the values so you can't tell what
> >> the original values are.
>
> >The bug would bite only if two or more parameters had the same name.
>
> and if that isn't true, then the concatenation is misleading.
> what is a maintenance programmer supposed to think about that?
A maintenance programmer is supposed to think that it's a crock, and
replace it with CGI.pm. But Godzilla!'s code is to be contemplated and
admired, not maintained.
Anyhow, my point was that in the context of the trivial code posted by
Godzilla! in this thread, the bug is meaningless.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 04 May 2000 10:21:13 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: CGI and Radio buttons
Message-Id: <3911B189.B9EBF171@vpservices.com>
"Godzilla!" wrote:
> A skilled and aware programmer
> knows better than to use the same parameter name
> more than once in a program for different inputs,
> regardless of local, my or other styles.
Absolute and utter nonsense. Checkboxes and select multiple lists
always send the same parameter name multiple times. That is how they
are supposed to work.
--
Jeff
------------------------------
Date: Thu, 04 May 2000 10:37:37 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: CGI and Radio buttons
Message-Id: <3911B561.BBEF94E8@stomp.stomp.tokyo>
Larry Rosler wrote:
> Anyhow, my point was that in the context of the trivial
> code posted by Godzilla! in this thread, the bug is
> meaningless.
Trivial code teaching a major lesson. Learning
is rarely trivial.
I would add to your comments, Mr. Rosler, there does
seem to be a misconception about radio buttons and
similar devices. Radio buttons serve as a classic
example. These buttons are a single parameter with
various possible input values, as are almost all
variables for common average usage. This name
"variable" is quite appropriate and does indicate
usage and intent quite well.
After reading various articles in this thread, it
is clear some believe radio buttons and similar
functioning devices, can have more than one parameter
name. This is quite false and a display of ignorance
of how radio buttons and similar, actually operate.
A quick independently verifiable test would be to
change the NAME of my two radio buttons to be
different in my simple example code, then observe
how many different failures those buttons will exhibit,
both mechanically and for input.
Clearly there are many who simply don't understand
how gizmos such as Radio Buttons actually function.
Godzilla!
------------------------------
Date: Thu, 04 May 2000 12:36:59 -0500
From: "Andrew N. McGuire" <andrew.mcguire@walgreens.com>
Subject: Re: CGI and Radio buttons
Message-Id: <3911B53B.6CD361D5@walgreens.com>
[ Cc sent to merlyn@stonehenge.com ]
"Randal L. Schwartz" wrote:
[ snip ]
> And for the record, her email address is <callgirl@la.znet.com>. I
> wish she'd stop hiding behind monikers now that she's been out'ed.
Also, for the record, there is an abuse address at that same domain.
I am seriously considering contacting them, to get her account closed.
The only drawback is that I am not sure that would do any good, and
in fact would probably only provoke her more. However if a number
of people complained, maybe some good would come of it.
*ponders*
nslookup yields:
la.znet.com preference = 20, mail exchanger = mx.znet.com
la.znet.com preference = 10, mail exchanger = la.znet.com
znet.com nameserver = sd02.znet.com
znet.com nameserver = sj.znet.com
mx.znet.com internet address = 207.167.64.1
mx.znet.com internet address = 207.167.64.2
la.znet.com internet address = 207.167.96.1
sd02.znet.com internet address = 207.167.67.1
sj.znet.com internet address = 207.167.80.19
la.znet.com port 25 yields:
mail from: andrew.mcguire@walgreens.com
250 2.1.0 andrew.mcguire@walgreens.com... Sender ok
rcpt to: abuse@la.znet.com
250 2.1.5 abuse@la.znet.com... Recipient ok
Cheers,
anm
--
Andrew N. McGuire
andrew.mcguire@walgreens.com
perl -ne '/=item \* (.*?\?)/ && push @x,$1}{print "$x[rand @x]\n"' *.pod
------------------------------
Date: Thu, 04 May 2000 10:41:46 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: CGI and Radio buttons
Message-Id: <3911B65A.E3BC995E@stomp.stomp.tokyo>
"Randal L. Schwartz" wrote:
>
> >>>>> "Godzilla!" == Godzilla! <godzilla@stomp.stomp.tokyo> writes:
>
> Godzilla!> This is correct. A skilled and aware programmer
> Godzilla!> knows better than to use the same parameter name
> Godzilla!> more than once in a program for different inputs,
> Godzilla!> regardless of local, my or other styles.
> A skilled and aware programmer knows that "select multiple" input form
This is not a Radio Button.
You are comparing Apples and Alligators. This
is dangerous. Your ego could suffer a serious bite.
> Godzilla!> Only thought here is why you consistently disseminate
> Godzilla!> false and misleading information. This read/parse
> Godzilla!> routine is the basic foundation of cgi.pm.
> Wrong.
Open up cgi.pm and have a look. You could
not be more wrong on this.
The rest of your comments are off topic
rants of hatred and unworthy of response.
Godzilla!
------------------------------
Date: Thu, 04 May 2000 17:48:47 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: CGI and Radio buttons
Message-Id: <3KiQ4.204$Uu5.16760@news.uswest.net>
In article <3911B65A.E3BC995E@stomp.stomp.tokyo>,
"Godzilla!" <godzilla@stomp.stomp.tokyo> writes:
> "Randal L. Schwartz" wrote:
>>
>> >>>>> "Godzilla!" == Godzilla! <godzilla@stomp.stomp.tokyo> writes:
>>
>> Godzilla!> This is correct. A skilled and aware programmer
>> Godzilla!> knows better than to use the same parameter name
>> Godzilla!> more than once in a program for different inputs,
>> Godzilla!> regardless of local, my or other styles.
>
>> A skilled and aware programmer knows that "select multiple" input form
>
>
> This is not a Radio Button.
It wouldn't matter even if it was. The agents behavior creates a
request, and the parameters are handled correctly. Your CGI script
has no notion of whether a parameter was generated by a radio button,
select widget, rolled by hand, or derived from the ether by fiat of
the gods.
------------------------------
Date: Thu, 04 May 2000 17:50:48 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: CGI and Radio buttons
Message-Id: <YLiQ4.205$Uu5.16760@news.uswest.net>
In article <3911B561.BBEF94E8@stomp.stomp.tokyo>,
"Godzilla!" <godzilla@stomp.stomp.tokyo> writes:
> Larry Rosler wrote:
>
>> Anyhow, my point was that in the context of the trivial
>> code posted by Godzilla! in this thread, the bug is
>> meaningless.
>
>
> Trivial code teaching a major lesson.
Indeed. The lesson to be learned is how not to do something.
At that, you excell.
> Learning is rarely trivial.
Well, with you, it's rare, anyway.
------------------------------
Date: Thu, 04 May 2000 17:34:59 GMT
From: "Jonathan Lee" <jlee@totalise.co.uk>
Subject: file upload
Message-Id: <3911c3b6.0@news2.cluster1.telinco.net>
Help!!
I'm trying to write a file upload script that will take a file, rename it
and then place it in a directory. I'm using cgi-lib.pl and I'm taking a
user inputted variable that takes in an id number and this is the id number
that I want to use for the filename.
If I enter a constant value for filepre then it will accept it but when I
try to pass a variable to file pre it's having none of it.
Can anybody help me with this or give me any help with file uploads in
general that won't require cgi-lib. I'm a bit stuck in a project that I
don't know much about so any good samaritans out there, your help would be
much appreciated!!
Johnny
------------------------------
Date: Thu, 04 May 2000 12:24:02 -0500
From: "Andrew N. McGuire" <andrew.mcguire@walgreens.com>
Subject: Re: finding and replacing a string
Message-Id: <3911B232.97F3D20@walgreens.com>
Steve wrote:
>
> On Thu, 4 May 2000 09:41:56 +0100, Richard Quick wrote:
> >Hi,
> >We have been given permission to harvest content off a horoscope site, but
> >we need to change some of the imagery.
> >I have the following Perl script , which harvests the content from the site.
> >All the pictures are referenced absolutely
> >(http://www.awebsite.com/neo/images/pic.gif), and so I want to be find all
> >the instances of
> >awebsite.com/neo/images/
> >and replace them with
> >ourwebsite.com/images/
>
> You don't need a script to do this, you could do it quicker in vi.
>
> vi the_perl_script.file
> then when open
> :%s/oldweb\/site/new\/website/g
>
> then save it with w and quit with I think it's q .
You don't need vi to do this, you can do it quicker with a script. ;^)
perl -wpi.bak -e 's+awebsite.com/neo+ourwebsite.com+' filename
is a Perl way to do it. Of course I shortened the patterns to
the lowest common denominator, that may not be what you want.
Cheers,
anm
--
Andrew N. McGuire
andrew.mcguire@walgreens.com
perl -ne '/=item \* (.*?\?)/ && push @x,$1}{print "$x[rand @x]\n"' *.pod
------------------------------
Date: Thu, 04 May 2000 11:22:30 -0500
From: Edward Wigg <ew@epl.org>
Subject: Re: Help counting things with Perl
Message-Id: <3911A3C5.E2898ADC@epl.org>
Larry Rosler wrote:
> ....
> This is the kind of program one deals with every day (every day that
> isn't wasted doing CGI stuff or responding to c.l.p.m. :-). Remember
> that the 'RL' in Perl is often construed as Rubbish Lister (oops, make
> that Report Language).
I was not unmindful of this which is why I was trying to use Perl for
the job. Notwithstanding the "with a hammer everything looks like a
nail" syndrome, this seemed really to be a nail; I just wasn't sure
which end to hit it with :-)
>
> Read the file and split each line into an array of hash(referenc)es or
> (slightly more efficiently but less readably), an array of
> array(referenc)es. Then loop and gather statistics over the fields you
> are interested in. If the whole thing doesn't fit into memory, buy more
> memory.
>
I think I understand, and I see how I might make it work. I will sit and
meditate over the suggested perldocs and hope that enlightenment comes.
Do you have any neat ideas for handling the tests when selecting across
multiple fields for gathering the stats out of the array?
> Start small (small data set, simple accumulations), then build up. You
> will either need to become a better programmer or to hire one.
I only hope I can become a better programmer because hiring one is sadly
not an option.
> Have the appropriate amount of fun! (The Larry)
Knowing just how much fun is appropriate in any given situation is true
wisdom.
Thanks a lot Larry for the suggestions, and pointers.
Edward (just another hapless neophyte)
------------------------------
Date: Thu, 04 May 2000 18:50:54 +0200
From: Alexander Knack <ak@dasburo.de>
To: Saddek Rehal <saddek@arch.chalmers.se>
Subject: Re: How can I declare variables in the command line at Dos prompt?
Message-Id: <3911AA6E.9A8C0931@dasburo.de>
Saddek Rehal wrote:
>
> Hi!
>
> Let say that I have the following script called: test.pl
>
> #!\apache\Perl\bin\perl.exe
> print "$city";
>
> How do I assign a value to $city in the command line when I start the
> script. I tried: c:\apache\perl\bin> perl test.pl $city=Paris but
you can't assign perlvaribales in the commandline. use @ARGV.
#!\path\to\perl
use strict;
my $city = $ARGV[0];
print $city;
then:
>perl test.pl Paris
--
+--------------------------------------------------------------------+
| Alexander Knack ........Entropie erfordert keine Wartung .........|
| dasburo.de ..................................................|
+--------------------------------------------------------------------+
------------------------------
Date: 04 May 2000 17:46:15 +0100
From: nobull@mail.com
Subject: Re: How can I declare variables in the command line at Dos prompt?
Message-Id: <u9pur2felk.fsf@wcl-l.bham.ac.uk>
Saddek Rehal <saddek@arch.chalmers.se> writes:
> This is a multi-part message in MIME format.
Please don't post vcard in this newsgroup.
> Let say that I have the following script called: test.pl
>
> #!\apache\Perl\bin\perl.exe
> print "$city";
>
> How do I assign a value to $city in the command line when I start the
> script. I tried: c:\apache\perl\bin> perl test.pl $city=Paris but
> without success.
AFAIK there's no clean way since scripts really should parse their
command line using something like one of the Getopt:: modules or use
values in %ENV.
Quick and dirty solution:
perl -M'vars qw($city); $city=q(Paris)' test.pl
Note: this exploits an artifact of the -M implementation, it may not
work in all subsequent version of Perl.
Note: I notice you are using Windoze. I've written this following
Unix-shell quoting conventions. You will need to make some
adjustments. Indeed it may not even be possible.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 4 May 2000 10:54:02 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How can I declare variables in the command line at Dos prompt?
Message-Id: <MPG.137b59112dd12fe98a9fd@nntp.hpl.hp.com>
In article <39118F2D.E2F58FB9@arch.chalmers.se> on Thu, 04 May 2000
16:54:37 +0200, Saddek Rehal <saddek@arch.chalmers.se> says...
> Let say that I have the following script called: test.pl
>
> #!\apache\Perl\bin\perl.exe
> print "$city";
>
> How do I assign a value to $city in the command line when I start the
> script. I tried: c:\apache\perl\bin> perl test.pl $city=Paris but
> without success.
Read about @ARGV in perlvar.
> Thank you if you want to help me.
>
> --
Put a space after the two dashes, so newsreaders clip out the rest of
the post.
> Saddek Rehal
> Chalmers tekniska högskola,
> Arkitektur, Byggnadskonst
> 412 96 Göteborg
> Tel: 031-772 24 75
And PLEASE set your newsreader not to send this crap with your posts in
the future:
> begin:vcard
...
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 4 May 2000 17:46:09 GMT
From: Sid Malhotra <sid@eurekanet.com>
Subject: Re: How can I declare variables in the command line at Dos prompt?
Message-Id: <3911B761.1BD12BA2@eurekanet.com>
Saddek Rehal wrote:
> Hi!
>
> Let say that I have the following script called: test.pl
>
> #!\apache\Perl\bin\perl.exe
> print "$city";
>
> How do I assign a value to $city in the command line when I start the
> script. I tried: c:\apache\perl\bin> perl test.pl $city=Paris but
> without success.
>
> Thank you if you want to help me.
>
> --
> Saddek Rehal
> Chalmers tekniska högskola,
> Arkitektur, Byggnadskonst
> 412 96 Göteborg
> Tel: 031-772 24 75
Anything you pass as a command line argument is passed into the program
into an array called @ARGV.
so you would use something like:
#!\apache\Perl\bin\perl.exe
$city = @ARGV;
print $city;
exit;
C:>perl test.pl paris
Paris
This should work.
Sid.
------------------------------
Date: Thu, 4 May 2000 10:15:12 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How can I install perl modules under Windows ?
Message-Id: <MPG.137b4fff4ceb966f98a9f8@nntp.hpl.hp.com>
In article <slrn8h2u9u.vi1.sjlen@zero-pps.localdomain> on 4 May 2000
15:06:26 GMT, Steve <sjlen@ndirect.co.uk> says...
> On Thu, 04 May 2000 12:02:20 +0200, Francois Dupradeau wrote:
> >I made a perl script under Linux and now I'd like to run it under
> >Windows NT. The problem is I must install some modules (HotKey.pm and
> >ANSIColor.pm). I can't install these modules because I can't do a make
> >and make install.
> >Can I can install these modules ? How ?
> >Can you give me an URL where I can download executables modules under
> >Windows ?
>
> You havn't looked very far, on the CPAN front page (I think it's the
> first link), there's a link to a page called something like how to
> install a module. That page gives details specific to each platform
> and is easy to follow.
>
> http://www.perl.com/CPAN/
From that place, I ended up at <URL:http://18.85.40.23/INSTALL.html>,
which gives detailed instructions for how to decompress zips, etc from
ActiveState. But is totally bogus, because PPM isn't mentioned.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 4 May 2000 10:32:23 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How can I run auto-download file in browser ?
Message-Id: <MPG.137b54004333db1d98a9fa@nntp.hpl.hp.com>
In article <391151DD.98259CD2@supermedia.pl> on Thu, 04 May 2000
12:33:01 +0200, Jonathan Kazmierczak <johny@supermedia.pl> says...
> Hi!
> I've problem: In my application I must make function, that downloads
> data from database and presents them in the text files. There are
> virtual text files; I generate them and send to browser. So I want to
> open browser window "Download", not new instance of browser with content
> of the file.
> Under Netscape this works correctly, but IE4.0 opens new browser window.
Then your question has nothing to do with Perl, does it? You will get
better answers in an appropriate CGI or browser newsgroup.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 04 May 2000 17:06:38 GMT
From: burnt@ix.netcom.com (Crisper)
Subject: how do I open it
Message-Id: <3911ad88.8368260@nntp.ix.netcom.com>
I have a flat file database (tab delimited) that looks like this:
Date Name Address1
15:27 PM Apr 12 First Name etc.
00:24 AM May 13 Second Name etc.
16:27 PM Jun 02 Third Name etc.
How do I open this file (using OPEN (FH, filename)) and retrive only
the rows with certain characteristics (for example, matching something
like =~/Apr/ ? )
TIA for any assistance. KMA for any flames.
C.
------------------------------
Date: Thu, 04 May 2000 12:59:23 -0500
From: "Andrew N. McGuire" <andrew.mcguire@walgreens.com>
Subject: Re: how do I open it
Message-Id: <3911BA7B.314BFD9D@walgreens.com>
Crisper wrote:
>
> I have a flat file database (tab delimited) that looks like this:
>
> Date Name Address1
> 15:27 PM Apr 12 First Name etc.
> 00:24 AM May 13 Second Name etc.
> 16:27 PM Jun 02 Third Name etc.
>
> How do I open this file (using OPEN (FH, filename)) and retrive only
> the rows with certain characteristics (for example, matching something
> like =~/Apr/ ? )
>
> TIA for any assistance. KMA for any flames.
What follows is a minimal script to do what you want:
#!/usr/bin/perl -w
use strict;
open FILE, 'test.txt' or die "Can't open test.txt: $!";
while (<FILE>) { print if /Apr/ }
close FILE;
Be aware however that if you have a person named April,
this will print those lines as well. To be more precise
you could say /\bApr\b/. There are a number of other
ways to do this which are more precise. One would be
to split the line on white space, and test element [2].
... if it has a consistent format.
perldoc -f split
Another would be to formulate a more exact regular expression.
perldoc perlre
--
Andrew N. McGuire
andrew.mcguire@walgreens.com
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 2949
**************************************