[11692] in Perl-Users-Digest
Perl-Users Digest, Issue: 5292 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Apr 3 17:05:23 1999
Date: Sat, 3 Apr 99 14:00:21 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 3 Apr 1999 Volume: 8 Number: 5292
Today's topics:
*** Perl programmer needed for various projects <g@just-for-fun.net>
<< Upload without modules >>(flame bait) <trent@jps.net>
Re: << Upload without modules >>(flame bait) (Ronald J Kimball)
Re: << Upload without modules >>(flame bait) (Bob Trieger)
Accessing MS Access with perl <pgh@ga.nl>
Re: Alternative for Perl (Andrew M. Langmead)
Re: Apache-sendmail-whichperl <gellyfish@gellyfish.com>
E-mail from webpage... <pt98hwi@student.hk-r.se>
Re: Help-Perl Usergroups (brian d foy)
Re: Help: Perl not expanding wildcards from commandlin <gellyfish@gellyfish.com>
how to call java within perl <wangh@cs.purdue.edu>
Re: is there any ceiling function in perl? (Larry Rosler)
Re: is there any ceiling function in perl? <jdf@pobox.com>
Re: Is this patternmatching or what? (Tad McClellan)
Re: Is this patternmatching or what? (Bob Trieger)
Re: Is this patternmatching or what? (Larry Rosler)
Load file from other server <CoolCyberDude@abigfoot.com>
LWP and Timeout? <debot@xs4all.nl>
No Echo over TCP Server <wells@cedarnet.org>
Re: parsing problem... (Bob Trieger)
Re: parsing problem... <jdf@pobox.com>
Re: Pls help... regex to recognise a phone number. (Ronald J Kimball)
Re: Pls help... regex to recognise a phone number. <jonz@rmi.nospam.net>
printing in foreach <collinw@netinc.ca>
Re: printing in foreach (Larry Rosler)
Re: printing in foreach (Tad McClellan)
Re: Reading Graphics (brian d foy)
running perl on NT IIS happyman1402@my-dejanews.com
SiberLink Resume Builder <konst@atiss.net>
Re: Silicon Valley Perl Mongers? (brian d foy)
Still stupid I guess. (Rob Sweet)
Re: Still stupid I guess. (brian d foy)
Re: system ('myproc &'); (Andrew M. Langmead)
Where could I find CGI.pm of Perl version 5.003? <fluneau@viconics.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 03 Apr 1999 18:47:47 GMT
From: G <g@just-for-fun.net>
To: g@just-for-fun.net
Subject: *** Perl programmer needed for various projects
Message-Id: <7e5noi$vps$1@nnrp1.dejanews.com>
Perl programmer needed for many projects. Will be paid on an hourly basis,
with job estimates expected from programmer before each project is
undertaken.
The new programmer will be working closely with our existing Perl programmer,
to get familiarized with the system we have in place.
Qualifications:
Perl (an absolute must)
MySQL ( or other SQL programming experience) (a must)
CGI/Web development experience
FreeBSD ( or other UNIX)
HTML (helpful)
JavaScript (would be nice)
Please contact Greg (g@just-for-fun.net) for more information.
*****************************************
BE$T Payouts - http://www.BestPayouts.com
Just-For-Fun.Net - Internet Entertainment
http://www.Just-For.Fun.Net
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 03 Apr 1999 18:35:33 GMT
From: Trent Hare <trent@jps.net>
Subject: << Upload without modules >>(flame bait)
Message-Id: <37065F8C.207E@jps.net>
Before you say it... I know ...CGI.pm
But,
That already said, anyone have a link to a file upload snippet that
doesn't require
modules?
I've been to DEJANEWS, Perl FAQ, scoured my perl book "Perl 5
Interactive course", e-mailed a dozen people etc. No dice.
Thanks in advance,
Trent
------------------------------
Date: Sat, 3 Apr 1999 16:01:52 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: << Upload without modules >>(flame bait)
Message-Id: <1dpp08k.5z5geudnzzb4N@p37.block2.tc3.state.ma.tiac.com>
Trent Hare <trent@jps.net> wrote:
> Before you say it... I know ...CGI.pm
>
> But,
> That already said, anyone have a link to a file upload snippet that
> doesn't require
> modules?
Why?
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sat, 03 Apr 1999 20:59:27 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: << Upload without modules >>(flame bait)
Message-Id: <7e5vcs$609$1@birch.prod.itd.earthlink.net>
Trent Hare <trent@jps.net> wrote:
o>Before you say it... I know ...CGI.pm
CGI.pm
Bob Trieger
sowmaster@juicepigs.com
------------------------------
Date: Sat, 03 Apr 1999 21:01:31 +0200
From: Patrick <pgh@ga.nl>
Subject: Accessing MS Access with perl
Message-Id: <3706658A.6424F65C@ga.nl>
Hi,
Can someone tell me how to read a ms-access database with perl on a
Linux (redhat 5.1) server.
Thank,
Patrick G.
------------------------------
Date: Sat, 3 Apr 1999 19:57:33 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Alternative for Perl
Message-Id: <F9Mq3x.6q2@world.std.com>
Frank de Bot <debot@xs4all.nl> writes:
>Is there an other language to replace perl, which is much faster?
>Currently I have a database and I think when It's grown bigger, it will
>ask too much of my computers capicity.
If the code you use to access your data is O(n) or worse, you should
re-think the algorithm.
--
Andrew Langmead
------------------------------
Date: 3 Apr 1999 18:35:00 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Apache-sendmail-whichperl
Message-Id: <7e5n0l$ib$1@gellyfish.btinternet.com>
On Thu, 01 Apr 1999 22:01:43 GMT velocity wrote:
> Hey folks,
>
> I downloaded a message board. After unzipping I tried to run this
> message board on my own computer with ActivePerl and Windows 95 and
> Apache 1.3.3 with the localhost.
>
> But the message board script needs some informations. They wrote to
> start telnet and type in "which perl", "which sendmail" and "which
> date" to complete the script.
>
> But I do not get connection with telnet on the localhost.
>
Well no Windows '95 has no telnet server - what a frightening prospect.
Even if it did then 'which' wouldnt work anyhow as it is specific to
certain Unix shells. The 'date' on Windows '95 is not compatible with
that on Unix and 'sendmail' is not available on that platform either
(there is an NT port but I dont think it will run on '95). Perl is most
usually found in 'c:\perl\bin\perl.exe' but might be somewhere else so
you will have to look for it.
The bottom line here is that in order to get this program to work you
are going to have alter it to remove these Unixisms an replace them
with something that will work on your platform.
And no before you ask I cant tell you how - you might want to take it up
with the author of the software. Of course when you try to do the
alterations and if you run into some difficulty you might post a small
piece of code that illustrates the problem you are having then people
will be happy to help as long as it is a Perl question, not a FAQ and
it is apparent you have taken some steps to help yourself.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 03 Apr 1999 23:14:14 +0200
From: Henrik Widenfors <pt98hwi@student.hk-r.se>
Subject: E-mail from webpage...
Message-Id: <370684A6.6A54@student.hk-r.se>
Hi
I4m interested in sending a e-mail from my webpage.
I have looked at FormMail and noticed that I need the program
"sendmail".
*I was able to located this file on the server(UNIX server), but what if
I would like to use FormMail in a Windows based server?
* Do a Windows based server got this file(sendmail)?
*What do I need, using FormMail on a Windows based server if "sendmail"
don4t exsist?
* What would you recommend me to use if working with a Windows based
Server(Script + mailprogram MUST be freeware)?
PLEASE send a e-mail to pt98hwi@student.hk-r.se aswell
Thanks
/Henrik Widenfors
------------------------------
Date: Sat, 03 Apr 1999 15:49:27 -0500
From: brian@pm.org (brian d foy)
Subject: Re: Help-Perl Usergroups
Message-Id: <brian-ya02408000R0304991549270001@news.panix.com>
In article <m1soaheis2.fsf@halfdome.holdit.com>, merlyn@stonehenge.com (Randal L. Schwartz) posted:
> Tony> The openings I have currently are
> Tony> in Toronto Canada. I have heard that there is a Usergroup called
> Tony> Perl Mongerers (not sure of the spelling) Help in these two
> Tony> areas would really be appreciated.
>
> The Perl Mongers website at www.pm.org should be able to direct you
> to a PM group in your area.
not only that, but if he reads the mailing list page, he'll find
two jobs related mailing lists sponsored by Perl Mongers :)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: 3 Apr 1999 18:51:51 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help: Perl not expanding wildcards from commandline.
Message-Id: <7e5o07$jk$1@gellyfish.btinternet.com>
On Sat, 03 Apr 1999 16:37:30 GMT rogDH wrote:
> I just installed ActivePerl about a week ago.
> I've written some scripts that work, so it seem that the install went
> correctly.
>
> However, it appartnetly does not expand wildcards from my commandline.
>
No, it doesnt I'm afraid.
It is an unfortunate feature of the command intepreters in the MS world
that *they* do not expand wildcards as shells generally do in the Unix
world. Now because ActivePerl is built from the same source as that for
Unix and no special wildcard handling is necessary on the latter platform
there will be no none for ActivePerl either.
You will possibly want to use File::DosGlob to expand the wildcards in your
program or alternatively get yourself a Win32 port of some shell that does
the expansion (I use the djgpp port of 'bash' if forced to use Windows).
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 3 Apr 1999 15:41:23 -0500
From: "Hailan Wang" <wangh@cs.purdue.edu>
Subject: how to call java within perl
Message-Id: <7e5ubq$bjo$1@mozo.cc.purdue.edu>
I am working on a web project, and I need to
call some java functions inside perl because
I want to use perl as my main web data carrier
but I want to use java to deal with the data processing
on the server. So is there a way to do this? Another
word, is it possible for a perl script to call java application
at the server (not java applet)? Please help and thanks a lot.
Hailan
------------------------------
Date: Sat, 3 Apr 1999 09:00:48 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: is there any ceiling function in perl?
Message-Id: <MPG.116fe9141e8bd4e9989828@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7e5c36$353$1@news.swissonline.ch> on Sat, 3 Apr 1999
17:25:15 +0200, Samuel Kilchenmann <skilchen@swissonline.ch >says...
> Larry Rosler schrieb in Nachricht ...
...
> >sub ceil { ($_[0] != int $_[0]) + int $_[0] }
> >
> Except that the result is wrong for negative numbers ...
> what about:
> sub myceil { $_[0] > 0 ? int($_[0] + 1) : int($_[0]) }
> sub myfloor { $_[0] > 0 ? int($_[0]) : int($_[0] - 1) }
Well, no. I think you forgot that ceil or floor for an integer is the
value of the integer itself. But your point about negatives is correct
-- I forgot that int() rounds to zero, not down. So I now have:
sub newceil { ($_[0] >= 0 && $_[0] != int $_[0]) + int $_[0] }
sub newfloor { -($_[0] < 0 && $_[0] != int $_[0]) + int $_[0] }
My point about not needing the module is disappearing rapidly. :-(
But my point about the convenience of *defining* numeric TRUE to be 1
remains for discussion.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 03 Apr 1999 11:49:42 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: is there any ceiling function in perl?
Message-Id: <m3yak9wswp.fsf@joshua.panix.com>
"Samuel Kilchenmann" <skilchen@swissonline.ch> writes:
> what about:
> sub myceil { $_[0] > 0 ? int($_[0] + 1) : int($_[0]) }
> sub myfloor { $_[0] > 0 ? int($_[0]) : int($_[0] - 1) }
#!/usr/bin/perl -w
sub myceil { $_[0] > 0 ? int($_[0] + 1) : int($_[0]) }
sub myfloor { $_[0] > 0 ? int($_[0]) : int($_[0] - 1) }
print myceil(42.0), "\n";
print myfloor(-42.0), "\n";
__END__
43
-43
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Sat, 3 Apr 1999 07:43:10 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Is this patternmatching or what?
Message-Id: <uc25e7.94h.ln@magna.metronet.com>
Annica Johansson (nca@tek.edu.jonkoping.se) wrote:
: I'm trying to figure out how to get the script to search for a word given to
: the script by the keyboard... Not only do I want the script to search for
: that particular word, but I also want it to only search the first word on
: every line.
: Could anyone help me and tell me were I went wrong?
You went wrong in numerous places.
: $file = '<C:\perl\mitt\test2.txt';
: open(INFO, $file);
What will your program do if the open() should happen to fail?
(file doesn't exist, permission denied...)
A: It will make garbage output
What should it do instead if it cannot open() the file?
Probably just give up and stop execution.
The usual "give up" idiom in Perl is:
open(INFO, $file) || die "could not open '$file' $!";
That is, you should *always* check the return value from open()
: @lines = <INFO>;
Since you are finished with the INFO filehandle here, you
should close it.
Perl will close it for you when it exits, but it is safer to
always close. (It cost me 6 hours of troubleshooting once.
I learned my lesson: always do an explicit close())
: print "Enter a word to search for:";
You should use single quotes if you do not need variable
interpolation or backslash escapes:
print 'Enter a word to search for:';
: $a = <STDIN>;
There is a newline on the end of $a, best remove that unless
you are searching for a word at the end of the line.
chomp $a;
( $a (and $b) are "special" in Perl. They are used for sorting.
You can sometimes get strange results if you use them for
your own purposes.
But that hardly matters, since nobody would use an
undescribed single letter variable name.
Instead they would chose a name that indicates what the
variable is meant to contain.
e.g. instead of using a mysterious $a, they would use
something like $word or $user_input or something :-)
)
: while (<@lines>) {
That line is all out of whack.
The <angle brackets> are an input operator, so perl will try
to do input here.
You have already done all of the input you need to do. I think
you are trying to "walk" over all of the elements (lines) of
the @lines array.
You do that like this:
foreach (@lines) { # perl puts each line, into the $_ variable
or
foreach $line (@lines) { # perl puts each line, into the $line variable
: @lines = $f;
I don't know what you were hoping for that statement to do.
You should *always* enable warnings from perl. It will catch
many of your mistakes for you.
You should also use the 'use strict' pragma and declare all of
your variables too, for the same reason.
Start with this and experiment with it:
----------------------
#!/usr/bin/perl -w
use strict;
my $file = 'data';
open(INFO, $file) || die "could not open '$file' $!";
my @lines = <INFO>;
close(INFO);
print 'Enter a word to search for: ';
my $search_word = <STDIN>;
chomp $search_word;
foreach my $line (@lines) {
print $line if $line =~ /^$search_word/;
}
#print grep /^$search_word/, @lines; # replace the 3 lines above with 1 line
----------------------
Note that Perl has a grep() function specifically made for
searching in an array.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 03 Apr 1999 18:09:38 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Is this patternmatching or what?
Message-Id: <7e5le4$l6n$1@birch.prod.itd.earthlink.net>
"Annica Johansson" <nca@tek.edu.jonkoping.se> wrote:
o>I'm trying to figure out how to get the script to search for a word given to
o>the script by the keyboard... Not only do I want the script to search for
o>that particular word, but I also want it to only search the first word on
o>every line.
o>Could anyone help me and tell me were I went wrong?
o>The code:
o>
Where is your Shebang?
o>$file = '<C:\perl\mitt\test2.txt';
o>open(INFO, $file);
Always check the status of your open!
o>@lines = <INFO>;
o>
o>print "Enter a word to search for:";
o>$a = <STDIN>;
o>
You didn't chop the newline character off of your input.
o>while (<@lines>) {
Get those diamond operators out of there.
o> @lines = $f;
$f is undefined, are you sure that you want to set your @lines array to undef?
o> if ($f =~ /$a/) {
$f is undef, it ain't gonna match anything.
o> print "$'";
You shouldn't use $' but even if it was ok you aren't using it right.
o> }
o> }
These closing brackets should be flush with the beginning of the statements
that they are closing but it is only points for style.
You never closed the INFO filehandle.
The biggest favor you could do yourself is getting a copy of "Learning Perl".
You'd be able to do what you are trying to here after reading the first few
pages.
Here is what your program should resemble.
#!c:/perl/bin/perl -w
open INFO, '<C:\perl\mitt\test2.txt' or die "Can't open test2: $!";
print "Enter a word to search for:";
chomp($a = <STDIN>);
while (<INFO>) {
if ( /$a/) {
print;
}
}
close INFO;
Bob Trieger
sowmaster@juicepigs.com
------------------------------
Date: Sat, 3 Apr 1999 11:05:04 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Is this patternmatching or what?
Message-Id: <MPG.1170063c8fcdf6d1989829@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <37064df7@news2.mixcom.com> on Sat, 3 Apr 1999 19:14:36
+0200, Annica Johansson <nca@tek.edu.jonkoping.se >says...
> I'm trying to figure out how to get the script to search for a word given to
> the script by the keyboard... Not only do I want the script to search for
> that particular word, but I also want it to only search the first word on
> every line.
...
> $file = '<C:\perl\mitt\test2.txt';
Good. Single quotes protect the backslashes. But forward slashes work
too, and survive double-quotes also.
> open(INFO, $file);
Get into the habit of *always* checking the result of an 'open':
open INFO, $file or die "Couldn't read $file. $!\n";
> @lines = <INFO>;
>
> print "Enter a word to search for:";
> $a = <STDIN>;
Get rid of the trailing newline on what was read in.
chomp $a;
> while (<@lines>) {
> @lines = $f;
Neither of these lines does what you want. You want to do an operation
'for each' line of text:
foreach my $line (@lines) {
Within the loop, each line will appear successively in $line.
> if ($f =~ /$a/) {
> print "$'";
> }
> }
Now you say you want to search only the first word on each line for the
text that was inputted. So let's isolate the first word with a regex
(and skip the line if there are no 'word's):
my ($first_word) = $line =~ /(\w+)/ or next;
If you want an exact match between that word and the input string:
print $line if $first_word eq $a;
If you want only to find the input string within the first word:
print $line if index($first_word, $a) >= 0;
You could do either of these steps with a regex, but it wouldn't be any
better. Assuming the latter case, and that you don't want to interpret
special characters in the input string:
print $line if $first_word =~ /\Q$a/;
You could benefit by acquiring a good Perl tutorial, such as 'Learning
Perl' from O'Reilly and Associates, where most of this is discussed.
Good luck!
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 3 Apr 1999 20:37:51 +0200
From: "ccd" <CoolCyberDude@abigfoot.com>
Subject: Load file from other server
Message-Id: <7e5n5d$pjg$1@news.casema.net>
How can I load a file from an other server with a perl cgi script?
(the open command doesn't work (might be the server?)
Stephan
--
My site: http://www.casema.net/~dolman/s
Get notified when you got mail in your Hotmail account at
http://www.xs4all.nl/~vanerp/mc.htm
Get FREE banner clicks at http://www.bigfoot.com/~tcn
------------------------------
Date: Sat, 03 Apr 1999 20:05:53 +0200
From: Frank de Bot <debot@xs4all.nl>
Subject: LWP and Timeout?
Message-Id: <37065881.7D8673AE@xs4all.nl>
Is there a way to set manual the timeout time if you are using LWP?
--
My Email : debot@xs4all.nl
Homepages : - http://www.debot.nl/ppi/
- http://www.searchy.net/
------------------------------
Date: Sat, 03 Apr 1999 21:52:44 +0000
From: Steve Wells <wells@cedarnet.org>
Subject: No Echo over TCP Server
Message-Id: <37068DAC.9931DB0@cedarnet.org>
I have a server that I want people to enter a password
at and not have it echo back to their terminal.
Here's the relevant section of code:
---------------------------------------
use IO::Socket;
use Term::ReadKey;
my $server = IO::Socket::INET->new(LocalPort => $server_port,
Type => SOCK_STREAM,
Reuse => 1,
Listen => 10)
or die "Couldn't be a tcp server on $server_port";
while (my $client = $server->accept()) {
print $client "Password: ";
ReadMode('noecho', $client);
chomp(my $password = ReadLine(0, $client));
print "PASSWORD: $password\n";
}
-------------------------------------------
Questions:
1) WHY doesn't this work?
2) WHAT will work?
TIA,
STEVE
--
-----------
Stephen D. Wells
http://www.iren.net/wellss/
------------------------------
Date: Sat, 03 Apr 1999 17:48:31 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: parsing problem...
Message-Id: <7e5k6i$jj9$1@birch.prod.itd.earthlink.net>
"Michael Yevdokimov" <flanker@sonnet.ru> wrote:
o>I have a problem with parsing data... :((
o>
o>$C_L=$ENV{'CONTENT_LENGTH'};
o>read(STDIN, $buffer, $C_L);
o>@pairs = split(/&/, $buffer);
o>foreach $pair (@pairs)
o>
o> ($name, $value) = split(/=/, $pair);
o> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
o> $value =~ s/%(..)/pack("c", hex($1))/ge; #
o> $value =~ s/<!--(.|\n)*-->//g;
o> $value =~ tr/+/ /; #change pluses onto spaces
o> $H{$name} = $value;
o> if ($value eq "") {
o> # Save to array the names of null parameters
o> push(@absent,$name);
o> }
o>}
Much easier written as:
use CGI qw( :cgi-lib );
ReadParse(*H);
This will probably solve your surname problem too.
For more info:
perldoc CGI
Good luck,
Bob Trieger
sowmaster@juicepigs.com
------------------------------
Date: 03 Apr 1999 13:10:46 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: "Michael Yevdokimov" <flanker@sonnet.ru>
Subject: Re: parsing problem...
Message-Id: <m3u2uxwp5l.fsf@joshua.panix.com>
"Michael Yevdokimov" <flanker@sonnet.ru> writes:
> For example, form has POST method and one of the fields named as
> 'realname'..
use CGI;
my $realname = param('realname');
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Sat, 3 Apr 1999 13:21:54 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Pls help... regex to recognise a phone number.
Message-Id: <1dposk0.3835rq1yyvj7sN@p37.block2.tc3.state.ma.tiac.com>
Kim Saunders <kims@tip.net.au> wrote:
> Now, the bit that gets me is that this must recognise a number written
> by a human. And humans write numbers in silly ways... I am trying to
> get american numbers, which are in the format:
>
> ((+)1) (123) 456 7890
>
> Of courses, the problems are that the numbers can be in varing
> formats, with different puctuation, spaces in different places,
> brackets, hyphens, pluses (for international number). Basically, I
> thing if I can get something that will recognise a block of 7-16 or so
> characters, with nothing but digits, spaces, hyphens, brackets, and
> pluses, and at least 7 of them actual digits, I will be doing well. No
> matter what I do, it won't be foolproof, but just a few simple ones
> would be great to get me started.
How about this?
/((?:(?:\+?1[ -]*)?\(?\d{3}\)?[ -]*)?\d{3}[ -]*\d{4})/
/
(
(?:
(?:\+?1[\ -]*)? # initial 1
\(?\d{3}\)?[\ -]* # area code
)?
\d{3}[\ -]*\d{4} # exchange and number
)
/x
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 3 Apr 1999 18:42:50 GMT
From: Jonesy <jonz@rmi.nospam.net>
Subject: Re: Pls help... regex to recognise a phone number.
Message-Id: <7e5nfa$js$1@news1.rmi.net>
Kim Saunders <kims@tip.net.au> wrote:
: Now, the bit that gets me is that this must recognise a number written
: by a human. And humans write numbers in silly ways... I am trying to
: get american numbers, which are in the format:
: ((+)1) (123) 456 7890
Well, don't forget about HUxley 5-7244. :-)
Jonesy
--
Marvin L. Jones jonz<AT>rmi.net
Gunnison, Colorado
272 days to go until the Year 2000 -- So what!
638 days to go until the 3rd Millennium of the C.E.
------------------------------
Date: Sat, 03 Apr 1999 14:11:50 -0500
From: Wayne Collins <collinw@netinc.ca>
Subject: printing in foreach
Message-Id: <370667F6.8A50FC6D@netinc.ca>
The code below prints . . .
5
4
3
2
1
BOOM!
. . . with a 1 second pause after each item.
foreach $count (5, 4, 3, 2, 1, 'BOOM!')
{
print $count, "\n";
sleep (1);
}
If I change the code to this . . .
foreach $count (5, 4, 3, 2, 1, 'BOOM!')
{
print $count;
sleep (1);
}
print "\n";
There is a six second pause and then the entire line is printed. It
appears the newline character is required to get something to the
screen. Can anyone explain that? Merci.
------------------------------
Date: Sat, 3 Apr 1999 11:25:48 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: printing in foreach
Message-Id: <MPG.11700b1086adc7b898982a@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <370667F6.8A50FC6D@netinc.ca> on Sat, 03 Apr 1999 14:11:50 -
0500, Wayne Collins <collinw@netinc.ca >says...
...
> If I change the code to this . . .
> foreach $count (5, 4, 3, 2, 1, 'BOOM!')
> {
> print $count;
> sleep (1);
> }
> print "\n";
> There is a six second pause and then the entire line is printed. It
> appears the newline character is required to get something to the
> screen. Can anyone explain that? Merci.
Il n'y a pas de quoi.
It is called 'line-buffering' which is the default behavior for STDOUT
to a terminal. To overcome it, put the following early in your program:
$| = 1;
Read all about it in this section of perlvar:
autoflush HANDLE EXPR
$OUTPUT_AUTOFLUSH
$|
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 3 Apr 1999 08:25:10 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: printing in foreach
Message-Id: <mr45e7.emh.ln@magna.metronet.com>
Wayne Collins (collinw@netinc.ca) wrote:
: It
: appears the newline character is required to get something to the
: screen. Can anyone explain that?
Buffering.
You want to tell perl to flush the buffer after every print(),
instead of its normal behavior of buffering lines.
See the description of the $| special variable in perlvar.pod
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 03 Apr 1999 15:46:11 -0500
From: brian@pm.org (brian d foy)
Subject: Re: Reading Graphics
Message-Id: <brian-ya02408000R0304991546110001@news.panix.com>
In article <7e5jg4$otb$1@goof.de.uu.net>, "Thomas Schwanhduser" <Thomas@aps.de> posted:
> I want to check if several servers are online. To do this I want to run a
> Perl-Script who should load http://www.domain1.com/images/picture.gif,
> http://www.domain2.com/images/picture.gif .... and so on
>
> If the program can load the picture it should display Server is OK. If not,
> "Server is not online".
>
> How I can display the results is no problem, but how can I load a GIF- oder
> JPG-File??
what do you mean by load?
a far simpler way to do this is just check if you can fetch a plain
text file. if you can, the server is up, if you can't, it might
not be. that's a lot less data you have to send over the network -
especially if you are checking every five minutes.
of course, on the server side, you can have a script to restart the
server if it is not running. assuming that you are using unix, you
can check to see if there is a process with the PID that httpd
is supposed to have (kill() is useful here). if there isn't, you
relaunch the server and send yourself a page (or email, or fax, or
whatever). the best solution is one that doesn't require you to think
about it ;)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Sat, 03 Apr 1999 19:06:12 GMT
From: happyman1402@my-dejanews.com
Subject: running perl on NT IIS
Message-Id: <7e5or0$nm$1@nnrp1.dejanews.com>
thanx in advance for the help,
I'm running IIS on nt 4.0 workstation. I got perl5 for windows systems. I
have a perl script called FormMail for windows thatI need to run... how do I
install perl5 (step by step)? and how do I run my perl script? is it the same
as the unix method?
hope this isnt too hard..
thanx for reading this,
-pete
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 3 Apr 1999 20:59:17 +0400
From: "Konstantin Sugonyakin" <konst@atiss.net>
Subject: SiberLink Resume Builder
Message-Id: <7e5l3k$66l$1@hyppo.anet.donetsk.ua>
SiberLink Resume Builder is a program that will help you to create
your own resume. It will show you what data is needed, how it should
be entered, and what each resume should include. It will allow you
to exchange information between SRB users. After you've created your
resume, SRB will also allow you to print it - for your own use.
Or you can send your resume to SiberLink, Inc. to be included in
our database of specialists. Who knows? Perhaps we have a perfect
job waiting just for you!! Download this program through
the Internet, and feel free to make copies for your friends.
We at SiberLink, Inc. wish you all the best luck in your job
hunt - and don't forget to send us your resume !
You can download this program from:
http://www.siberlink.com/resumebuilder/srb.exe
------------------------------
Date: Sat, 03 Apr 1999 15:41:27 -0500
From: brian@pm.org (brian d foy)
Subject: Re: Silicon Valley Perl Mongers?
Message-Id: <brian-ya02408000R0304991541270001@news.panix.com>
In article <7e493k$rk1$1@nnrp1.dejanews.com>, hwy280@yahoo.com posted:
> Please correct if I'm wrong. But I find it really strange that there
> is NO Perl user group in Silicon Valley, where the use of Perl is
> everywhere and created such enormous wealth, and where I believe
> LW lives. Why is that? :-)
there are about 100 people registered as desiring a Perl Mongers
group in the area, but no one has stepped forward to take the
initiative. all it takes is one person willing to donate a little
time ;)
The Perl Mongers site <URL:http://www.pm.org> has all the details
that one needs to know to get a group up and running.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Sat, 03 Apr 1999 16:26:29 GMT
From: sweet@enterpriseusa.com (Rob Sweet)
Subject: Still stupid I guess.
Message-Id: <37063fa5.23558319@news.msen.com>
Thanks for the advice, but I'm still a bit stuck...
I understand how to use LWP to post data to a CGI app. But what I
need to do is to "remote control" an HTML form, such that the data
still comes from the form.
Let me give an example: (note I'm not really using yahoo, it's just
an example for discussion purposes)
Consider the default page at www.yahoo.com
This HTML page uses a form to submit a formfield named "p" to a CGI
app with the address of http://search.yahoo.com/bin/search
I know how to use LWP to automatically POST data to
http://search.yahoo.com/bin/search, with a value in "p". But that's
not what I need to do. :)
What I need to do is have a script programatically fill in the form at
www.yahoo.com and "click" submit.
Maybe LWP can do this... but I've been a good boy, I've read the docs,
I've searched Deja News, and I'm still not making any progress.
Thanks again,
Rob
>sweet@enterpriseusa.com (Rob Sweet) wrote:
>o>I need to have a Perl CGI script "automatically" fill out an HTML form
>o>and "click" submit. It seems like this shouldn't be that hard, but
>o>I've looked through CGI.pm and libnet.pm and haven't come up with
>o>anything.
>o>
>o>Oh, one more thing... There are specific reasons why I can't simply
>o>bypass the form and call the CGI that it calls, I've already examined
>o>that route.
>
>perldoc lwp
>
>You also may want to check dejanews because this question has already been
>asked and answered twice this week on c.l.p.m
>
>Good luck,
>
>Bob Trieger
>sowmaster@juicepigs.com
>
------------------------------
Date: Sat, 03 Apr 1999 16:59:01 -0500
From: brian@pm.org (brian d foy)
Subject: Re: Still stupid I guess.
Message-Id: <brian-ya02408000R0304991659010001@news.panix.com>
In article <37063fa5.23558319@news.msen.com>, sweet@enterpriseusa.com (Rob Sweet) posted:
> Thanks for the advice, but I'm still a bit stuck...
>
> I understand how to use LWP to post data to a CGI app. But what I
> need to do is to "remote control" an HTML form, such that the data
> still comes from the form.
why do you think you need to do it that way? it shouldn't matter.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Sat, 3 Apr 1999 19:14:01 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: system ('myproc &');
Message-Id: <F9Mo3D.Cuz@world.std.com>
sstarre@my-dejanews.com writes:
In this case it seems to be that Perl doesn't behave in the
>CGI environment as I would have expected.
I wouldn't quite describe it that way. The problem is not perl
dependant, it will happen on any Unix or Unix-like platform in every
language that allows access to the fork and exec system calls (even
indirectly through a call like perl's system()) You just need a better
understanding of the "CGI environment". (Or maybe the Unix
environment. Or at least spots where the two meet.) It definitely has
nothing to do with how perl "behaves." (If it did, it would be a perl
question and on-topic for this newsgroup.)
>Ala- "myproc" is a shellscript that does mailing- to thousands of club
>members, so I can't have the browser hang aroud for it to complete, hence the
>need for &.
Oh, you didn't mention that before. If you did, I would have suggested
looking into mailing list managers like majordomo, or the aliasing
capability in sendmail. You shouldn't have a script sending thousands
of identical messages.
I also would have warned against the possibilities of abuse of having
an unsecure web page that can send e-mail to thousands of people. What
if people start sending base64 copies of Linux distributions through
your e-mail gateway. (People used to threaten about uuencoded copies
of /vmunix, but most people could handle that without a problem
nowadays.)
--
Andrew Langmead
------------------------------
Date: Sat, 3 Apr 1999 15:51:12 -0500
From: "Francois Luneau" <fluneau@viconics.com>
Subject: Where could I find CGI.pm of Perl version 5.003?
Message-Id: <f7vN2.3193$o05.2503@weber.videotron.net>
I only have 5.004 or higher available to me...
Francois Luneau
fluneau@vl.videotron.ca
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 5292
**************************************