[11493] in Perl-Users-Digest
Perl-Users Digest, Issue: 5093 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 9 10:07:47 1999
Date: Tue, 9 Mar 99 07:00:31 -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 Tue, 9 Mar 1999 Volume: 8 Number: 5093
Today's topics:
Re: [HOW TO?] Strip all but certain characters from a s (Steve Grantz)
book about perl script based sql statements needed. <mfischer@tebio3.biologie.uni-stuttgart.de>
Re: book about perl script based sql statements needed. (Jonathan Stowe)
Building Perl 5 with Socket Support on Sequent/Dynix 4. bill.williams@cisco.com
Building Perl 5 with Socket Support on Sequent/Dynix 4. bill.williams@cisco.com
Re: chmod query lbrown2@uswest.net
Re: constant in Perl? (Mark-Jason Dominus)
Documents, links needed <decatomb@total.net>
FAQ 3.12: How can I use curses with Perl? <perlfaq-suggestions@perl.com>
flock / sysopen / open confusion <mymail@nospam.com>
Re: foreach question (Mark P.)
Re: Help With Code pvdkamer@inter.NL.net
help <bahjaji@iam.net.ma>
Re: Hotmail style mail system needed (Jonathan Stowe)
How to find the hostname of the visitors ashishji@hotpop.com
Re: How to find the hostname of the visitors (Jonathan Stowe)
Illiad!!!!!! (I R A Aggie)
Net::FTP through squid? <neil@mve.com>
Newbie Regularn Expression Help <pandp@ibm.net.nospam>
Re: Newbie Regularn Expression Help (Jonathan Stowe)
Perl format statement question <mymail@nospam.com>
Re: Perl format statement question (Mark-Jason Dominus)
Re: Perl format statement question <Tony.Curtis+usenet@vcpc.univie.ac.at>
Perl win32 <M.Schrier@ti.ogh.nl>
Re: Perl win32 <edwin@mindless.com.killspam>
Re: Question -- perl cgi running on local web app <dturley@pobox.com>
Re: Socket timeout not working <alexcohn@photonet.com>
Speed-optimizing regular expressions <complangperlmisc@NOSPAMTHANKS.httptech.com>
Re: split? dave@mag-sol.com
TekMetrics is offering free certifications to perl prog <mikelittman@erols.com>
What happened to Sarathy's Perl port? <edwin@mindless.com.killspam>
Re: What happened to Sarathy's Perl port? <Allan@due.net>
Re: What happened to Sarathy's Perl port? <sb@sdm.de>
Re: What happened to Sarathy's Perl port? (Jonathan Stowe)
Re: What happened to Sarathy's Perl port? (Randal L. Schwartz)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 09 Mar 1999 12:55:59 GMT
From: sgrantz@visi.com (Steve Grantz)
Subject: Re: [HOW TO?] Strip all but certain characters from a string
Message-Id: <zT8F2.266$xl4.14428@ptah.visi.com>
Jason Hatcher (Jason@InsideMedicine.com) wrote:
: I am looking for an efficient way to strip a string down to only certain
: characters.
: example "4321-8765-S" would return 43218765S
: or "4321 876A5 A S" would return 43218765S
: or "432 1876-58 " would return 432187658
The simplest way is to tranlsate:
$foo="4321-8675-S";
$foo =~ tr/0-9S//cd;
Now foo is 43218765S
The problem there is that any S's in the middle will be preserved.
For more information about how that tr works, and then how to write
something to handle S in the middle, see the man pages for perlop and perlre.
--
More of Steve Grantz's Blather at 2 * McQ != McQ
http://www.visi.com/~sgrantz 0.5 * McQ == McQ
------------------------------
Date: Tue, 09 Mar 1999 13:56:41 +0100
From: Markus Fischer <mfischer@tebio3.biologie.uni-stuttgart.de>
Subject: book about perl script based sql statements needed.
Message-Id: <36E51A89.356A5042@tebio3.biologie.uni-stuttgart.de>
Hi out there,
I'm looking for a book, which deals with the following topic:
Querying a database like Access using perl script based sql statements.
I have heard about the book Win32 Perl Programming: The Standard
Extensions by Dave Roth. Would this be a good choice?
Thanx in advance,
Markus
------------------------------
Date: Tue, 09 Mar 1999 14:18:44 GMT
From: gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: book about perl script based sql statements needed.
Message-Id: <36e52bf3.19109845@news.dircon.co.uk>
On Tue, 09 Mar 1999 13:56:41 +0100, Markus Fischer
<mfischer@tebio3.biologie.uni-stuttgart.de> wrote:
>Hi out there,
>
>I'm looking for a book, which deals with the following topic:
>
>Querying a database like Access using perl script based sql statements.
>
SQL and Perl are entirely unrelated and I would suggest that you
should choose to learn one or both separately first.
SQL as you would use in a statement in Win32::ODBC for instance is no
different in essence as you would type into SQL*plus or ISQL. The
number of Perl constructions that are likely to contain SQL statements
could be counted on one hand.
I would suggest a book on the subject you require (if such a book does
exist which I doubt) would only need be few pages long. You would be
better off reading the Access manual and then the Win32::ODBC
documentation.
>I have heard about the book Win32 Perl Programming: The Standard
>Extensions by Dave Roth. Would this be a good choice?
>
I havent read the book, but whilst it may touch on database
programming with Perl in the Win32 environment it will cover a far
wider (and possibly more interesting ) range of topics.
I would look at:
<http://reference.perl.com/query.cgi?books>
to see if there is anything of interest you there.
/J\
------------------------------
Date: Tue, 09 Mar 1999 14:07:11 GMT
From: bill.williams@cisco.com
Subject: Building Perl 5 with Socket Support on Sequent/Dynix 4.x
Message-Id: <7c39u8$bd9$1@nnrp1.dejanews.com>
Saw a post earlier regarding a similar problem, but when I build perl 5.005_02
and try to use DBI/DBD, I get the following:
carrera:/usr/local/src/perl5.005_02>perl
use Oraperl;
install_driver(Oracle) failed: Can't load
'/usr/local/lib/perl5/site_perl/5.005/i386-dynixptx/auto/DBD/Oracle/Oracle.so'
for module DBD::Oracle: dynamic linker: perl: relocation error: symbol not
found: getsockname at /usr/local/lib/perl5/5.00502/i386-dynixptx/DynaLoader.pm
line 168.
at (eval 1) line 2
at /usr/local/lib/perl5/site_perl/5.005/i386-dynixptx/Oraperl.pm line 58
Seems it's having trouble with finding the sockets symbols, which are all
present:
carrera:/usr/local/src/perl5.005_02> find /usr -name "libsocket*" -print
/usr/lib/hidesyms/libsocket.1.1.hs
/usr/lib/hidesyms/libsocket.1.hs
/usr/lib/hidesyms/libsocket.hs
/usr/lib/abi-socket/libsocket.so
/usr/lib/bsd-socket/libsocket.so
/usr/lib/libsocket.so
/usr/lib/libsocket.so.1
/usr/lib/libsocket.so.1.1
/usr/lib/libsocket.so.1.FPHL.FPOLD.1
/usr/lib/libsocket.so.1.1.FPHL.FPOLD.1
I built it with the following flags:
ccflags='-Wc,+bsd-socket'
Any ideas, tips, or hints?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 09 Mar 1999 14:08:58 GMT
From: bill.williams@cisco.com
Subject: Building Perl 5 with Socket Support on Sequent/Dynix 4.x
Message-Id: <7c3a1j$bee$1@nnrp1.dejanews.com>
Saw a post earlier regarding a similar problem, but when I build perl 5.005_02
and try to use DBI/DBD, I get the following:
carrera:/usr/local/src/perl5.005_02>perl
use Oraperl;
install_driver(Oracle) failed: Can't load
'/usr/local/lib/perl5/site_perl/5.005/i386-dynixptx/auto/DBD/Oracle/Oracle.so'
for module DBD::Oracle: dynamic linker: perl: relocation error: symbol not
found: getsockname at /usr/local/lib/perl5/5.00502/i386-dynixptx/DynaLoader.pm
line 168.
at (eval 1) line 2
at /usr/local/lib/perl5/site_perl/5.005/i386-dynixptx/Oraperl.pm line 58
Seems it's having trouble with finding the sockets symbols, which are all
present:
carrera:/usr/local/src/perl5.005_02> find /usr -name "libsocket*" -print
/usr/lib/hidesyms/libsocket.1.1.hs
/usr/lib/hidesyms/libsocket.1.hs
/usr/lib/hidesyms/libsocket.hs
/usr/lib/abi-socket/libsocket.so
/usr/lib/bsd-socket/libsocket.so
/usr/lib/libsocket.so
/usr/lib/libsocket.so.1
/usr/lib/libsocket.so.1.1
/usr/lib/libsocket.so.1.FPHL.FPOLD.1
/usr/lib/libsocket.so.1.1.FPHL.FPOLD.1
I built it with the following flags:
ccflags='-Wc,+bsd-socket'
Any ideas, tips, or hints?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 09 Mar 1999 13:28:17 GMT
From: lbrown2@uswest.net
Subject: Re: chmod query
Message-Id: <7c37l8$9c1$1@nnrp1.dejanews.com>
Your permissions should be all decimal numbers (0700, NOT uppercase o, 07OO),
for one. Try that.
-Les Brown
In article <36C1160F.588217C3@geocities.com>,
Balanone@geocities.com wrote:
> Given the code in a perl CGI program called from an HTML form page:
>
> # begin code sample
> $ofilepfx = '/usr/home/mywww/reqfiles/ureq.' ; # define path to output file
> $fpid = $$ - 1 ; # init pid
> do { $ofile = $ofilepfx . ++$fpid } until ( not -e $ofile ) ; # ensure no
> file overwrite
> $openfile = '>' . $ofile ; # flag output only
> open ( reqfile, $openfile ) || die "open of ofile failed " . $openfile ;
> print reqfile ... # data written to file here
> close ( reqfile ) ;
> $tst = chmod O700, $ofile ; # change privs on file
> print 'chmod O700, ' . $ofile . ' -- ' . $tst ; # debug print of results
> ($login,$pass,$uid,$gid) = getpwnam('xeper') ; # need numeric uid/gid
> $tst = chown $uid, $gid, $ofile ; # change ownership on file
> print 'chown ' . $uid . ', ' . $gid . ', ' . $ofile . ' -- ' . $tst ; #
> debug print of results
> # end code sample
>
> The required data is being written to the output file, but the chmod and
> chown don't work right.
>
> The chown reports
> > chown 1234, 678, /usr/home/mywww/reqfiles/ureq.5095 -- 0
> which led me to suspect that I don't have chown privileges on this system.
> Indeed, the chown shell command reports that the operation is not permitted.
> That explanation was simple.
>
> The chmod reports
> > chmod O700, /usr/home/mywww/reqfiles/ureq.5095 -- 1
> which indicates that the chmod *did* succeed, and indeed the permissions
> have been changed. But instead of changing to the desired 700 (rwx------),
> it changed to 000 (---------) -- nobody nowhere nohow has any file
> read/write/exec access.
>
> This leads me to suspect that I'm specifying the permissions number
> incorrectly. My understanding from reading the perldoc (actually
> perlfunc.html) was that chmod required a numeric (preferably octal) first
> parameter to reflect the desired permissions. So I specified O (capital
> letter o) 700. This did not produce the desired results.
>
> What did I do wrong, and what should I have done?
>
> Many thanks for your assistance.
>
> Balanone
> PP
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 9 Mar 1999 08:50:55 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: constant in Perl?
Message-Id: <7c38vv$h9i$1@monet.op.net>
In article <920940625.601487@thrush.omix.com>,
Zenin <zenin@bawdycaste.org> wrote:
> What advantage does this module have
What are you asking me for? I never said it had any advantage.
------------------------------
Date: Tue, 09 Mar 1999 08:07:42 -0400
From: "Fridirick Giasson" <decatomb@total.net>
Subject: Documents, links needed
Message-Id: <36E50F0E.3A506C6A@total.net>
Hello,
We Starded a developper site .We want our projet bigger. In this goal,
we have to improve our documents libraries and our links and newsgroups
section. We need your help to achieve this goal. If you help us, you
will help a lot of world's coders. Our goal is to help you develop
cuting edge application and never give up.
If you have some good document, link or discussion group for us please
go to http://www.decatomb.com/dev/ and send it at this URL.
thank's alot for your help
Fridirick Giasson
Programmer of Decatomb Production
fred@decatomb.com
http://www.decatomb.com
------------------------------
Date: 9 Mar 1999 05:44:04 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 3.12: How can I use curses with Perl?
Message-Id: <36e51794@csnews>
(This excerpt from perlfaq3 - Programming Tools
($Revision: 1.33 $, $Date: 1998/12/29 20:12:12 $)
part of the standard set of documentation included with every
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq3.html
if your negligent system adminstrator has been remiss in his duties.)
How can I use curses with Perl?
The Curses module from CPAN provides a dynamically loadable
object module interface to a curses library. A small demo can be
found at the directory
http://www.perl.com/CPAN/authors/Tom_Christiansen/scripts/rep;
this program repeats a command and updates the screen as needed,
rendering rep ps axu similar to top.
--
Hey, I had to let awk be better at *something*... :-)
--Larry Wall in <1991Nov7.200504.25280@netlabs.com>1
------------------------------
Date: Tue, 09 Mar 1999 07:23:43 -0500
From: JPAH-FLA <mymail@nospam.com>
Subject: flock / sysopen / open confusion
Message-Id: <36E512CF.5C6AE4E@nospam.com>
I'm confused. In a recent post by Tom Christiansen he said that another
Perl group poster had "closed the barndoor after the horses has escaped"
[1]. The person had done something like
EXAMPLE:
open F,$myfile;
flock F,$LOCK_EX;
(do file I/O)
.
.
His example was pretty much the same as the flock example in Camel [2],
so it appears that Tom is contradicting himself, unless:
(a) his example in the book also closed the barndoor too late,
(b) Mr Schwartz wrote that part of the book, or
(c) The horses are really still safe in the barn.
At any rate, the real concern is:
(a) does the EXAMPLE above really present a security concern? Is there a
risk that after between OPEN and FLOCK that the file was changed?
(b) If so, why does sysopen() solve that problem, (Tom refereces THAT
post in the one I cite)
(c) Assuming sysopen() does solve it, should Perl users ALWAYS use
sysopen() instead of open on shared aps? Is sysopen() better?
Cheers!
[1] I don't have the quote in front of me, so its a paraphrase. Great
expression though, eh?
[2] Programming Perl, O'Rielly: Christainsen and Schwartz, 1996 P
166-167
------------------------------
Date: Tue, 09 Mar 1999 12:34:59 GMT
From: mag@imchat.com (Mark P.)
Subject: Re: foreach question
Message-Id: <36e514bc.1357778281@news.ionet.net>
This should work.
$datadir = "$FORM{'datadir'}";
opendir(COP, "$datadir") || die $!;
@filenames = grep (/\.*$/i,readdir(COP));
closedir(COP);
if ($FORM{'search_string'} eq "")
{
print "Content-type: text/html\n\n";
print "<head><title>ERROR</title></head>";
print "<body><center><h3>You left the text box
blank!</h3></center>";
}
else {
print "Content-type: text/html\n\n";
foreach $file (@filenames)
{
$target = "$FORM{'search_string'}";
open(INPUT, "<$file");
while (<INPUT>) {
if (/$target/) {
print "<a
href=\"$file\">$file</a>\n";
}
}
close(INPUT);
}
}
On Mon, 08 Mar 1999 19:24:43 -0500, Aaron Walker <amwalker@gate.net>
wrote:
>hello,
>
>here's the program I have:
>
>---- start ----
>#!/usr/bin/perl
>$ls = `ls`;
>@ls_output = $ls;
>
>foreach $file (@ls_output)
>{
> print $file;
>}
>---- end ----
>
>say I'm in the directory: /home/amwalker.
>in that dir are three files: file1, file2, file3.
>
>The above script will print out:
>file1
>file2
>file3
>
>What I want is to process each file separately
>for example, say I am going to search file1 for something.
>if I use the foreach loop, then it will try to look for the file called
>"file1file2file3" but
>it won't exist. How would I go about looking at one file at a time?
>
>I hope the above is not confusing anyone :-)
>
>thanks for the help,
>Aaron
>
------------------------------
Date: Tue, 09 Mar 1999 12:02:13 GMT
From: pvdkamer@inter.NL.net
Subject: Re: Help With Code
Message-Id: <36e50d28.975509@news.wxs.nl>
Ok i'm thinking hash now for a couple of days but no luck with it yet.
Can somebody give me a clu for getting doingen this ?
Example
Best20
unique code
111111111
222222222
333333333
Best 40
unique code
111111111
111111111
111111111
222222222
222222222
Please help me on this one to get a nice smooth and fast running
program !
Thanks,
Paul van de Kamer
On Sat, 6 Mar 1999 01:15:16 GMT, Eric Bohlman <ebohlman@netcom.com>
wrote:
>pvdkamer@inter.NL.net wrote:
>: I'm not that kind of good perl programmer at all, but i need help to
>: speed up this script. This script is way to slow but i do not have the
>: knowledge to make it faster.
>: Please all the usefull comments are welcome.
>
>: Script purpose :
>
>: Compare two ascii files without delimmeters and without CTRL-LF
>: The record lenght for both file is 256 characters fixed.
>: find unique code from best20 in best40 and make a som of field $Opp
>: Compare this with the field $Oppervlakte in best20
>: If not the same print a line ......
>
>The moment you hear the word 'unique' you should think 'hash'. The
>reason your existing code is slow is that it has to make one complete
>pass over best40 for every entry in best20. With hashes, you can make
>*one* pass over best40, extracting your 'key' field and populating a hash
>with it, and then make one pass over best20, looking up each key in the hash.
>
------------------------------
Date: Tue, 09 Mar 1999 14:16:25 +0000
From: bahjaji aziz <bahjaji@iam.net.ma>
Subject: help
Message-Id: <36E52D39.2B33@iam.net.ma>
when i send my form method i have a like this in the location :
http://206.103.27.119/scripts/cgi-bin/sqlenr.plmethod=?ticket=&ologin=&opassword=&nom=&ville=&tel1=&tel2=&tel3=&tel4=&nlogin=&npassword=&npassword2=&commentaire=&Go=Submit
Please Can you help me for to see in my location only
http://206.103.27.119/scripts/cgi-bin/sqlenr.pl
whithout
method=?ticket=&ologin=&opassword=&nom=&ville=&tel1=&tel2=&tel3=&tel4=&nlogin=&npassword=&npassword2=&commentaire=&Go=Submit
------------------------------
Date: Tue, 09 Mar 1999 12:13:47 GMT
From: gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Hotmail style mail system needed
Message-Id: <36e50f8d.11839065@news.dircon.co.uk>
On Tue, 09 Mar 1999 04:51:36 GMT, bbrowning@hotmail.com (Brian
Browning) wrote:
>We are looking into adding a free email service to our consumer websites.
>Does anyone know of a cgi script or other type of program that can accomplish
>this for us.
>
This group is not really the appropriate place to be asking this
question - your program could be written in any language that is
capable of supporting CGI. If you are interested in *obtaining*
software rather than writing it you might be better off looking at one
of the freeware archives or doing a web serarch.
However if you are particularly interested in using Perl for this then
you might take a look at:
<http://reference.perl.com/query.cgi?mail>
which will have pointers that might be of help.
/J\
------------------------------
Date: Tue, 09 Mar 1999 13:17:25 GMT
From: ashishji@hotpop.com
Subject: How to find the hostname of the visitors
Message-Id: <7c370v$8s2$1@nnrp1.dejanews.com>
How could I find the Hostname of the visitors coming to the my site.
Thanks
Ashish
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 09 Mar 1999 14:21:09 GMT
From: gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: How to find the hostname of the visitors
Message-Id: <36e52de3.19605606@news.dircon.co.uk>
On Tue, 09 Mar 1999 13:17:25 GMT, ashishji@hotpop.com wrote:
>How could I find the Hostname of the visitors coming to the my site.
>
>From the server logs.
If the server log only contains IP numbers then you might need to
create a program that will do the lookups for you if you dont want to
use nslookup ...
/J\
------------------------------
Date: 8 Mar 1999 20:08:37 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Illiad!!!!!!
Message-Id: <slrn7e8bmu.bgc.fl_aggie@enso.coaps.fsu.edu>
For your viewing pleasure:
<http://www.userfriendly.org/cartoons/archives/99mar/19990308.html>.
Amusing, I guess...don't tell Randal...
James
------------------------------
Date: Tue, 09 Mar 1999 14:10:15 +0000
From: Neil Salter <neil@mve.com>
Subject: Net::FTP through squid?
Message-Id: <36E52BC7.783B9522@mve.com>
Hello,
Is it possible to get Net::FTP working through squid?
I've been trying to get the Net::FTP module to work
through the proxy. (It all works directly, but I'd like
to get it working on a machine behind the proxy cache.)
I've tried a few things...
o passing in the name of the proxy in the
options hash on ftp->new()
o setting the FTP_FIREWALL environment variable
o toying with the ftp_firewall settings in Net/Config.pm
o specifying 'proxy:portno' as the proxy, in various places
I'm winging this a bit, I know. Has anyone else managed
to do this?
I get this error a lot...
Connecting to server w7.demon.co.uk
Logging into server
Can't call method "sockport" on an undefined value at /usr/local/lib/perl5/site_perl/5.005/IP22-irix/Net/FTP.pm line 591.
...I think because I don't check the status of the connection
before I proceed with logging in.
I can find no trace of any of the attempts in squid's access.log.
I've checked DejaNews and various websites, but can't find
any info. Any help would be much appreciated.
Thanks in advance,
Neil.
------------------------------
Date: Tue, 09 Mar 1999 11:01:20 +0000 (GMT)
From: "Philip Nelson" <pandp@ibm.net.nospam>
Subject: Newbie Regularn Expression Help
Message-Id: <cnaqcvozarg.f8c4i80.pminews@news3.ibm.net>
I'm writing a little Perl script to back up my DB2 database and produce the timestamp as output.
The output produced for a successful backup reads -
Backup successful. The timestamp for this backup image is : ccyymmddhhmmss
where the xxyymmddhhmmss is the timestamp.
My question is -
How do I use a regular expression to find the timestamp and print it out.
I tried -
$out = `$backcmd`
if ($out =~ /image is : (\b.\b)/)
print $1;
but this doesn't work.
TIA
Philip Nelson
(pandp@ibm.net)
Using OS/2 Warp and PMINews
------------------------------
Date: Tue, 09 Mar 1999 12:23:07 GMT
From: gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Newbie Regularn Expression Help
Message-Id: <36e51247.12536481@news.dircon.co.uk>
On Tue, 09 Mar 1999 11:01:20 +0000 (GMT), "Philip Nelson"
<pandp@ibm.net.nospam> wrote:
>I'm writing a little Perl script to back up my DB2 database and produce the timestamp as output.
>
>The output produced for a successful backup reads -
>
>Backup successful. The timestamp for this backup image is : ccyymmddhhmmss
>
>where the xxyymmddhhmmss is the timestamp.
>
>My question is -
>
>How do I use a regular expression to find the timestamp and print it out.
>
I would try something like:
#!/usr/local/bin/perl
$blah = "Backup successful. The timestamp for this backup image is :
19990309121802";
($timestamp) = ( $blah =~ /image is : (\d+)/ );
print $timestamp,"\n";
You probably then want to go and check out the perlre manpage ...
/J\
------------------------------
Date: Tue, 09 Mar 1999 07:11:34 -0500
From: JPAH-FLA <mymail@nospam.com>
Subject: Perl format statement question
Message-Id: <36E50FF6.A3009370@nospam.com>
Hello. I'm using perl to render a HTML doc, and format statements are
very good at table tags. However, I'm running into one small problem in
that the field descriptor is conflicting with the HTML tag, for
instance:
format LISTF =
<tr>
<td align="center">@###### </td>
$conf
<td align="center" colspan="2"> @<<<</td>
$dev
the problem is that the field for $dev is considered to be @<<<<, then
meaningless /td> is appended to it. Of course I really wanted the field
to be @<<< and the </td> appended.
I'm getting around this by adding a space like:
<td align="center" colspan="2"> @<<< </td>
but are there other more appropriate solutions? The space throws off
column centre and width.
Cheers, & Thank-You for considering this question.
------------------------------
Date: 9 Mar 1999 08:58:58 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Perl format statement question
Message-Id: <7c39f2$hfl$1@monet.op.net>
In article <36E50FF6.A3009370@nospam.com>, JPAH-FLA <mymail@nospam.com> wrote:
>format LISTF =
><td align="center" colspan="2"> @<<<</td>
>$dev
>
>the problem is that the field for $dev is considered to be @<<<<,
I can't help thinking there is a better answer, but the only thing
that comes to mind is
$lbrac = '<';
format LISTF =
<td align="center" colspan="2"> @<<<@/td>
$dev,$lbrac
------------------------------
Date: 09 Mar 1999 15:17:34 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Perl format statement question
Message-Id: <83n21magsh.fsf@vcpc.univie.ac.at>
Re: Perl format statement question, JPAH-FLA
<mymail@nospam.com> said:
JPAH-FLA> Hello. I'm using perl to render a HTML
JPAH-FLA> doc, and format statements are very good
JPAH-FLA> at table tags. However, I'm running into
JPAH-FLA> one small problem in that the field
JPAH-FLA> descriptor is conflicting with the HTML
JPAH-FLA> tag, for instance:
But formats are good for forcing a particular fixed
layout. That isn't what HTML does.
JPAH-FLA> format LISTF = <tr> <td
JPAH-FLA> align="center">@###### </td> $conf <td
JPAH-FLA> align="center" colspan="2"> @<<<</td> $dev
JPAH-FLA> but are there other more appropriate
JPAH-FLA> solutions? The space throws off column
JPAH-FLA> centre and width.
I would use the HTML shortcuts from CGI.pm
use CGI qw(:html3 ....);
print table({options},
TR(td({align => 'center'}, $field1) .
td({align => 'center', colspan => 2}, $field2)
),
....
);
Then there's no problems with perl / HTML syntax
clashes.
hth
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien. | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Tue, 09 Mar 1999 14:04:48 +0100
From: Martijn Schrier <M.Schrier@ti.ogh.nl>
Subject: Perl win32
Message-Id: <36E51C70.48694925@ti.ogh.nl>
Does anybody know if it is possible to make a little GUI Program for
Windows 95/98 with the Perl (Win32 edition) ??
Tnx
Martijn Schrier
--
OnderwijsGroep Haaglanden Afd. Technische Informatica
Marcellus Emantslaan 19 - 2274 XL - Voorburg - The Netherlands
Tel: +31(0)70-3009900 - Fax: +31(0)70-3009910
Email: M.Schrier@ti.ogh.nl - Web: http://www.ti.ogh.nl
------------------------------
Date: 9 Mar 1999 12:14:01 GMT
From: Edwin van Geelen <edwin@mindless.com.killspam>
Subject: Re: Perl win32
Message-Id: <8D849D18Fedwinmindlesscomkill@news.ing.nl>
Martijn Schrier <M.Schrier@ti.ogh.nl> wrote in
<36E51C70.48694925@ti.ogh.nl>:
> Does anybody know if it is possible to make a little GUI Program for
> Windows 95/98 with the Perl (Win32 edition) ??
If you have Gurusamy Sarathy's port, you also have PerlTk, which offers a
GUI for Perl. I don't know much about it, but the few simple things I've
tried worked OK.
Edwin
------------------------------
Date: Tue, 09 Mar 1999 12:50:50 GMT
From: David Turley <dturley@pobox.com>
Subject: Re: Question -- perl cgi running on local web app
Message-Id: <7c35f8$7o1$1@nnrp1.dejanews.com>
In article <7c0u9j$elb1@valley.rtpnc.epa.gov>,
"William Smith" <smith.will@epa.gov> wrote:
> I want to distribute a web app on CD so the users can run it locally. The CD
> would contain perl and all data the the web app requires. The web app uses a
> perl cgi and I want the cgi to run on the local machine and send the html
> back to the browser. Is there a way to do this other than running server
> software on the local machine?
Look at MicroWeb at http://www.demobuilder.com/
It does what you want I beleive.
This si not an endorsement, simply a pointer. You decide.
--
David Turley
dturley@pobox.com
http://www.binary.net/dturley
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 09 Mar 1999 14:33:10 +0200
From: Alex Cohn <alexcohn@photonet.com>
To: Curtis Cameron <curtisc1@cyberramp.net>
Subject: Re: Socket timeout not working
Message-Id: <36E51505.5F2A021E@photonet.com>
Curtis, I too found a problem with connect timeout on Sun. I'll discuss only
the first approach of yours, because I know nothing about IO:Socket and am
afraid that its authors fell in one of the same traps that we did.
Problem number one is that your alarm handler may keep the system inside
connect(). To work around this, consider putting connect() inside an eval {}
block, send a die() in the handler and catch it outside:
sub connectserver
{
local $SIG{ALRM} = sub { die "connect timeout"; };
alarm 10;
my ($connect, $timeout) = (0, 0);
eval { $connect = connect(SOCK, $_[0]) };
if ($@) {
if ($@ eq "connect timeout") {
$timeout = 1;
} else {
# something was really wrong
$connect = 0;
}
}
$SIG{ALRM} = undef; alarm 0; # reset ALRM trap
($connect,$timeout);
}
This approach works for me on SunOS 5.5.1. But I found that on 5.6 connect
succeeded immediately and I had to enclose the first read or write operation
inside the ALRM trap. I don't know why the two versions behave differently.
Best regards,
Alex
Curtis Cameron wrote:
> Hi All,
>
> One of the things my web page does is to open a socket connection to
> another computer. I would like the "connect" to timeout after 10 or 15
> seconds, since that's enough time to determine that the other computer
> isn't there, and I don't want a user waiting three or four minutes to
> see the results on his web request.
>
> So I've tried two different methods which I learned from the perl
> newsgroups. I've tested them successfully on an HP-UX system running
> NCSA/1.2 (both work great). However, it needs to be on another server,
> a Sun running Apache/1.2.6 and Perl 5.004_04, and neither technique
> will timeout after just 10 seconds on that system. The scripts both
> work, except that if they timeout, they do so after a few minutes
> instead of the 10 seconds I want.
>
> Is there a limitation of this Apache version?
>
> Posted below are the perl programs.
>
> thanks,
>
> Curtis Cameron
>
> # ----------------- perl technique #1 - $SIG{"ALRM"}
> my ($timeout,$connect);
>
> sub connectserver
> {
> $SIG{"ALRM"} = 'sig_alrm_connect';
> alarm 10; $timeout = 0; # timeout after 10 sec
> $connect = connect(SOCK, $_[0]) ? 1 : 0;
> $SIG{"ALRM"} = ''; alarm 0; # reset ALRM trap
> ($connect,$timeout);
> }
>
> sub sig_alrm_connect { $timeout = 1;}
>
> $port = 3634;
> $iaddr = inet_aton($ip) || seterror("Computer not found: $ip");
> $paddr = sockaddr_in($port, $iaddr);
> $proto = getprotobyname('tcp');
> socket(SOCK, PF_INET, SOCK_STREAM, $proto);
> connectserver($paddr);
> close(SOCK);
> if ($connect == 0) { if ($timeout == 1) { seterror("The socket
> timed out before a connection to the computer was made.") }
> else { seterror("Socket error: $!") }
>
> # ----------------- perl technique #2 - IO::Socket
> use IO::Socket;
>
> $sock = new IO::Socket(
> PeerAddr => $ip,
> PeerPort => 3634,
> Timeout => 10, # seconds
> Domain => AF_INET,
> Proto => 'tcp'
> ) or die "$@";
> print "I guess we connected!\n";
------------------------------
Date: Tue, 09 Mar 1999 14:44:50 GMT
From: Joe Stewart <complangperlmisc@NOSPAMTHANKS.httptech.com>
Subject: Speed-optimizing regular expressions
Message-Id: <36E7B21043DFDD2A.59D741B1943B44C0.D18D6F4D90825555@library-proxy.airnews.net>
I have a webserver running 250+ virtual hosts. In order
to free up file handles we have stopped running separate
logfiles for each client, instead logging everyone to a
single rotated logfile, with their hits prefixed by the
domain name of the virtual server it belongs to.
Now, once a day we are running a perl script to separate
the 30-50 meg master logfile into per-domain logfiles.
The code I am using looks like this:
$domain = $ARGV[0];
open (IN, "master_access_log") || die "Couldn't open master log!\n";
open (OUT, "$domain_access_log") || die "Couldn't open $domain access log!\n";
while (<IN>) {
if (s/$domain //o) {
print OUT;
}
close (OUT);
close (IN);
This works, but it is painfully slow; taking between 10 and
20 seconds per host, depending on the size of the logfile that day.
The standard unix grep works much faster, on the order of 2 seconds,
but while I am matching the domain names I also need to remove the
domain name from each log hit, because it is not a part of the standard
log format that analysis software would recognize or handle well.
Can anyone suggest a more optimized way to split a large logfile while
also removing the domain name prefix on each line?
Thanks,
-Joe
------------------------------
Date: Tue, 09 Mar 1999 11:11:57 GMT
From: dave@mag-sol.com
Subject: Re: split?
Message-Id: <7c2vlp$37c$1@nnrp1.dejanews.com>
In article <7c1fnh$qbg$1@nnrp1.dejanews.com>,
bing-du@tamu.edu wrote:
> Hello there,
>
> There is a string $test = "3:http://www.test.edu/building.html".
>
> How to split this string to get two parts. One is "3" and the other is
> "http://www.test.edu/building.html"?
>
> I tried the command:
>
> ($first, $second) = split(/:/,$test);
>
> Then $first is "3". However $second is just "http" instead of
> "http://www.test.edu/building.html" which is what I want.
>
> Any idea? Thanks in advance.
'split' has a third parameter, which you can read about in 'perldoc perlfunc'
or 'perldoc -f split'.
#!/usr/local/bin/perl -w
use strict;
my $test = "3:http://www.test.edu/building.html";
my ($first, $second) = split(/:/, $test, 2);
print "1 - $first\n2 - $second\n";
--
Dave Cross
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 09 Mar 1999 08:56:12 -0500
From: Michael Littman <mikelittman@erols.com>
Subject: TekMetrics is offering free certifications to perl programmers...
Message-Id: <36E5287B.37746AD2@erols.com>
Dear perl programmer,
For a limited time, TekMetrics is offering free 'perl programmer'
certifications through it's internet-based CAT engine. Simply go to
http://www.tekmetrics.com/cert/certtop.html to order your free
certification. You can either elect to take the test right away, or
come back later, using the PIN you are provided when you order.
To qualify as a Certified perl programmer, you must pass the examination
with a score of 2.75 or higher. To be certified as a Master perl
programmer, you must obtain a score of 4.00 or higher. At the end of
the test, your score will be provided (with a scoring range of 1-5).
Once certified, you can add the logo associated with the test (standard
or master logo, depending on how well you do) to your resume or
website. Furthermore, those that pass will be mailed a certificate,
once again, at no cost. There's no catch. We're simply trying to prove
a concept during a beta trial period. Thus far, the feedback has been
extremely positive!
Why bother getting certified by TekMetrics?
1) More and more corporations recognize TekMetrics Certifications as an
indication not only of the technical workers knowledge level, but also
as an indicator that they were willing to demonstrate their skills to
them.
2) It's free and it's fun. They won't be free forever, but they are
now. So take advantage of them. Furthermore, those who have completed
the tests generally indicate that they enjoyed the experience and
considered both the delivery of the test and the items themselves to be
of high quality.
3) 2000 technical workers from around the world are ordering our
certifications each week, and that number is steadily rising. To see
the specific figures, go to the bottom of the 'certifications' link off
the homepage.
4) Strut your stuff. See if you are good enough to make the top 10
list.
5) Find out both your strengths and weaknesses in 'perl programming'.
At the end of the test, you can request specifics on how you did, by
subtopic. And yes, that too is free.
All we ask for in return is your feedback at the end of the exam. We
will be continually focusing on the improvement of the delivery of the
test and quality of the questions. Any feedback you can provide,
positive or negative, will help us greatly.
Another FAQ is, "How do you know the person who supposedly took the test
was actually the same person? What if it was his hotshot 'perl
programmer' brother, sister or friend? In other words, what is to
prevent him from cheating?" Our solution: we allow employers to
spotcheck the technical workers with a short test at no cost at their
corporate locations, if they so choose. Corporations have unanimously
applauded this solution.
Lastly, data you provide in the certification process is not used
without your permission other than to store your certification record
and verify to valid employers at their request. We do, however, publish
names on our site in a Top Ten Scores list for each category, but no
addresses, phone numbers, email, etc.. are shown. For more information,
see our privacy statement at
http://www.tekmetrics.com/cert/privacy.html
Well, that's pretty much it! We're trying to establish a new
cost-effective and convenient alternative to today's certification
environment. During this beta trial period, you will be the benefactor
of this fun and challenging experience.
If you have any questions/concerns regarding the 'perl programmer'
certification, please do not hesitate to contact me.
Good luck!
Mike
Michael Littman
VP Operations
TekMetrics, Inc.
www.tekmetrics.com <http://www.tekmetrics.com>
mike.littman@tekmetrics.com <mailto:mike.littman@tekmetrics.com>
------------------------------
Date: 9 Mar 1999 12:12:23 GMT
From: Edwin van Geelen <edwin@mindless.com.killspam>
Subject: What happened to Sarathy's Perl port?
Message-Id: <8D8490971edwinmindlesscomkill@news.ing.nl>
Hi,
I've always used Gurusamy Sarathy's Perl port for Win32, but now that I
wanted to download 5.005 (I'm running 5.004), I can't find it anymore on
Perl.com
Is it just not ready yet, or are there other reasons not to show it
anymore? I've always been very happy with it, which is more than I can say
about ActiveState's port.
Edwin
------------------------------
Date: Tue, 9 Mar 1999 08:50:10 -0500
From: "Allan M. Due" <Allan@due.net>
Subject: Re: What happened to Sarathy's Perl port?
Message-Id: <7c38hq$oe$1@camel19.mindspring.com>
Edwin van Geelen wrote in message
<8D8490971edwinmindlesscomkill@news.ing.nl>...
:Hi,
:I've always used Gurusamy Sarathy's Perl port for Win32, but now that I
:wanted to download 5.005 (I'm running 5.004), I can't find it anymore on
:Perl.com
:Is it just not ready yet, or are there other reasons not to show it
:anymore? I've always been very happy with it, which is more than I can say
:about ActiveState's port.
Well, then you may be happy to learn that he now works for Activestate. <g>
http://www.activestate.com/press/releases/sarathy.htm
HTH
AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
If a man does not keep pace with his companions, perhaps it is because he
hears a different drummer. Let him step to the music which he hears, however
measured or far away.
- Thoreau
------------------------------
Date: 9 Mar 1999 14:02:55 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: Re: What happened to Sarathy's Perl port?
Message-Id: <7c39mf$sq3$1@solti3.sdm.de>
In article <8D8490971edwinmindlesscomkill@news.ing.nl>,
Edwin van Geelen <edwin@mindless.com.killspam> wrote:
> I've always used Gurusamy Sarathy's Perl port for Win32, but now that I
> wanted to download 5.005 (I'm running 5.004), I can't find it anymore on
> Perl.com
> Is it just not ready yet, or are there other reasons not to show it
> anymore? I've always been very happy with it, which is more than I can say
> about ActiveState's port.
You can still find it under the URL
http://www.perl.com/CPAN/authors/id/GSAR/perl5.00402-bindist04-bc.tar.gz
or, if this should fail, under
http://www.engelschall.com/u/sb/download/pkg/perl5.00402-bindist04-bc.tar.gz
But please, only use the latter address as a last resort!
Thank you very much!
Regards,
--
Steffen Beyer <sb@engelschall.com>
http://www.engelschall.com/u/sb/download/ (Free Perl and C Software
http://www.perl.com/CPAN/authors/id/STBEY/ for Download)
New: Build'n'Play 2.1.0 (all-purpose Unix batch installation tool)
http://www.oreilly.de/catalog/perlmodger/bnp.html
------------------------------
Date: Tue, 09 Mar 1999 14:09:42 GMT
From: gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: What happened to Sarathy's Perl port?
Message-Id: <36e52a47.18682115@news.dircon.co.uk>
On 9 Mar 1999 12:12:23 GMT, Edwin van Geelen
<edwin@mindless.com.killspam> wrote:
>Hi,
>
>I've always used Gurusamy Sarathy's Perl port for Win32, but now that I
>wanted to download 5.005 (I'm running 5.004), I can't find it anymore on
>Perl.com
>Is it just not ready yet, or are there other reasons not to show it
>anymore? I've always been very happy with it, which is more than I can say
>about ActiveState's port.
>
You havent being attention now have you ;-}
The Activestate port is generally now considered to have 'standard'
status and is based on the same code as you would get in the source
distribution for 5.005.02.
Gurusamy Sarathay now works for ActiveState and I dont believe there
are any plans to bring out another binary distribution for Win32 other
than ActiveState. Except for those who have compiled their own the
vast majority of people who are using 5.005.02 on Win32 are using
ActiveState and I for one havent noticed many complaints about it.
Go to <http://www.activestate.com/ActivePerl/>
/J\
------------------------------
Date: 09 Mar 1999 06:33:23 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: What happened to Sarathy's Perl port?
Message-Id: <m17lsqbumk.fsf@halfdome.holdit.com>
>>>>> "Edwin" == Edwin van Geelen <edwin@mindless.com.killspam> writes:
Edwin> I've always used Gurusamy Sarathy's Perl port for Win32, but
Edwin> now that I wanted to download 5.005 (I'm running 5.004), I
Edwin> can't find it anymore on Perl.com Is it just not ready yet, or
Edwin> are there other reasons not to show it anymore? I've always
Edwin> been very happy with it, which is more than I can say about
Edwin> ActiveState's port.
If I get the story right (since I'm not required to use win32 by my
PHB, I don't know much about it :), Sarathy is now *working* for
ActiveState, and had a hand in the 5.005 ActiveState release. So, for
the moment, the ActiveState port *is* the Sarathy port.
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
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 5093
**************************************