[15839] in Perl-Users-Digest
Perl-Users Digest, Issue: 3252 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 5 06:05:33 2000
Date: Mon, 5 Jun 2000 03:05:11 -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: <960199511-v9-i3252@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 5 Jun 2000 Volume: 9 Number: 3252
Today's topics:
Re: 3 questions about perl (Villy Kruse)
Re: Any function to include a HTML file into the Perl s <lr@hpl.hp.com>
Can anyone help create this regular expresssion? <rampersaud@home.com>
Re: Can anyone help create this regular expresssion? <michael.schlueter@philips.com>
Re: CC problems with Coldfusion Apache module <mark.hamlin@artdigital.co.uk>
DBM or flat file? juump@my-deja.com
Re: DBM or flat file? (William Herrera)
Re: file dates being reported incorrectly..... <gellyfish@gellyfish.com>
Re: floating point algorithm bug in perl 5.6.0? <kmsproule@worldnet.att.net>
getpwnam and Shadow Passwords <blah@nospam.com>
Re: Getting time & date from DOS <pds@x-datcon.co.uk>
HTML on a local server stuartee@my-deja.com
Net::SMTP doesn't work chpshi@my-deja.com
Re: Net::SMTP doesn't work <kiera@nnickee.com>
Re: Net::SMTP doesn't work chpshi@my-deja.com
NEWBIE: Parsing strings with quoted items <mark@chalkboardcom.com>
Re: Newbie~~Please Help !!!!!!!!! <agi@feib.com.tw>
Re: passing form data from cookie input <bill@billcampbell.com>
Re: Perl and SSI chpshi@my-deja.com
Re: Perl gurus: help a C++ programmer optimize his ways <michael.schlueter@philips.com>
Re: perlcc - compile .pm to .so and use <gellyfish@gellyfish.com>
persistent connection with Apache::DBI (mod_perl) <elkh@nsp_free.fr>
Re: persistent connection with Apache::DBI (mod_perl) <bill.kemp@wire2.com>
Re: Predicted generation of ID numbers <gellyfish@gellyfish.com>
Re: RegExp Help, I Think <abe@ztreet.demon.nl>
Re: Secure CGI session in Perl <maciek@treko.net.au>
Re: use File::Find <gellyfish@gellyfish.com>
Re: Using Net::SMTP <gellyfish@gellyfish.com>
Re: Viewing HTTP Requests (Charles DeRykus)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 5 Jun 2000 09:55:17 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: 3 questions about perl
Message-Id: <slrn8jmu84.n9f.vek@pharmnl.ohout.pharmapartners.nl>
On Sun, 4 Jun 2000 08:36:04 -0500, Tad McClellan <tadmc@metronet.com> wrote:
>On Sun, 04 Jun 2000 09:55:58 GMT, chao98@my-deja.com <chao98@my-deja.com> wrote:
>
>> The first one is about "last". It is said that "last" can force
>>program to exit from current statement block.
>
>
>If your book really says that, then it is a Bad Book.
>
>Most Perl books are very poor. You need to be careful when
>selecting a book. Looks like you got one of the many
>rip-off Perl books.
>
>What Perl book do you have that says that?
>
>
>The ultimate authority for how perl works are the docs that
>come with perl.
>
>
> perldoc -f last
>
>
>says: "exits the loop in question"
>
>
>A "statement block" and "a loop" are not the same thing.
>
>
A bare block, { .... } , behaves like a loop.
However do { .... } while ( ... ); is not a loop block
That is confusing sometimes.
#!/usr/bin/perl -w
use strict;
my $abc = 0;
for ( ;; ) {
print "abc = $abc\n";
{
if ( $abc == 10 ) {
print "Last\n";
last;
}
} /* last returnes to here */
$abc++;
last if $abc > 50;
}
print "returning\n";
__END__
--
Villy
------------------------------
Date: Sun, 4 Jun 2000 23:28:43 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Any function to include a HTML file into the Perl script
Message-Id: <MPG.13a4e876c05b5c2c98ab21@nntp.hpl.hp.com>
[alt.perl and comp.lang.perl removed.]
In article <3939378C.BACFD647@millerwebsiteservices.com>,
keegan@millerwebsiteservices.com says...
> Sure, just read the file like any other:
>
> open(HTMLFILE,"<$fileName");
> @lines = <HTMLFILE>;
> close(HTMLFILE);
> $htmlContent = join('',@lines);
Reading a file a line at a time, then joining the lines, is quite
inefficient. Here are better ways:
{ local $/; $htmlContent = <HTMLFILE> }
or
read HTMLFILE, $htmlContent, -s HTMLFILE;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 05 Jun 2000 04:08:15 GMT
From: bRiAn <rampersaud@home.com>
Subject: Can anyone help create this regular expresssion?
Message-Id: <MPG.13a4f1bafc52a4539896a5@news.tor.shaw.wave.ca>
Hello,
I've got some familiarity with regular expressions, but I need some
assistance. I'm doing some form validation, and the following are the
rules:
- minimum of 2 :alpha characters, and maximum of 15 -> [:alpha]{2,15}
- the first character must be a letter, as must be the last
- in the middle, dashes, spaces, and apostrophes are allowed
- there can be no consecutive spaces, dashes or apostrophes
Thanks!
bRiAn
------------------------------
Date: Mon, 5 Jun 2000 23:13:59 +0200
From: "Michael Schlueter" <michael.schlueter@philips.com>
Subject: Re: Can anyone help create this regular expresssion?
Message-Id: <8hfr18$6m$1@porthos.nl.uu.net>
Brian,
I'd perform the matches one after the other instead of creating a giant
regex-monster ;-)
Perhaps I'd check for the last condition (consecutive spaces) first.
------------------------------
Date: Mon, 05 Jun 2000 10:39:26 +0100
From: Mark Hamlin <mark.hamlin@artdigital.co.uk>
Subject: Re: CC problems with Coldfusion Apache module
Message-Id: <393B754E.E76A093@artdigital.co.uk>
I've downloaded and installed gcc successfully. Apxs still looks for cc with /usr/ucb in the path or
not. Is it possible to make gcc the default compiler or redirect cc to gcc?
Many thanks,
Mark Hamlin
Joe Durusau wrote:
> Either buy a compiler, or if you already have one, use
> it (suns would be in /opt/SUNWspro/bin if you did buy it), or
> downlowd a free copy of gcc and its cousins.
>
> Speaking only for myself,
>
> Joe Durusau
>
> Mark Hamlin wrote:
> >
> > Do I need to purchase a new compiler?
> >
> > Kind Regards,
> > Mark Hamlin
> >
> > Mark Hamlin wrote:
> >
> > > When I take ucb out of the path I simply get a less informative message:
> > >
> > > sun2-hamlinm$echo $PATH
> > > /usr/sbin:/usr/bin:/usr/dt/bin:/usr/openwin/bin:/bin:/usr/ccs/bin:.:/usr/local/bin:/usr/apache/bin
> > >
> > > sun2-hamlinm$ls
> > > libcf.a Makefile mod_coldfusion.c
> > > sun2-hamlinm$which cc
> > > no cc in /usr/sbin /usr/bin /usr/dt/bin /usr/openwin/bin /bin /usr/ccs/bin
> > > . /usr/local/bin /usr/apache/bin
> > > sun2-hamlinm$make
> > > apxs -c ./libcf.a /usr/lib/libCrun.so.1 mod_coldfusion.c
> > > cc -DEAPI -DMOD_PERL -DUSE_EXPAT -O -G -Kpic -I/usr/apache/include -c
> > > mod_coldfusion.c
> > > apxs:Break: Command failed with rc=16711680
> > > *** Error code 1
> > > make: Fatal error: Command failed for target `mod_coldfusion.so'
> > > sun2-hamlinm$
> > >
> > > Richard Homolka wrote:
> > >
> > > > Technically not a stupid placeholder, but a stupid wrapper script around
> > > > the compiler you need to purchase from Sun. The wrapper sets flags for
> > > > the BSD compiles, by giving you the BSD includes and the (buggy) BSD
> > > > libraries.
> > > >
> > > > Theoretically of use when Solaris 2.0 first came out and all the
> > > > software was written for BSD SunOS 4.0, but of dubious value now.
> > > >
> > > > Solutions:
> > > > Remove /usr/ucb from your path, depends on if you need anything else
> > > > from that directory.
> > > > Bug Sun to give better error messages in the /usr/ucb/cc script. As it
> > > > is now, pretty cryptic. How does "Language optional software not
> > > > installed" tell me "Hey cheapskate, need to buy the Sun compiler"
> > > >
> > > > --
> > > > ---------------------------------------------------------------------
> > > > Richard Homolka Iozo.com (415) 348-1975
> > > > rhomolka@iozo.com http://www.iozo.com
------------------------------
Date: Mon, 05 Jun 2000 03:59:55 GMT
From: juump@my-deja.com
Subject: DBM or flat file?
Message-Id: <8hf8jl$8c1$1@nnrp1.deja.com>
I'm working with data in a flat file, one record per line. There are
between 20K and 150K records per file. I need to compare a
substring to each record, and return any records that contain the
substring.
Is there a speed advantage to using a database instead of a flat
file for this particular kind of search? Does anyone with experience
using DBM have a recommendation? What about cases where
there are several substrings to compare, using both AND and OR?
Thanks for any advice.
Steve
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 05 Jun 2000 05:24:13 GMT
From: posting.account@lynxview.com (William Herrera)
Subject: Re: DBM or flat file?
Message-Id: <393b37ff.1810955@news.rmi.net>
On Mon, 05 Jun 2000 03:59:55 GMT, juump@my-deja.com wrote:
>I'm working with data in a flat file, one record per line. There are
>between 20K and 150K records per file. I need to compare a
>substring to each record, and return any records that contain the
>substring.
>
>Is there a speed advantage to using a database instead of a flat
>file for this particular kind of search?
No, because with a random substring I doubt that indexing is of any value. If
both the data and the substrings are somehow predictable, so the index key to
the DBM might really mean something, things might be different.
> Does anyone with experience
>using DBM have a recommendation?
Yes, use a flat file and a fast hard disk with good buffers.
>What about cases where
>there are several substrings to compare, using both AND and OR?
Compile the regular expression using & and | in that regular expression, then
use the (dynamically?) compiled regex in the flat file search. This is the sort
of thing that perl really handles well IMO.
---
The above from: address is spamblocked. Use wherrera (at) lynxview (dot) com for the reply address.
------------------------------
Date: 5 Jun 2000 08:31:25 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: file dates being reported incorrectly.....
Message-Id: <8hfl0d$bc$1@orpheus.gellyfish.com>
On Fri, 02 Jun 2000 14:34:26 GMT scumjr@my-deja.com wrote:
> I Wrote :
>
>> You should check the success of your call to stat() and print the
>> value of $! on failure as this will give you some indication of
>> what is going on - I am fairly certain that it is the stat that is
>> failing rather than the date simply being wrong. Can you perform
>> other operations on these files ?
>
> It is stat that is failing. It cannot read the file/directories,
> it gives me the error "No such file or directory". I thought I could
> perform other operations on the files, but it turns out that I can't.
> I guess Perl just doesn't care for these special characters.
>
It would surprise me if Perl can't handle filenames with non ASCII
characters in it - let's see :
#!/usr/bin/perl -w
use strict;
my $filename = join '', map {chr $_} (192 .. 197);
print $filename;
open(FFILE,">$filename") || die "Cant open $filename for write - $!\n";
print FFILE "This is a test\n";
close FFILE;
open(FFILE,$filename) || die "Cant open $filename for read - $!\n";
print <FFILE>;
close FFILE;
(I have to generate the filename like that because I cant type those
characters directly)
Anyhow this works fine for me and the file is created and read from
correctly However it could be down to your OS or version of Perl.
/J\
--
The strong must protect the sweet
--
fortune oscar homer
------------------------------
Date: Mon, 05 Jun 2000 06:50:50 GMT
From: "Kevin M. Sproule" <kmsproule@worldnet.att.net>
Subject: Re: floating point algorithm bug in perl 5.6.0?
Message-Id: <e5I_4.3946$2b4.285868@bgtnsc06-news.ops.worldnet.att.net>
"Vincent Voois" <vvacme@worldonline.nl> wrote in message
news:393997C3.D3226EE3@worldonline.nl...
> I noticed a strange behaviour in Perl 5.6.0 build 613
> Trying the simple piece of code below i get an output that does not really
compute in my mind:
> $number = 4.02;
> $front = int($number);
> $behind = ($number - $front);
> print "full $number\n";
> print "major $front\n";
> print "minor $behind\n";
>
>
> The minor slice '$behind' supposed to have value of 0.02 but strangely, it
returns something near
> 0.0199999999996 (I may lacked a couple of '9'ers too less or too many).
>
> SNIP
Sir,
When did they stop calling it Floating Point Approximation? Here is a
little rounding to two places.
$number = 4.02;
$front = int($number);
$behind = ($number - $front);
$rbehind = int(($behind + .005) * 100) / 100;
print "full $number\n";
print "major $front\n";
print "minor $behind\n";
print "minor $rbehind\n";
full 4.02
major 4
minor 0.0199999999999996
minor 0.02
This stuff should be covered in every CS-101 class. It is always a shock to
see that such "old knowledge" is not being taught and still bewilders
"programmers".
Digitally yours,
Kevin Sproule
------------------------------
Date: Mon, 05 Jun 2000 10:42:41 +0200
From: Marco Natoni <blah@nospam.com>
Subject: getpwnam and Shadow Passwords
Message-Id: <393B6801.C6A6D8DF@nospam.com>
Hi,
I wonder if someone can point me to a module (or give me just a tip)
in order to verify the UNIX authentication of an user when the shadow
password system is used.
Thank you in advance, and...
Best regards,
Marco
------------------------------
Date: Mon, 5 Jun 2000 09:32:51 +0100
From: "Paul D.Smith" <pds@x-datcon.co.uk>
Subject: Re: Getting time & date from DOS
Message-Id: <8hfok2$he0$1@soap.pipex.net>
As others have said, read the Perl docs and use the inbuilt functions but,
in for education, create empty files containing just a "return" then use:
"time <return.txt" or "date <return.txt" to make time and date run without
you having to type the return. No point doing this in Perl but useful in
batch commands where you may want to simply log that start/end date/time.
Paul DS.
--
Please remove the "x-" if replying to sender.
"Scott Mikula" <mikula@students.uiuc.edu> wrote in message
news:Pine.GSO.4.10.10006041931380.8391-100000@ux12.cso.uiuc.edu...
> I am trying to get the time and date within a perl script, on my Windows
> machine. I can use the "time" and "date" commands, which display the
> information, but these commands also expect an input so the script freezes
> until I hit enter. Is there any way to access the time and date without
> going through those DOS commands?
>
> Thanks for any help!
>
------------------------------
Date: Mon, 05 Jun 2000 08:33:07 GMT
From: stuartee@my-deja.com
Subject: HTML on a local server
Message-Id: <8hfok3$jq2$1@nnrp1.deja.com>
I'm v.new to all this web page authoring lark but having a great time
with it. My prooblem is that I really need a hit counter on my page.
This wouldn't normally be a problem (as far as I can tell) except that
I'm working off a local server rather than publishing on the wwweb. I
seem to be lacking a load of workie bits from the server.
This is where my confusion starts :o(
Can anyone tell me what I need to add to the server to get it to work
for me?
Many thanks
Duffry
"I'm not a duck, I'm a pelican!"
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 05 Jun 2000 04:34:40 GMT
From: chpshi@my-deja.com
Subject: Net::SMTP doesn't work
Message-Id: <8hfal0$9q0$1@nnrp1.deja.com>
Hi All
I want to send email with perl script on NT platform without
using an external email program. Some perl veteran suggest me
use module perl. I installed a ActivePerl522 on my Windows98,
and found an email example from ActivePerl Document. This
script use Net:SMTP to send email. I test it on an UNIX web
server and it work well. My NT IIS web server is in US and I'm
in Toronto, I have asked the admin installed an ActivePerl522
but I cannot contact with him today. So I tested the example
script from my own machine (Win98). When I type from command
line: "c:\dir\>perl mail.pl" the system response me that
cannot find Net\SMTP.pm in @INC (@INC contains c:\perl\lib and
c:\perl\site\lib). I tried other modules like Mail::Mailer,
Mail::Sender, or Mail::SendMail, they all result just the same
as the former one and said cannot find the module. Could you
please tell me why?
Thanks for your attention.
Alex
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 05 Jun 2000 00:28:27 -0500
From: Kiera <kiera@nnickee.com>
Subject: Re: Net::SMTP doesn't work
Message-Id: <781B9A9A42B99377.67C1BF847E934E96.65FB2150DBA1383D@lp.airnews.net>
On Mon, 05 Jun 2000 04:34:40 GMT, someone claiming to be
chpshi@my-deja.com said:
>Hi All
Hi :)
>I want to send email with perl script on NT platform without
>using an external email program. Some perl veteran suggest me
>use module perl. I installed a ActivePerl522 on my Windows98,
>and found an email example from ActivePerl Document. This
>script use Net:SMTP to send email. I test it on an UNIX web
>server and it work well. My NT IIS web server is in US and I'm
>in Toronto, I have asked the admin installed an ActivePerl522
>but I cannot contact with him today. So I tested the example
>script from my own machine (Win98). When I type from command
>line: "c:\dir\>perl mail.pl" the system response me that
>cannot find Net\SMTP.pm in @INC (@INC contains c:\perl\lib and
>c:\perl\site\lib). I tried other modules like Mail::Mailer,
>Mail::Sender, or Mail::SendMail, they all result just the same
>as the former one and said cannot find the module. Could you
>please tell me why?
Because Net:SMTP isn't installed. It's part of the libnet bundle. To
install it on your win98 box, go to a dos prompt and type "ppm" to
start the Perl Package Manager. Once it starts, type "install
libnet". After it's installed, another dos window will pop up asking
you if you want to update or modify your libnet configuration: answer
y. You can just accept the default (by pressing Enter) on the rest of
the questions it asks.
Tomorrow you'll probably need to get your NT admin to do the same
thing so you'll have access to Net:SMTP there on your web server as
well.
Kiera
------------------------------
Date: Mon, 05 Jun 2000 06:56:11 GMT
From: chpshi@my-deja.com
Subject: Re: Net::SMTP doesn't work
Message-Id: <8hfiu6$fb4$1@nnrp1.deja.com>
In article
<781B9A9A42B99377.67C1BF847E934E96.65FB2150DBA1383D@lp.airnews.net>,
kiera@nnickee.com wrote:
> On Mon, 05 Jun 2000 04:34:40 GMT, someone claiming to be
> chpshi@my-deja.com said:
>
> >Hi All
>
> Hi :)
>
> >I want to send email with perl script on NT platform without
> >using an external email program. Some perl veteran suggest me
> >use module perl. I installed a ActivePerl522 on my Windows98,
> >and found an email example from ActivePerl Document. This
> >script use Net:SMTP to send email. I test it on an UNIX web
> >server and it work well. My NT IIS web server is in US and I'm
> >in Toronto, I have asked the admin installed an ActivePerl522
> >but I cannot contact with him today. So I tested the example
> >script from my own machine (Win98). When I type from command
> >line: "c:\dir\>perl mail.pl" the system response me that
> >cannot find Net\SMTP.pm in @INC (@INC contains c:\perl\lib and
> >c:\perl\site\lib). I tried other modules like Mail::Mailer,
> >Mail::Sender, or Mail::SendMail, they all result just the same
> >as the former one and said cannot find the module. Could you
> >please tell me why?
>
> Because Net:SMTP isn't installed. It's part of the libnet bundle. To
> install it on your win98 box, go to a dos prompt and type "ppm" to
> start the Perl Package Manager. Once it starts, type "install
> libnet". After it's installed, another dos window will pop up asking
> you if you want to update or modify your libnet configuration: answer
> y. You can just accept the default (by pressing Enter) on the rest of
> the questions it asks.
>
> Tomorrow you'll probably need to get your NT admin to do the same
> thing so you'll have access to Net:SMTP there on your web server as
> well.
>
> Kiera
>
Thank you very much! You save my life!!!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 02 Jun 2000 21:34:09 -0700
From: Mark Miller <mark@chalkboardcom.com>
Subject: NEWBIE: Parsing strings with quoted items
Message-Id: <39388AC1.592AA642@chalkboardcom.com>
I'm trying to parse a string into individual words and phrases in
quotes.
In other words, I want the string "one two" three four "five six seven"
eight "nine ten"
to be broken up into:
"one two" (keeping the quotes)
three
four
"five six seven"
eight
"nine ten"
I've tried a few tricks with split and regexp, but can't quite nail it.
Also, if it's a choice between readability and terseness, please lean
toward readability so this newbie can study up on regexp.
Can ya help?
Thanks,
--
Mark Miller
mark@chalkboardcom.com
Chalkboard Communications (206) 459-5577
http://www.chalkboardcom.com
------------------------------
Date: Mon, 05 Jun 2000 05:55:31 GMT
From: Agi <agi@feib.com.tw>
Subject: Re: Newbie~~Please Help !!!!!!!!!
Message-Id: <8hffce$cva$1@nnrp1.deja.com>
In article <8hf3eu$2qbcs$4@fu-berlin.de>,
news@tinita.de wrote:
> hi,
> please don't shout.
> and think of a better subject next time
Hello, sir
I'm new in Perl.
Be kind to a freshman,ok ??
An innocent person
>
> Agi <agi@feib.com.tw> wrote:
> > I want to split a file to lots of small files.
> > I use a while loop and chomp function, how do I keep the privious
> > line for further reference to generate a group report ??
>
> store it in a variable?
> where's your problem? how do you process
> the data in the while loop?
>
> > Considering the sample data like follows,
> > ( the transactions of two accounts for customer A11111
> > and file layout as follows
> > id type account date withdraw deposit balance
> > ------------------------------------------------------------- )
>
> > A11111 0300 001-003-0001697-7 2000/05/20 100 1000
> > A11111 0300 001-003-0001697-7 2000/05/21 200 1200
> > A11111 0300 001-003-0001697-7 2000/05/22 100 1100
> > A11111 0300 002-004-0001234-5 2000/05/22 100 5000
> > A11111 0300 002-004-0001234-5 2000/05/23 400 4600
> > A11111 0300 002-004-0001234-5 2000/05/25 100 4500
>
> > How to got the group report like follows ??
>
> > 001-003-0001697-7:
> > DATE Withdraw Deposit Balance
> > ----------------------------------------------------------------
> > 2000/05/20 100 1000
> > 2000/05/21 200 1200
> > 2000/05/22 100 1100
>
> > 002-004-0001234-5:
> > DATE Withdraw Deposit Balance
> > ----------------------------------------------------------------
> > 2000/05/22 100 5000
> > 2000/05/23 400 4600
> > 2000/05/25 100 4500
>
> > Any hints ??
> > I'm quite young in Perl.
>
> > Best Regards,
> > Agi Chen
>
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
> --
> http://www.tinita.de \ enter__| |__the___ _ _ ___
> tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
> search & add comments \ \ _,_\ __/\ __/_| /__/ perception
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 05 Jun 2000 04:46:54 GMT
From: "Bill" <bill@billcampbell.com>
Subject: Re: passing form data from cookie input
Message-Id: <2hG_4.158969$55.3305605@news2.rdc1.on.home.com>
Tina Mueller wrote in message <8hf8hg$2qbcs$9@fu-berlin.de>...
>hi,
>
>Bill <bill@billcampbell.com> wrote:
>> I have a link on the main page of my web site that takes you
>> to a login page. This page collects form data and submits it
>> to a (somewhat) secure section of my site.
>
>so how does this work?
>if the user hits submit the first time, another
>script is called, am i right?
>so why don't you check the cookie data in this script, too?
>then the first script can just do a redirect
>to the second script.
I guess I could just have the second script get the cookie
data as well. So that leaves me with a simpler question.
I'm in script 1 and on finding the cookie info I want to just exit the script
and run another one. Is that simply:
if (got_cookie_info) {
exec(script_2.pl)
}
?
------------------------------
Date: Mon, 05 Jun 2000 05:33:40 GMT
From: chpshi@my-deja.com
Subject: Re: Perl and SSI
Message-Id: <8hfe3k$c4p$1@nnrp1.deja.com>
In article <3029eb15.edf8968c@usw-ex0101-007.remarq.com>,
Robert <robertNOroSPAM@kronos.custard.org.invalid> wrote:
> I am writing a little perl script that will create page titles on
> the fly in the same way that page counters place gif image digits
> on the fly.
>
> I need to call the script using SSI with:
>
> <!--#exec cgi="title.cgi" -->
>
> Does anyone know a way of taking the filename of the page that
> calls the CGI script and storing it as a string?
>
> For example, if the CGI script is called from mypage.shtml, how
> can I store "mypage.shtml" as a string in the script?
>
> Any help would be most appreciated.
>
> Rob Phillips.
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion
Network *
> The fastest and easiest way to search and participate in Usenet -
Free!
>
>
Try this environment variable:
$doc_name = $ENV{DOCUMENT_NAME};
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 5 Jun 2000 23:53:54 +0200
From: "Michael Schlueter" <michael.schlueter@philips.com>
Subject: Re: Perl gurus: help a C++ programmer optimize his ways
Message-Id: <8hftc3$1cq$1@porthos.nl.uu.net>
Hi Greg,
Usually I only suffer from our 'slow' network when accessing very large
files (>1MB) when using perl. This depends on our way to do it. Or when I
invert a big matrix. I must admit I never used CGI.
Some loose suggestions:
* I'd #!/usr/local/bin/perl -w # to benefit from warnings
* Do you know the perl debugger perl -d film.pl ? Sometimes when I
toggle through code I can easily detect time consuming steps, unless I know
them. Somtimes it is good to check the size and contents of data structures,
especially when they become more complex.
* local: do you need perls local mechanism (restoring the original variable
after it goes out of scope)? Or did you intend my (a separate namespace for
the entire scope; no restore as with local)? It looks like you know the
difference. Why do you need local? To my taste I have to think more to
follow the code. While code should explain itself without needing to think,
ideally.
* You use a lot of $main::something in subs. I never used that style. What
is your intention? Do you want to access gloabal variables?
* Date-operations in sub report: did you check http://search.cpan.org for
other Date classes? Perhaps there is already a more elegant way do do it.
* Do you know about the HTML-modules from CPAN?
* Do you know chapter 8 "Other Oddments" from Programming Perl (O'Reilly)?
It is dedicated to specific language traps when starting with Perl, Timing
efficiency and other.
Glancing through your code it is very difficult for me to tell you where the
problem is. Do you know the contributions on timing from the CGI-calls (I
mean more specific with respect to specific CGI-calls)? Was there a time
when your program run quick enough? When did it turn to slow? What happened?
Personally I would try to define a few more packages to outsource common
tasks and to reuse code. I'd try to make the code less 'tricky'. Did you
consider using Perl-objects, object modelling etc.?
Good luck,
Michael Schlueter
------------------------------
Date: 5 Jun 2000 09:00:33 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: perlcc - compile .pm to .so and use
Message-Id: <8hfmn1$5q7$1@orpheus.gellyfish.com>
On Wed, 31 May 2000 20:37:10 GMT keith53@my-deja.com wrote:
> The perlcc documentation says you can compile a module (a .pm file)
> into a shared object (a .so file) that can be included in a Perl
> program via use. I was able to compile the .so but cannot figure out
> how to include it in another perl program via use. I have tried
> several ways. Documentation for the use statement says it only accepts
> module names. If I use a file.so it says it can't locate file.pm. If
> I change my .so into a .pm I get the error Unrecognized character \177
> at ... yet the module has compiled sucessfully, is syntatically
> correct -> If I try to use the original .pm it works fine. I get the
> same error if I require the .so file.
>
It means that you can 'use' it in a program that is to be subsequently
compiled with perlcc - a normal Perl program cant use it as it isnt a
Perl module anymore.
/J\
--
Well, crying isn't gonna bring him back...unless your tears smell like
dog food. So you can either sit there crying and eating can after can
of dog food until your tears smell enough like dog food to make your
dog come back or you can go out there and find your dog.
--
fortune oscar homer
------------------------------
Date: Mon, 05 Jun 2000 10:41:54 +0200
From: elk <elkh@nsp_free.fr>
Subject: persistent connection with Apache::DBI (mod_perl)
Message-Id: <393B67D2.816DFEEC@nsp_free.fr>
I am trying to have a persistent access to my database (mysql)
via Apache::DBI bat i can't find any example of tow script using a same
connection
please help
email elkh@free.fr
--
.oooO \|/
+( )-------©¥©-------Oooo.---+
+ \ (y'a des pingouins ( ) +
+ \_) sur le net!! ) / +
+-------oOOo\_)(_/oOOo-(_)-----+®
------------------------------
Date: Mon, 5 Jun 2000 10:05:00 +0100
From: "W Kemp" <bill.kemp@wire2.com>
Subject: Re: persistent connection with Apache::DBI (mod_perl)
Message-Id: <960196003.13126.0.nnrp-08.c3ad6973@news.demon.co.uk>
elk wrote in message <393B67D2.816DFEEC@nsp_free.fr>...
>I am trying to have a persistent access to my database (mysql)
>via Apache::DBI bat i can't find any example of tow script using a same
>connection
I have a feeling that it does this automatically, and overrides normal
connects and disconnects.
Run your site, and see how many mysqld's are running, and if they are still
there when the site is inactive.
This stuff is in std. mod perl information so ...
------------------------------
Date: 5 Jun 2000 08:06:08 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Predicted generation of ID numbers
Message-Id: <8hfjh0$rb4$1@orpheus.gellyfish.com>
On Sun, 04 Jun 2000 07:10:28 GMT Andrej wrote:
> Other question, is the similar scheme of auto definition UNIX/WIN
> efficient here?
>
> if (-s "/bin/ln" ) {
I would probably use $^O instead - as this is far more certain to be accurate.
There is always the outside chance that there will be a /bin/ln on some
windows machine you encounter.
/J\
--
I know you can read my thoughts, boy: Meow, Meow, Meow, Meow, Meow,
Meow, Meow, Meow, Meow, Meow, Meow, Meow, Meow, Meow, Meow, Meow.
--
fortune oscar homer
------------------------------
Date: Mon, 05 Jun 2000 07:25:57 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: RegExp Help, I Think
Message-Id: <i8emjs0013h6t6vdetcvnnpm9n61dd00sg@4ax.com>
On Sun, 04 Jun 2000 22:08:30 -0600, "scott thomason"
<scott@industrial-linux.org> wrote:
[Please quote the part of the original post you're replying to.]
> ..or you could just do this:
> $path =~ /\\(.*?)$/;
> my $file = $1;
>
> ...or maybe:
> my @chunk = split(/\\/, $path);
> my $file = $chunk[$#chunk];
>
> ...seems like importing a module would be a bit much for what you need.
And rewrite that piece of code, once I move it to the linux-box?
No thank you :-)
--
Good luck,
Abe
------------------------------
Date: Mon, 05 Jun 2000 17:00:09 +0800
From: root <maciek@treko.net.au>
Subject: Re: Secure CGI session in Perl
Message-Id: <393B6C19.70A3F62C@treko.net.au>
scott thomason wrote:
> Here's how you can do it without relying on HTTP BASIC authentication (which,
> as a previous reply pointed out, is pointless if the browser caches passwords).
>
> Build your login screen. Serve it up via HTTPS so it's impractical to sniff the password.
>
> In the backend app, build a table that stores two cols: a session ID and a session key.
> Whenever someone logs in and their password is valid, the backend CGI app assigns
> a new session ID (can be the next ascending number or ?). Then make an MD5 hash
> out of some suitable random noise (you may also wish to look at /dev/random or /dev/urandom),
> perhaps like this (in Perl);
>
> =============
> #!/usr/bin/perl -w
>
> use Digest::MD5 ('md5_hex');
>
> my $sesskey = md5_hex(`ps aux; date; ls -l /var/log`);
> print "$sesskey\n";
> =============
>
> In the backend app, attach that SID/SKEY to the user in the DB. Now everytime you generate
> HTML via your app, include the UID/SID/SKEY as hidden form vars (or even as query vars in the url).
> The first step in every backend process is to verify that the SID is indeed assigned to that UID, and that the
> SKEY is valid for that SID. This essentially gives you a one-time password for the UID. Make sure that
> you expire the SID/SKEY combo after a reasonable amount of time has elapsed.
> ---scott
Thanks a lot for the idea. As a matter of fact I had a similar one, just I planned to use cookies instead of
SKEY. Randomly generated SKEY is hovewer more secure I think - asumming that someone is tricky enough (I am not)
to guess or sniff cookie value and set it up manually in the browser.
Indeed the key can be extremely long or complicated which makes it virtually impossible to be cracked. I will
give it a go.
Many thanks to all you guys that replied
Best regards,
--
Maciej Mastalarczuk
maciek@treko.net.au
------------------------------
Date: 5 Jun 2000 09:25:12 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: use File::Find
Message-Id: <8hfo58$9ab$1@orpheus.gellyfish.com>
On Wed, 31 May 2000 12:17:57 -0700 Larry Rosler wrote:
> In article <8h3lih$j96$1@nnrp1.deja.com> on Wed, 31 May 2000 18:27:43
> GMT, Dr. Bob <bobmerrill@my-deja.com> says...
>> > > open INP, "$tmpfil" || die "cannot open tmpfil\n";
>> > > open OUT, ">$file" || die "cannot re-open $file\n";
>> > You should use 'or' instead of ||. See "perldoc perlop". || has a
>> > higher precedence. In the code above, you won't catch any error
>> > from rename and open. You are really evaluating this:
>> > open OUT, (">$file" || die "cannot re-open $file\n");
>>
>> Damn, learn something new everyday. Has this always worked this way
>> (including Perl4?).
>
> Yes.
>
Except of course IIRC before Perl 5 the parentheses were necessary for the
open so the situation didnt arise ...
/J\
--
Wait a minute. I'm a guy like me!
--
fortune oscar homer
------------------------------
Date: 4 Jun 2000 16:38:07 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Using Net::SMTP
Message-Id: <8hdt4v$mmg$1@orpheus.gellyfish.com>
On Sun, 04 Jun 2000 10:52:09 GMT lmorgan@lineone.net wrote:
> Hi,
>
> I've tried to use an example of Net::SMTP that I found, however I can't
> get it to work...
> One thing I have noticed is that Net::SMPTP doesn't require a password
> to log onto the mail server... why not? With OE (Outlook Express) and
> other mail programs it is neccessary to have a password or is that only
> used for pop3???
Yes. SMTP doesnt require authentication.
>
> It may be that my server doesn't have Net::SMTP installed, does it come
> as standard with version 5?? But even so I would have though a password
> would be needed to send mail??
>
Net::SMTP is not part of the standard distribution - it is part of libnet
that can be obtained from CPAN. And no you dont need a password to send
mail with SMTP .
/J\
--
Here are your messages: 'You have 30 minutes to move your car', 'You
have 10 minutes', 'Your car has been impounded', 'Your car has been
crushed into a cube', 'You have 30 minutes to move your cube'.
--
fortune oscar homer
------------------------------
Date: Mon, 5 Jun 2000 05:42:11 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Viewing HTTP Requests
Message-Id: <Fvo2IB.5JL@news.boeing.com>
In article <Pine.GSO.4.10.10006031336330.29029-100000@ux5.cso.uiuc.edu>,
Scott Mikula <mikula@students.uiuc.edu> wrote:
>I was told this might be a good place to ask this question:
>
>I am trying to write a perl script to automate some of my online activity,
>including reading and parsing web pages. Unfortunately I think the HTTP
>requests are more than just simple GETs because that doesn't work from my
>script; I assume they include more information, whether it be about cookies
>or something else.
>
>Is there a way to see the exact request that Netscape is sending out. If
>there is an easy way, great, or can someone give me a hint as to how I
>might write a script to do that?
>
>
You might want to try Tim Meadowcroft's HTTP sniffer.
Here's a summary I ran across:
HttpSniffer.pl (at http://www.compansr.demon.co.uk) is
designed for debugging HTTP conversations. It doesn't hack
into the TCP/IP stack, instead it runs as a tunnel - you
start up the sniffer and tell it where to forward HTTP
requests to (the real server), and then point the browsing
app at the sniffer. It dumps the headers of the HTTP request
and replies as it processes them.
It's free, it has many authors, and the primary author will
support it by answering any questions you have. It was
originally written to debug cookie transactions, but it's
quite a handy tool for other tasks too.
--
Charles DeRykus
------------------------------
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 3252
**************************************