[16529] in Perl-Users-Digest
Perl-Users Digest, Issue: 3941 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 7 18:15:44 2000
Date: Mon, 7 Aug 2000 15:15:30 -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: <965686529-v9-i3941@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 7 Aug 2000 Volume: 9 Number: 3941
Today's topics:
Problem with NT & Excel robert_linne_nelson@my-deja.com
Re: Problem with NT & Excel <jeff@vpservices.com>
Re: Problem with NT & Excel robert_linne_nelson@my-deja.com
programmer needed for small script <mark.cardwellNOmaSPAM@arris-i.com.invalid>
Re: programmer needed for small script <juex@deja.com>
Re: programmer needed for small script <mark.cardwellNOmaSPAM@arris-i.com.invalid>
Re: Programming Ethics <jeff@vpservices.com>
Re: Proxy w/ username/pass validation - Realm fperkins@my-deja.com
Re: Proxy w/ username/pass validation - Realm <tony_curtis32@yahoo.com>
Re: reg expressions - protect html <lr@hpl.hp.com>
Re: reg expressions - protect html <godzilla@stomp.stomp.tokyo>
Regular Expressions & Substitution <fordt@uci.edu>
Re: Regular Expressions & Substitution (Greg Bacon)
Re: Regular Expressions & Substitution <fordt@uci.edu>
Re: Regular Expressions & Substitution <mjcarman@home.com>
Re: reinterprete a variable in a variable <ren.maddox@tivoli.com>
Re: reinterprete a variable in a variable <mauldin@netstorm.net>
Sendmail delivery failures <robertNOroSPAM@kronos.custard.org.invalid>
Re: Sendmail delivery failures (Logan Shaw)
Re: totally newbie to perl, I ... (Colin Keith)
Re: totally newbie to perl, I ... <kensplace@comports.com>
Re: totally newbie to perl, I ... <mizerychik@mail.com>
Re: Uhmm... Errr... <kensplace@comports.com>
Re: Uhmm... Errr... <mauldin@netstorm.net>
Re: uploading file (Colin Keith)
Variable interpolation as sub-routine call? <amonotod@netscape.net>
Re: Variable interpolation as sub-routine call? (NP)
Re: Variable interpolation as sub-routine call? (Greg Bacon)
Re: Variable interpolation as sub-routine call? <amonotod@netscape.net>
Re: Variable interpolation as sub-routine call? <mauldin@netstorm.net>
Re: When does it pay to presize an array? (Richard J. Rauenzahn)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 07 Aug 2000 19:14:42 GMT
From: robert_linne_nelson@my-deja.com
Subject: Problem with NT & Excel
Message-Id: <8mn1qu$git$1@nnrp1.deja.com>
Hello everone,
I've built a perl script, which uses the OLE
module to search and extract rows from an excel
file. This script also uses CGI to print out a
table using HTML. The script works on my machine
running win98 and Xitami web server. When
I moved my scipt over to NT 4.0 using IIS (sorry,
i don't know what version it is) and tried running
the script from a brower, the script stops
printing out anything (HTML and also just regular
print commands) in the script after the following
line of code:
$workbook = $xl_app->Workbooks->Open
($EXCEL_FILE) || die $!;
The NT server is secured using HTTPS (if that's
makes a differnce).
Also, when I run the script at the command prompt
on the NT Server, the script will works fine.
Thanks for your time,
Robert Nelson
rlnelson@cory.eecs.berkeley.edu
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 07 Aug 2000 13:10:30 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Problem with NT & Excel
Message-Id: <398F17B6.B3B29D5B@vpservices.com>
robert_linne_nelson@my-deja.com wrote:
> the script after the following
> line of code:
> $workbook = $xl_app->Workbooks->Open
> ($EXCEL_FILE) || die $!;
Use CGI::Carp qw/fatalsToBrowser/; so that the $! appears in your
browser and you can see what is actually happening.
--
Jeff
------------------------------
Date: Mon, 07 Aug 2000 21:24:34 GMT
From: robert_linne_nelson@my-deja.com
Subject: Re: Problem with NT & Excel
Message-Id: <8mn9eb$mtu$1@nnrp1.deja.com>
> > the script after the following
> > line of code:
> > $workbook = $xl_app->Workbooks->Open
> > ($EXCEL_FILE) || die $!;
>
> Use CGI::Carp qw/fatalsToBrowser/; so that the $! appears in your
> browser and you can see what is actually happening.
The error message displayed is:
Software Error:
Can't call method "Workbooks" on unblessed reference at
D:\InetPub\intranet\intranet_2000\phonebook\search_dir.pl line 92.
I'm not sure what this means but I'm instaniating $xl_app using this
line of code:
$xl_app = CreateObject OLE 'Excel.Application' || die $!;
Is there anything wrong here? Also, it works fine when running on the
command prompt of the server.
thanks
-Robert Nelson
rlnelson@cory.eecs.berkeley.edu
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 07 Aug 2000 11:22:27 -0700
From: markc <mark.cardwellNOmaSPAM@arris-i.com.invalid>
Subject: programmer needed for small script
Message-Id: <251842c8.de06898b@usw-ex0103-086.remarq.com>
I am looking for someone who can write a very simple
database search script for me. I will pay whatever
you think is reasonable for this service.
I have a text database that contains entries seperated
by two carriage returns. For example:
88092380982308933
32842823882809832
23984823089493028
42309890932804909
32942390483884903
37872474983724891
32904908454656785
83209189382910382
21839902189308290
21389081298908902
32234908392849033
Above are three example entries. I would like the
search engine to display any entry that contains
the string searched on. If I were to search for
322349 (from the bottom of the last entry) the script
would display any database entries that contain that
exact string, in this case the last entry:
83209189382910382
21839902189308290
21389081298908902
32234908392849033
This script will be used on an intranet web page, and
must print the results to a web browser.
The database is not too large, and usually stays around
80K. The script will be installed on a UNIX server (I
intend to install the script myself).
If interested, please contact me at mark.cardwell@arris-i.com.
Thanks,
Mark Cardwell
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: Mon, 7 Aug 2000 11:43:01 -0700
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: programmer needed for small script
Message-Id: <398f033e@news.microsoft.com>
"markc" <mark.cardwellNOmaSPAM@arris-i.com.invalid> wrote in message
news:251842c8.de06898b@usw-ex0103-086.remarq.com...
> I am looking for someone who can write a very simple
> database search script for me. I will pay whatever
> you think is reasonable for this service.
And where did you see "jobs.offered" in the name of this NG?
jue
------------------------------
Date: Mon, 07 Aug 2000 13:01:39 -0700
From: markc <mark.cardwellNOmaSPAM@arris-i.com.invalid>
Subject: Re: programmer needed for small script
Message-Id: <03d7180d.f3ba59c9@usw-ex0103-086.remarq.com>
Thanks everyone for the responses by e-mail and helping me get
this working! :-)
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: Mon, 07 Aug 2000 13:07:01 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Programming Ethics
Message-Id: <398F16E5.933FD43C@vpservices.com>
[I'm with Jeff Yoak: yes this is OT, but interestingly so]
jthornton@my-deja.com wrote:
>
> Is the proper use of this database my
> responsibility?
Yes. If I program something designed specifically to launch nuclear
missles and sell my program to someone who uses it to launch the
missles, *I* am launching the missles. Spam is (debatedly) not as evil
as nuclear missles, so it's up to you how much you take that kind of
thinking into account when making your decision. I applaud you for even
considering it. People with few resources are often forced to work for
whomever offers them a job. Us technological elite types are not
currently in that position -- we have a wide choice of employers looking
for our skills. If we don't use that choice wisely to work for
employers whose goals we respect, who ever will use that choice wisely
and how will things ever improve in this messed up world of ours?
--
Jeff
------------------------------
Date: Mon, 07 Aug 2000 18:08:54 GMT
From: fperkins@my-deja.com
Subject: Re: Proxy w/ username/pass validation - Realm
Message-Id: <8mmtvg$dag$1@nnrp1.deja.com>
Am I the only one that has ever tried this? *sigh*
In article <398C0AAB.53E684B1@sei.cmu.edu>,
Ted Marz <tfm@sei.cmu.edu> wrote:
> A suspicion only
>
> If you look at http basic authentication (.htaccess files),
> one of the things that you specify is the "realm" of the
> authentication. That is, in some sense, the breadth of the
> authentication. The web server (I believe) will consider your
> authentication to be passed as long as you have a valid
> username/password AND the realm specified in the .htaccess file has
not
> changed.
>
> It is an arbitrary string (it is specified in the .htaccess file), but
> it is not really random.
>
> As for what the netloc is, I am not sure, except that it may be the
> network location (URL? or address?) of the proxy server that you are
> attempting to authenticate on.
>
> Just guesses... Good luck
>
> Ted
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 07 Aug 2000 13:54:42 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Proxy w/ username/pass validation - Realm
Message-Id: <878zu8zytp.fsf@limey.hpcc.uh.edu>
>> On Mon, 07 Aug 2000 18:08:54 GMT,
>> fperkins@my-deja.com said:
[ perl program to authenticate through proxy and get stuff
over web]
> Am I the only one that has ever tried this? *sigh*
Looks like it :-)
Did you look at the source code for lwp-request (which I
suggested in my original reply)? Most enlightening.
The realm is what the server replies with when it
challenges you for your credentials. You might have the
entire proxy basic-authenticated with a realm called
"Company Proxy". Take a look at
ftp://ftp.isi.edu/in-notes/rfc2617.txt
for all the gory details.
Overriding one of credentials() or get_basic_credentials()
looks to be the way to go.
I suspect most people here don't have a proxy requiring
credential authentication and the overhead of setting
up/faking is too high to address your situation at any
level other than scratching the surface. Maybe.
hth
t
--
"With $10,000, we'd be millionaires!"
Homer Simpson
------------------------------
Date: Mon, 7 Aug 2000 13:07:27 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: reg expressions - protect html
Message-Id: <MPG.13f8b6da1f4029e198ac41@nntp.hpl.hp.com>
In article <398EE6C5.5CD1B2FF@stomp.stomp.tokyo> on Mon, 07 Aug 2000
09:41:41 -0700, Godzilla! <godzilla@stomp.stomp.tokyo> says...
...
> ... I would not use warnings nor strict.
> Both slow your program down and bloat memory usage.
Please provide some evidence to support this assertion. Unlike
religion, in computing as in other branches of engineering or science
assertions of this type must be verifiable.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 07 Aug 2000 14:49:29 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: reg expressions - protect html
Message-Id: <398F2EE9.4D805073@stomp.stomp.tokyo>
Larry Rosler wrote:
> Godzilla! entices Mr. Rosler:
> > ... I would not use warnings nor strict.
> > Both slow your program down and bloat memory usage.
> Please provide some evidence to support this assertion.
> Unlike religion, in computing as in other branches of
> engineering or science assertions of this type must be
> verifiable.
Yes. I have a Bachelor's in Science. Independent
verification is one of many building blocks of
good practices in Scientific Method.
Consult with Joseph Hall and Randall Schwartz. Both
have greater expertise in Perl and clearly a better
ability to explain technical details on this. You
will also find references to this in Joseph Hall's
_Effective Perl Programming_
along with other references to problems in using
pragma hints I have not mentioned, thus far. Rest
assured, at an appropriate strategic moment, I will
let fly these other jewels of intellectual rockets.
Logical thinking might suffice in lieu of independent
verification on these notions.
Praise the Lord. Pass the bread and wine, please.
Godzilla!
--
With my Lord's Grace, I will rock you.
http://la.znet.com/~callgirl3/spirit.mid
------------------------------
Date: Mon, 7 Aug 2000 12:14:44 -0700
From: "Tom Ford" <fordt@uci.edu>
Subject: Regular Expressions & Substitution
Message-Id: <8mn1n2$7ra$1@news.service.uci.edu>
Hi, I just recently started learning Perl, and I have been loving it.
Especially the Regular Expressions. However, I have run into a problem I
can't seem to get around. Perhaps someone can help me solve it.
I am using a two dimensional array for my regular expression-subsitutions
like this (for example):
$Order[3][0] = "(~) ($Operand)";
$Order[3][1] = " t";
The array contains several different types of substitions I want to perform.
Then I am using a FOR loop to run through my array like this:
for ($i=0;$i<7;$i++)
{
if ( $_[0] =~ s/$Order[$i][0]/$Order[$i][1]/ )
{
.....
}
} # end FOR-loop
Which seems to work just fine. However, the problem arises when I try to use
those special escape characters (\1 \2 \3 etc...) in the second string, for
example:
$Order[3][1] = "\1 t";
When I do that, it was replacing "\1" with a smiley face. It took me a while
to realize it was inserting ASCII character 1 into my string, so I tried
single quotes like this:
$Order[3][1] = '\1 t';
But in the substition, it was putting the actual "\1" instead of the value
of "\1". So my question is: is there anyway I can use those "\1" things
within a string and use that string as my substitution? Or is there any
other way I can do this without hard coding every single Regular Expression
I would like to perform?
Thanks, I hope I made sense :)
Tom
------------------------------
Date: Mon, 07 Aug 2000 19:48:28 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Regular Expressions & Substitution
Message-Id: <sou4kc6p63a11@corp.supernews.com>
In article <8mn1n2$7ra$1@news.service.uci.edu>,
Tom Ford <fordt@uci.edu> wrote:
: I am using a two dimensional array for my regular expression-subsitutions
: like this (for example):
:
: $Order[3][0] = "(~) ($Operand)";
: $Order[3][1] = " t";
:
: The array contains several different types of substitions I want to perform.
: Then I am using a FOR loop to run through my array like this:
:
: for ($i=0;$i<7;$i++)
: {
: if ( $_[0] =~ s/$Order[$i][0]/$Order[$i][1]/ )
: {
: .....
: }
: } # end FOR-loop
:
: Which seems to work just fine. However, the problem arises when I try to use
: those special escape characters (\1 \2 \3 etc...) in the second string, for
: example:
:
: $Order[3][1] = "\1 t";
:
: When I do that, it was replacing "\1" with a smiley face. It took me a while
: to realize it was inserting ASCII character 1 into my string, so I tried
: single quotes like this:
:
: $Order[3][1] = '\1 t';
:
: But in the substition, it was putting the actual "\1" instead of the value
: of "\1". So my question is: is there anyway I can use those "\1" things
: within a string and use that string as my substitution?
Build up a matcher at run time. You should see big performance gains.
Consider this example:
#! /usr/bin/perl -w
use strict;
my @subst = (
[ 'foo' => 'bar' ],
[ '([awm])\1\1' => '${1}3' ],
);
sub replacer {
my $code = "sub {\n for (\@_) {\n";
for (@_) {
$code .= " s/$_->[0]/$_->[1]/gi;\n";
}
$code .= " }\n}\n";
#print $code;
my $sub = eval $code;
die $@ if $@;
$sub;
}
my $subst = replacer @subst;
while (<DATA>) {
$subst->($_);
print;
}
__DATA__
The food is under the bar in the barn.
MMM employees should visit AAA on the WWW.
Just another Perl hacker,
Greg
------------------------------
Date: Mon, 7 Aug 2000 13:32:21 -0700
From: "Tom Ford" <fordt@uci.edu>
Subject: Re: Regular Expressions & Substitution
Message-Id: <8mn685$9p3$1@news.service.uci.edu>
> Build up a matcher at run time. You should see big performance gains.
Interesting technique! I can tell I still have a lot to learn with perl :) I
didnt know it was so flexible.
This should solve my problem nicely.
Thanks so much,
Tom
------------------------------
Date: Mon, 07 Aug 2000 15:03:12 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Regular Expressions & Substitution
Message-Id: <398F1600.2293988E@home.com>
Tom Ford wrote:
>
> I am using a two dimensional array for my regular
> expression-subsitutions like this (for example):
>
> $Order[3][0] = "(~) ($Operand)";
> $Order[3][1] = " t";
Note: $Order[3][0] will contain the value of $Operand at the time it was
assigned, not at the time it is used. Is that what you want?
> The array contains several different types of substitions I want
> to perform.
> Then I am using a FOR loop to run through my array like this:
>
> for ($i=0;$i<7;$i++)
Ah, another C programmer joins our ranks.
> [T]he problem arises when I try to use those special escape
> characters (\1 \2 \3 etc...) in the second string, for example:
>
> $Order[3][1] = "\1 t";
>
Those aren't really escape chars, they're backreferences. Also (IIRC)
that format is deprecated. Use $1, $2, etc. instead.
> When I do that, it was replacing "\1" with a smiley face. It took
> me a while to realize it was inserting ASCII character 1 into my
> string, so I tried single quotes like this:
>
> $Order[3][1] = '\1 t';
>
> But in the substition, it was putting the actual "\1"
Yes, because the RHS of a regex is normally taken literally. Change your
's///' to 's///ee' -- the /ee will force (double) evaluation of the RHS
as an expression.
-mjc
------------------------------
Date: 07 Aug 2000 14:08:52 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: reinterprete a variable in a variable
Message-Id: <m3snsgdh2z.fsf@dhcp11-177.support.tivoli.com>
"Martin Tribius" <werbung@htmlfilter.de> writes:
[...]
> $data2 = 'hello $data1 !!'; #can't change this line into doublequotes
> $data1 = 'Martin'; #can't change this line into doublequotes
>
> $data3 = "".$data2; #thats a try (showed in my book) to get the
> #variable used in $data2
> reinterpreted
> print "\n\n Should say 'hello Martin !!' but it says $data2 \n\n";
>
> This gives the output:
> Should say 'hello Martin !!' but it says hello $data1 !!
>
This is fraught with peril if you don't control the data (and probably
even if you do), but if what you *really* want is to reinterpret
a string, you can use:
$data3 = eval qq("$data2");
--
Ren Maddox
mailto:ren@tivoli.com
------------------------------
Date: Mon, 07 Aug 2000 20:22:08 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: reinterprete a variable in a variable
Message-Id: <398F19EF.5E04F192@netstorm.net>
Ren Maddox wrote:
>
> "Martin Tribius" <werbung@htmlfilter.de> writes:
> [...]
> > $data2 = 'hello $data1 !!'; #can't change this line into doublequotes
> > $data1 = 'Martin'; #can't change this line into doublequotes
> >
> > $data3 = "".$data2; #thats a try (showed in my book) to get the
> > #variable used in $data2
> > reinterpreted
> > print "\n\n Should say 'hello Martin !!' but it says $data2 \n\n";
> >
> > This gives the output:
> > Should say 'hello Martin !!' but it says hello $data1 !!
> >
>
> This is fraught with peril if you don't control the data (and probably
> even if you do), but if what you *really* want is to reinterpret
> a string, you can use:
>
> $data3 = eval qq("$data2");
Yes, a much better method that I learned about from another post a few
days ago. Should have posted a correction, but glad you did.
-- Jim
------------------------------
Date: Mon, 07 Aug 2000 14:26:35 -0700
From: Robert <robertNOroSPAM@kronos.custard.org.invalid>
Subject: Sendmail delivery failures
Message-Id: <27c9772c.27ea8901@usw-ex0101-008.remarq.com>
Hello,
I am using a Perl "Mailing List" script for sending emails to a
list of addresses. The script uses sendmail to send out to all
the addresses, but is there a way of logging which emails in the
list are invalid? In other words, can Perl, or sendmail, capture
mail delivery failure notifications in any way?
If a mailing list becomes particularly large, I want to find out
which addresses in the list are invalid without mailing each
person individually.
Thanks for any help you can offer,
Rob.
-----------------------------------------------------------
Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com
------------------------------
Date: 7 Aug 2000 16:51:52 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Sendmail delivery failures
Message-Id: <8mnb1o$74b$1@provolone.cs.utexas.edu>
In article <27c9772c.27ea8901@usw-ex0101-008.remarq.com>,
Robert <robertNOroSPAM@kronos.custard.org.invalid> wrote:
>I am using a Perl "Mailing List" script for sending emails to a
>list of addresses. The script uses sendmail to send out to all
>the addresses, but is there a way of logging which emails in the
>list are invalid? In other words, can Perl, or sendmail, capture
>mail delivery failure notifications in any way?
>
>If a mailing list becomes particularly large, I want to find out
>which addresses in the list are invalid without mailing each
>person individually.
The only real notification you'll get is bounced messages coming back
to the sender and/or the postmaster (depending on how your sendmail is
set up).
I believe these will be sent back to the sender as specified in the
SMTP session (i.e. "mail from:", -not- the one in the header).
I think your best hope if you want to do this programmatically is to
send out each message separately and with a unique (maybe randomly
generated) sender, keep a database of these senders, and then have a
handler for the bounced messages that figures out which addresses are
not working.
- Logan
------------------------------
Date: Mon, 07 Aug 2000 19:53:45 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: totally newbie to perl, I ...
Message-Id: <dtEj5.97$DT4.2861406@nnrp2.clara.net>
In article <8mlra9$4rs$1@buty.wanadoo.nl>, "seb" <seb@nospam.be> wrote:
>Hi there ;
>
>totally newbie to perl, I would like 2 know what do I need to run my first
>perl script
>(you know, something like ' Hello World ! ' ;-)) )
>under W 9x (is it possible ? ) or W 2k.
If you have perl for win32 installed .... open a dos window (start->run,
type 'command') and at the DOS prompt type 'perl', If it prints something
back other than 'Bad command or File name' then its on your path. Change to
the directory where your script is:
c:> cd c:\perl\myscripts
Then try:
c:\perl\myscripts > perl myscript.pl
Any errors that are generated will appear on the console window and stay
there (if you have .pl extensions associated with perl and you just double
click on it, the window will close straight away unless you fiddle)
>If there is no possibility for theses platforms, I also have a box running
>FreeBSD (but I'm also a newbie there, that's why I would prefer Windows
>info).
Oooh, go to FreeBSD. Get Xfree86 installed, grab a nice window manager and
join the UNIX world. If you want a win32 interface try installing fvwm95 or
KDE. Personally I find coding under UNIX far easier than Win32 you can
adapt to both. Perl is also better supported on UNIX by virtue of
things like fork() and signals which windows dubiously implements.
To run perl programs there, you'll need to check you have execute
permission to your script "chmod u+x myscript" and then just execute using
"./myscript" (at least, that's the start of it :)
Col.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Mon, 7 Aug 2000 21:34:18 +0100
From: "ken" <kensplace@comports.com>
Subject: Re: totally newbie to perl, I ...
Message-Id: <8mn6er$vm0$1@news5.svr.pol.co.uk>
Grow up,
What exactly did i do to you two to piss you off?
OR have you not grown up yet?
ken wrote in message <8mm6p1$ufn$1@newsg1.svr.pol.co.uk>...
>seb wrote in message <8mlra9$4rs$1@buty.wanadoo.nl>...
>
>>totally newbie to perl, I would like 2 know what do I need to run my first
>>perl script
>>(you know, something like ' Hello World ! ' ;-)) )
>>under W 9x (is it possible ? ) or W 2k.
>
>
>
>If running locally, on w9x then you need a web server of some kind, i use
>a freeware one called omni, as its small and simple,
>you can download it from http://www.omnicron.ab.ca/httpd/download.html
>
>You also need perl itself, I use Activeperl, available from
>http://www.activestate.com/
>
>Simply install both of the above, set up the options in omni to point to
>your perl installation
>and tell it where your cgi-bin directory is.
>
>save the following script as a .pl
>
>A simple hello world script is shown below
>
>#!/usr/local/bin/perl
># Hello world example program
>
>print ("Content-type: text/html\n\n");
>print "Hello World !";
>
>
>Note the first line contains the location of the perl interpreter, it must
>start with #!
>
>
>And then fire up omni and your browser,
>and use the url
>
>127.0.0.1 your "home"
>so if your cgi-dir was a subdirectory of your default dir then it would be
>
>127.0.0.1/cgi-bin/helloworld.pl
>
>
>or whatever!
>
>
>good luck, hope that helps a bit
>
>
------------------------------
Date: Mon, 07 Aug 2000 17:12:49 -0400
From: Sara Martin <mizerychik@mail.com>
Subject: Re: totally newbie to perl, I ...
Message-Id: <398F2651.3DE62D1E@mail.com>
seb wrote:
>
> totally newbie to perl, I would like 2 know what do I need to run my first
> perl script
> (you know, something like ' Hello World ! ' ;-)) )
> under W 9x (is it possible ? ) or W 2k.
>
I recently started using perl myself and I found that
http://www.hardcorelinux.com/perl-tutorial-intro.htm has been a
tremendous help. I don't know if it will be of any use to you but you
can give it a try.
Sara
------------------------------
Date: Mon, 7 Aug 2000 22:13:01 +0100
From: "ken" <kensplace@comports.com>
Subject: Re: Uhmm... Errr...
Message-Id: <8mn8nf$ra7$1@news6.svr.pol.co.uk>
please include me too!!!!!
kensplace@--removeobstructioniespam--.comports.com
bean wrote in message ...
>> I'll forward him a copy of this posting in case he still needs material.
>
>Thank you.
>
>> If he's willing, the price would only be having your work publicly (but
>> anonymously) picked apart.
>
>No problem. None at all.
>
>Thanks again.
>
>bean
------------------------------
Date: Mon, 07 Aug 2000 21:26:23 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: Uhmm... Errr...
Message-Id: <398F28FD.C5B1C370@netstorm.net>
bean wrote:
>
> I have a rather (I think) unusual request. I'm looking for a Perl
> mentor. Someone who can take a look at what I've created
<snip>
> and say "Well, that was
> pretty dumb... you might want to try this..." or "Well, that was really
> dumb... why don't you read XXX and perhaps you'll get a better handle on
> it." Is this possible, or am I in Oz again.
>
> If anyone is interested in doing this (for free...
>
This NG is a first-rate tutor - many tutors, in fact - with *lots* of
people willing to tell you "that was pretty dumb" ... and it's free.
No kidding, clpm is your best bet as long as you're willing to:
1) Lurk for a while, trying and testing on your own
2) Read the documentation (freely available and get a book or two),
including the faqs
3) Test your code before you post
4) Go as far as you can until you're stuck and then post the smallest
relevant amount of code possible, i.e. focus on the problem, not the
junk surrounding it.
IHMO
-- Jim
------------------------------
Date: Mon, 07 Aug 2000 19:56:06 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: uploading file
Message-Id: <qvEj5.98$DT4.2861698@nnrp2.clara.net>
In article <8mmnve$6u0$1@reader.nmix.net>, "Robin Bank" <rbank@csf.edu> wrote:
>I need to upload two pictures with a cgi script via a form.
>
>Can someone point me in the right direction as to good modules/methods to
>use for this.
CGI.pm It comes as part of the standard installation of Perl (at least
beyond 5.005?) if not <http://www.cpan.org/modules/>
"perldoc CGI" and read through. An uploaded file is accessed the same as
other parameters using param(), to get a file handle/name to the temporary
file that it's stored in.
---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC
------------------------------
Date: Mon, 07 Aug 2000 19:44:07 GMT
From: amonotod <amonotod@netscape.net>
Subject: Variable interpolation as sub-routine call?
Message-Id: <8mn3i6$i1s$1@nnrp1.deja.com>
%listoptions = (
"IP", "ipcnts",
"browsers", "clcnts",
"hitperhr", "hourly",
"files", "filcnts",
"domains", "domains",
"monstat", "cdbymon",
"xfer", "transferred"
);
foreach $lstopt (keys %listoptions) {
if ($FORM{$lstopt}) {
&nxtrow;
#&$listoptions{$lstopt}; #This doesnt work...
#\&$listoptions{$lstopt}; #This doesnt work...
#&\$listoptions{$lstopt}; #This doesnt work...
#&($listoptions{$lstopt}); #This doesnt work...
#$listoptions{$lstopt}; #This doesnt work...
#do $listoptions{$lstopt}; #This doesnt work...
#Even though ProgPerl2Ed says not to use it, I even tried...
#goto $listoptions{$lstopt}; #This doesnt work...
print "Gimme a clue, Gimme a clue, clue me into that Perl Hack
Code\!\n";
}
}
Never tried this before... Any ideas?
Thank you,
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 07 Aug 2000 20:01:36 GMT
From: nvp@spamnothanks.speakeasy.org (NP)
Subject: Re: Variable interpolation as sub-routine call?
Message-Id: <AAEj5.448230$MB.6741094@news6.giganews.com>
On Mon, 07 Aug 2000 19:44:07 GMT, amonotod <amonotod@netscape.net> wrote:
: %listoptions = (
: "IP", "ipcnts",
: "browsers", "clcnts",
Untested, and I'm not sure if it's quite what you're looking for,
but...
%test = ("foo" => "wow");
%baz = ("foo" => "bar");
foreach my $key (keys %baz) {
if(exists($test{$key})) {
&{$baz{$key}}();
}
}
sub bar {
print("how dry i am\n");
}
--
Nate II
------------------------------
Date: Mon, 07 Aug 2000 20:05:38 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Variable interpolation as sub-routine call?
Message-Id: <sou5ki6463a103@corp.supernews.com>
In article <8mn3i6$i1s$1@nnrp1.deja.com>,
amonotod <amonotod@netscape.net> wrote:
: %listoptions = (
: "IP", "ipcnts",
: "browsers", "clcnts",
: "hitperhr", "hourly",
: "files", "filcnts",
: "domains", "domains",
: "monstat", "cdbymon",
: "xfer", "transferred"
: );
:
: foreach $lstopt (keys %listoptions) {
: if ($FORM{$lstopt}) {
: &nxtrow;
: #&$listoptions{$lstopt}; #This doesnt work...
: #\&$listoptions{$lstopt}; #This doesnt work...
: #&\$listoptions{$lstopt}; #This doesnt work...
: #&($listoptions{$lstopt}); #This doesnt work...
: #$listoptions{$lstopt}; #This doesnt work...
: #do $listoptions{$lstopt}; #This doesnt work...
: #Even though ProgPerl2Ed says not to use it, I even tried...
: #goto $listoptions{$lstopt}; #This doesnt work...
: print "Gimme a clue, Gimme a clue, clue me into that Perl Hack
: Code\!\n";
: }
: }
:
: Never tried this before... Any ideas?
Make a dispatch table:
my %listopt = (
IP => \&ipcnts,
browsers => \&clcnts,
...
);
foreach my $opt (keys %listopt) {
if ($FORM{$opt}) {
&nxtrow; # whatever this does
# call appropriate subroutine with no arguments
$listopt{$opt}->();
}
}
Read the perlref and perlreftut manpages for more information about
subroutine references.
Hope this helps,
Greg
------------------------------
Date: Mon, 07 Aug 2000 20:43:33 GMT
From: amonotod <amonotod@netscape.net>
Subject: Re: Variable interpolation as sub-routine call?
Message-Id: <8mn71j$kv2$1@nnrp1.deja.com>
In article <sou5ki6463a103@corp.supernews.com>,
Greg Bacon <gbacon@hiwaay.net> wrote:
> In article <8mn3i6$i1s$1@nnrp1.deja.com>,
> amonotod <amonotod@netscape.net> wrote:
> : foreach $lstopt (keys %listoptions) {
> : if ($FORM{$lstopt}) {
> : &nxtrow;
> : #&$listoptions{$lstopt}; #This doesnt work...
> : print "Gimme a clue, Gimme a clue, clue me into that Perl Hack
> : Code\!\n";
> : }
> : }
> :
> : Never tried this before... Any ideas?
>
> Make a dispatch table:
>
> my %listopt = (
> IP => \&ipcnts,
> browsers => \&clcnts,
> ...
> );
>
> foreach my $opt (keys %listopt) {
> if ($FORM{$opt}) {
> &nxtrow; # whatever this does
>
> # call appropriate subroutine with no arguments
> $listopt{$opt}->();
> }
> }
>
> Read the perlref and perlreftut manpages for more information about
> subroutine references.
>
> Hope this helps,
> Greg
>
Greg, thanks for the help, it's kicking ass and taking names, now. I
did use the older array format, as I am not real comfortable with the ->
values, so mine looks like this:
%listoptions = (
"IP", \&ipcnts,
"browsers", \&clcnts,
"domains", \&domains,
"files", \&filcnts,
"monstat", \&cdbymon,
"hitperhr", \&hourly,
"xfer", \&transferred
);
Again, thank you,
amonotod
--
`\|||/ amonotod@
(@@) netscape.net
ooO_(_)_Ooo________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 07 Aug 2000 20:02:05 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: Variable interpolation as sub-routine call?
Message-Id: <398F153B.AF07FD80@netstorm.net>
amonotod wrote:
>
> %listoptions = (
> "IP", "ipcnts",
> "browsers", "clcnts",
> "hitperhr", "hourly",
> "files", "filcnts",
> "domains", "domains",
> "monstat", "cdbymon",
> "xfer", "transferred"
> );
>
> foreach $lstopt (keys %listoptions) {
> if ($FORM{$lstopt}) {
> &nxtrow;
followed by various "doesn't work"s
I think you're looking for
perldoc -f eval
i.e. in your example,
eval $listoptions{$lstopt};
-- Jim
------------------------------
Date: 7 Aug 2000 19:59:16 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: When does it pay to presize an array?
Message-Id: <965678355.896453@hpvablab.cup.hp.com>
aperrin@demog.berkeley.edu (Andrew J. Perrin) writes:
>I'm working on a project in which some fairly large arrays (around 100,000
>to 200,000 elements) will be loaded from a file. I will know ahead of
>time how many elements will be read in, so it is feasible to pre-size
>the arrays using $#array = nnn where nnn is the size of the array.
>perldoc perldata suggests that this will speed up the array filling
>process.
>
>I wrote a quick timing script to see if it would be worthwhile to
>rewrite the pertinent code to do this. The script follows; to my
>surprise, results using array sizes of 1000 and 10000 are actually
>faster just push()ing each element than they are setting $#array and
>then populating it. Even at 100000, the difference is quite minor.
>
>I'd be interested in comments, including whether I've built in some
>fallacy into the test script and other ideas on the topic in general.
I thought your results were odd -- so I reversed the order of the
timings just in case you were giving an advantage to one of the tests by
running it first (i.e., incurring the first time malloc overhead). I
got similar results -- in fact, prealloc was consistently slower.
Upon looking closer at your code I realized something else, however
-- you're using push in one of the functions and array indexing in the
other. I'd imagine that Perl is better optimized for push operations
than indexing operations.
So, I made the following changes and got *significantly* better results:
#!/usr/local/bin/perl -w
use strict;
use Benchmark;
sub presize {
my $size = shift;
my @array;
$#array = $size - 1;
$#array = -1; # change 1: This 'resets' the array,
# but doesn't deallocate the memory.
foreach (0..$#array) {
push(@array, $_); # change 2: push is
# faster than indexing.
}
}
sub bypush {
my $size = shift;
my @array;
foreach (0..$size) {
push(@array, $_);
}
}
foreach (1000, 10000, 100000) {
print STDERR "$_ Trials:\n\n";
timethese(1000, {
Presized => "presize $_",
Pushed => "bypush $_"
}
);
print STDERR "\n\n---*---\n";
}
hairball /tmp>./presizetest.pl
1000 Trials:
Benchmark: timing 1000 iterations of Presized, Pushed...
Presized: 0 secs ( 0.08 usr 0.00 sys = 0.08 cpu)
(warning: too few iterations for a reliable count)
Pushed: 6 secs ( 3.86 usr 0.01 sys = 3.87 cpu)
---*---
10000 Trials:
Benchmark: timing 1000 iterations of Presized, Pushed...
Presized: 1 secs ( 0.56 usr 0.00 sys = 0.56 cpu)
Pushed: 88 secs (40.81 usr 0.04 sys = 40.85 cpu)
---*---
100000 Trials:
Benchmark: timing 1000 iterations of Presized, Pushed...
Presized: 13 secs ( 6.09 usr 0.01 sys = 6.10 cpu)
[Ok, I got bored of waiting for the last pushed anwer...]
So, the moral of the story: If you prealloc, use push afterwards, but
in order to use push, change the size of the array back to 0.
There seems to be a significant enough delta in performance that perhaps
it should be mentioned in the docs where preallocation is mentioned
(perldata).
HTH,
Rich
p.s. I'm using Perl 5.00404
--
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant | I speak for me, | 19055 Pruneridge Ave.
Development Alliances Lab| *not* HP | MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014
------------------------------
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 3941
**************************************