[11320] in Perl-Users-Digest
Perl-Users Digest, Issue: 4920 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 17 16:07:31 1999
Date: Wed, 17 Feb 99 13:00:27 -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 Wed, 17 Feb 1999 Volume: 8 Number: 4920
Today's topics:
can i use perl to filter NT event viewer logs? <guadomatic@hotmail.com>
Re: Datetime manipulation in perl Charles_Long@Dell.com
Re: Help,Perl Script doesn't work! droby@copyright.com
Re: How to replace a string by another (Larry Rosler)
how to see if one string is in another? <getalife@nospam.com>
Re: how to see if one string is in another? <jglascoe@giss.nasa.gov>
Re: How2 ! Expand Command Line Argument Wildcards? <tchrist@mox.perl.com>
Re: MASS EMAIL (Greg Ward)
need a clearer explanation of ${1} use in s///i <cook@mediaone.net>
Re: need a clearer explanation of ${1} use in s///i <jglascoe@giss.nasa.gov>
Newbie Question <hughema1@mail.northgrum.com>
Re: Newbie Question <ludlow@us.ibm.com>
Re: Parsing (Bart Lateur)
Re: Perl Book <jglascoe@giss.nasa.gov>
Perl classes in Houston? <mkersey@metricom.com>
Perl install on Solaris 2.6 <jpcrisci@mailnwql.cr.usgs.gov>
Re: PFR: mkpath (Was: Re: How to create a directory usi (Steve Linberg)
Re: PFR: UTC_to_Epoch <tam@silk.gsfc.nasa.gov>
Re: print: location not working? (brian d foy)
Real-time Browser Updating <cbucher@tampabay.rr.com>
Re: Real-time Browser Updating <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Real-time Browser Updating <dhenders@cpsgroup.com>
Re: regex poll (Ilya Zakharevich)
Re: regex poll <uri@sysarch.com>
Re: regex poll (Steve Linberg)
Re: regex poll (Chris Nandor)
Regular Expression Help <dkubilo@oxnardsd.org>
Socket problems with 5.005_2 on Solaris 2.7 <richard_england@mentorg.com>
Re: Speed Up Perl <tchrist@mox.perl.com>
Subroutines and variables cory@techlounge.com
Using system in NT to move files dgeller@cahners.com
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 17 Feb 1999 11:06:42 -0800
From: "eric" <guadomatic@hotmail.com>
Subject: can i use perl to filter NT event viewer logs?
Message-Id: <7af66s$fn4@news.or.intel.com>
Does anyone have scripts to filter event viewer logs on
Windows NT? In particular, I'm looking for something to
pull out logon/logoff attempts. Can I do this with perl,
or do I have to resort to C?
Eric
------------------------------
Date: Wed, 17 Feb 1999 20:33:05 GMT
From: Charles_Long@Dell.com
Subject: Re: Datetime manipulation in perl
Message-Id: <7af921$l4t$1@nnrp1.dejanews.com>
hi, the 2nd ed blue camel lists Time::Local as containing timelocal() to
go from textual string to a time() format i.e. mmddyy to ssssssssss UNIX-like
stamp. i have searched Activestate and CPAN for this module to no avail.
did they depreciate this? does anyone have such a module. again, to do the
opposite of localtime().
any help greatly appreciated,
CHARLES
In article <7ac6tr$ufh$1@nnrp1.dejanews.com>,
droby@copyright.com wrote:
> In article <7a6d7u$7hl$1@nnrp1.dejanews.com>,
> sharda@hotmail.com wrote:
> > hi everybody,
> >
> > I am writing perl code which reads the datetime which are sent by the
email
> > headers and then stores it into the database.The acceptable database format
> > is: mm/dd/yyyy hh:mm:ss
> >
> > I am not able to write a module which can take care of all possible
> > datetime formats.
> >
>
> Indeed you're not able to write such a module. Nor am I. Nor anyone else.
>
> > For example:
> >
> > Day can be : 01 OR 1
> >
> > Month can be: Feb OR February OR 02 OR 2
> >
> > Year can be : 99 OR 1999
> >
> > Hence a data could be: 08 2 03 12:12:12
> >
>
> Which could be interpreted as August 2, 1903, March 2, 1908, February 8, 1903,
> etc... for I think a total of 6 possibilities (in this case) ignoring the
> century problem.
>
> There is no context to disambiguate these
>
> > Now, in this, how to find out which is month, which is day and which is
> > year? :(
> >
> > I cannot restrict the format to a particular type.
> >
>
> You need to restrict the format.
>
> If the dates are from mail headers you should be able to restrict the format.
> Consult RFC822 and its Y2K update in RFC1123. These documents give very
> specific syntax for date and time specification in headers.
>
> If your mail is Internet-based it should adhere to this syntax, and the dates
> should be quite easy to parse unless you have to deal with time-zones.
And
> if they were mailed in this decade they should have a four digit year
> (RFC1123 only said SHOULD, not MUST, but it only makes sense...)
>
> > Any idea on this will be highly appreciated.
> >
>
> Context is everything. Hope this helps.
>
> --
> Don Roby
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 17 Feb 1999 19:51:48 GMT
From: droby@copyright.com
Subject: Re: Help,Perl Script doesn't work!
Message-Id: <7af6kf$irm$1@nnrp1.dejanews.com>
In article <MPG.11347c0e4067f67989a4e@nntp.hpl.hp.com>,
lr@hpl.hp.com (Larry Rosler) wrote:
> In article <Webmaster-1602992208550001@whaserv.demon.co.uk> on Tue, 16
> Feb 1999 22:08:55 +0000, Simon Roulstone <Webmaster@KILL-MEquorndon-
> mag.org.uk> says...
> > Do I take it `perldoc -f binmode` is a bit of code I should insert into my
> > script somewhere?, like I said I'm very new at all this stuff.
>
> It is shorthand used in this newsgroup, aiming you at the documentation
> of the Perl function 'binmode'. As written, it is a command that
> executes on a Unix-based system.
perldoc -f binmode also works as an NT command with ActiveState Perl build
508.
And ActiveState distributes full documentation.
--
Don Roby
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 17 Feb 1999 12:08:13 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to replace a string by another
Message-Id: <MPG.1134c18578c2af72989a52@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7aet1l$856$1@jaydee.iway.fr> on Wed, 17 Feb 1999 18:08:11
+0100, Vincent BEZARD <vbezard@atos-group.com> says...
> I would like to replace a string by another in a variable. For example, I've
> got the string named A$, witch containe "cats:dogs", and I would like to
> have "cats hats dogs".
You program too much in Basic ('A$' indeed!). This question is so Basic
that you need to read a Perl primer, such as "Learning Perl".
$A =~ s/(cats):(dogs)/$1 hats $2/;
is one of several ways to do it. Read about Regular Expressions --
you'll grow to love them. They are your friends!
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 17 Feb 1999 15:26:15 -0500
From: "Alan_Barber" <getalife@nospam.com>
Subject: how to see if one string is in another?
Message-Id: <7af8s7$6nc@woody.wcnet.org>
Below is sort of what i'm trying to do. I want to make sure that the script
will only run if it is called from my site. so I need a way to see if
$mysite apprears in $refer
Thanks
--------
$mysite = 'http://www.mysite.com' ;
$refer = $ENV('HTTP_REFERER'); #pretend that it contains
'http://www.mysite.com/something.html
if ($refer contains $mysite)
{ do some stuff if it does }
do other stuff if it doesn't
--------
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Alan P. Barber ICQ - 6042212
advancedbasic (at) postmaster.co.uk
http://advancedbasic.hypermart.net
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: Wed, 17 Feb 1999 15:43:33 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: Alan_Barber <getalife@nospam.com>
Subject: Re: how to see if one string is in another?
Message-Id: <36CB29F5.9B2418BA@giss.nasa.gov>
[courtesy copy of post sent via email]
Alan_Barber wrote:
>
> Below is sort of what i'm trying to do.
...
> if ($refer contains $mysite)
print "biz!\n" if $refer =~ /^$mysite/;
perldoc -f s
perldoc perlop (see the Regexp Quote-Like Operators section)
Jay Glascoe
--
"Even if you do learn to speak correct English,
whom are you going to speak it to?"
--Clarence Darrow
------------------------------
Date: 17 Feb 1999 08:03:15 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How2 ! Expand Command Line Argument Wildcards?
Message-Id: <36cada33@csnews>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Richard Bobo <rbobo@spd.dsccc.com> writes:
:I am trying to use command line arguments that can have wild cards, but
:I don't want them expanded in @ARGV because I want to expand them later
:while accessing a remote file system. How can I get the raw or
:unexpanded command line that launched the perl script? Thanks in
:advance for you help.
You make the user quote the command line.
$ cmd "this is the whole line"
Otherwise the shell will have expanded it. Consider:
$ find /tmp -name '*.[Cch]' -print
or
$ rename 's/\.[Ff]$/.BAD/' */*
It's the job of your shell to expand wildcards. If you don't like that,
it's the job of the user to quote the arguments, or write his own shell.
Of course, non-expanding shells are a giant step 30 years backwards
technologically speaking. It's fundamentally wrong.
--tom
--
"Yes, you can think of almost everything as a function, but this may upset
your wife." --Larry Wall
------------------------------
Date: 17 Feb 1999 20:47:15 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: MASS EMAIL
Message-Id: <7af9sj$3oe$1@news0-alterdial.uu.net>
Christopher Pieper <curweb@cur.org> wrote:
> Ok so I have a task of send 3000 or so people one email. Now I have found
> that my best bet is to use a perl script and the sendmail function. is this
> sound?
First of all, if this is unsolicited email, of a commercial nature or
otherwise, then DO NOT DO THIS. Do not use ANY tool to send unsolicited
mass email. If you do, you will find your ISP overwhelmed by
complaints, and your net access will be cut off so fast it'll make your
head spin.
However, I'll give you the benefit of the doubt and assume you have
reason for doing this, and that the 3000 people have asked to receive
mail from you, and know that they will be receiving mail from you.
Since you said "sendmail", I'll assume you're on a Unix platform.
Technically, sendmail isn't a function, it's a program -- in particular
it's the most widely used mail transfer agent (MTA) on the Internet, and
on Unix systems in particular. If you wish to send mail from a script,
sendmail is usually the easiest way to go: just open a pipe with
sendmail reading and your script writing, and write the message content
(and probably a few headers) to the pipe.
Here's a simple example that will NOT work for 3000 addresses
(command-line length limitations).
open (SENDMAIL, "|/usr/lib/sendmail @addresses") ||
die "couldn't open pipe to sendmail: $!\n";
print SENDMAIL <<MSG;
Subject: Hello
Hello,
this is email sent to everyone on the following list:
@addresses
MSG
close (SENDMAIL)
warn "sendmail failed\n" unless $? == 0;
Read the fine documentation for 'open' to understand what I'm doing here.
If you're interested, I wrote a little script that does this in a fairly
optimal way, by running sendmail in several discrete batches. This
avoids starting one sendmail for every address (which you really *don't*
want to do -- it'll absolutely clobber your system performance on a
3000-long list), but also steps around problems with command-line length
limitations that the above simple solution would have.
Email me if you want it -- for obvious reasons, I'm not going to post my
"bulkmail" script to USENET. ;-)
Alternately, you could use the Net::SMTP module and roll-your-own
mini-MTA. It'll take longer to write, though, and require more code.
Greg
--
Greg Ward - software developer gward@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990 x287
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
------------------------------
Date: Wed, 17 Feb 1999 15:06:07 -0500
From: edgar <cook@mediaone.net>
Subject: need a clearer explanation of ${1} use in s///i
Message-Id: <36CB212F.249C3C39@mediaone.net>
The code does change the spelling from Pearl to Perl.
what does ${1} and variations do ? and/or where do I find it.
The following is a copy of tested code from faq5 with changes.
'in.txt' has at least one line with the string ' Pearl '
#!/usr/bin/perl -w
use strict;
my $file = 'in.txt';
my $old = $file;
my $new = "$file.$$";
my $bak = "$file.bak";
open(OLD, "< $old") or die "can't open $old: $!";
open(NEW, "> $new") or die "can't open $new: $!";
# Correct typos, preserving case
while (<OLD>) {
s/\b(p)earl\b/${1}erl/i;
(print NEW $_) or die "can't write to $new: $!";
}
close(OLD) or die "can't close $old: $!";
close(NEW) or die "can't close $new: $!";
rename($old, $bak) or die "can't rename $old to $bak: $!";
rename($new, $old) or die "can't rename $new to $old: $!";
thanx
(Just Another Cookie) Cook
------------------------------
Date: Wed, 17 Feb 1999 15:35:24 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: edgar <cook@mediaone.net>
Subject: Re: need a clearer explanation of ${1} use in s///i
Message-Id: <36CB280C.3CE34234@giss.nasa.gov>
[cited author, edgar, receives one (1) courtesy copy of post via email]
edgar wrote:
> [some stuff...]
> what does ${1} and variations do ? and/or where do I find it.
...
> s/\b(p)earl\b/${1}erl/i;
${1} refers to the text captured by the first pair of parentheses.
so does $1 and \1 (but "\1" is deprecated ?? not sure.)
you really should "perldoc perlre":
When the bracketing construct ( ... ) is used, \<digit>
matches the digit'th substring. Outside of the pattern,
always use "$" instead of "\" in front of the digit. (While
the \<digit> notation can on rare occasion work outside the
current pattern, this should not be relied upon. See the
WARNING below.)
------------------------------
Date: Wed, 17 Feb 1999 19:14:13 GMT
From: "neil" <hughema1@mail.northgrum.com>
Subject: Newbie Question
Message-Id: <F7BC1p.xG%mother@herald.northgrum.com>
Can Perl be run on a Windows 98 system ?
------------------------------
Date: Wed, 17 Feb 1999 14:24:43 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: Newbie Question
Message-Id: <36CB258A.F72E8263@us.ibm.com>
neil wrote:
> Can Perl be run on a Windows 98 system ?
www.activestate.com
www.perl.com
www.dejanews.com
search.yahoo.com/bin/search?p=perl+windows
--
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)
------------------------------
Date: Wed, 17 Feb 1999 18:33:54 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Parsing
Message-Id: <36d00b18.36291858@news.skynet.be>
Tom Renic wrote:
>Thank you both for your help but for some reason it still won't work,
>the output I get is:
>
>Tom Renic~trenic@nortelnetworks.com~123456~Tom Renic~123 Easude Way
>,Dallas, Texas
>,1232~Tom Renic~...
>
>Rather than:
>
>Tom Renic~trenic@nortelnetworks.com~123456~Tom Renic~123 Easude Way,
>Dallas,
>Texas, 1232~Tom Renic~...
Probably there's still a CR in there. Kill 'em. Kill'em all.
tr/\r//d;
But personally, I'd prefer replacing newlines with a space, not wit ha
comma.
tr/ \r\n/ /s;
The "s" makes sure there are no two spaces in a row.
Bart.
------------------------------
Date: Wed, 17 Feb 1999 13:37:03 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: symzhang@yahoo.com
Subject: Re: Perl Book
Message-Id: <36CB0C4F.EEA17D3A@giss.nasa.gov>
hello again Stephen,
here's some Perl sites:
http://reference.perl.com/query.cgi?tutorials+index
http://language.perl.com/info/documentation.html
Stephen ZHANG wrote:
>
> Hi Folks,
>
> I am looking for a free e-format Perl Book on the Internet. If someone
> the Web Site, please let me know. Thanks a lot!
Jay Glascoe
--
"Even if you do learn to speak correct English,
whom are you going to speak it to?"
--Clarence Darrow
------------------------------
Date: Wed, 17 Feb 1999 13:09:17 -0600
From: Michael Kersey <mkersey@metricom.com>
Subject: Perl classes in Houston?
Message-Id: <36CB13DD.FCC1F269@metricom.com>
or Texas for that matter?
TIA,
Michael D. Kersey
------------------------------
Date: Wed, 17 Feb 1999 19:10:59 GMT
From: "John P. Crisci" <jpcrisci@mailnwql.cr.usgs.gov>
Subject: Perl install on Solaris 2.6
Message-Id: <36CB1443.CF1D8EF4@mailnwql.cr.usgs.gov>
I am installing Perl on Solaris 2.6. We have the SUN C compiler on this system - not
GNU C. In the Generic nots section, it states Do not use /usr/ucb/cc.
This is where the C compiler is. Was there a reason why this statement was added into
the hints file?
TIA
------------------------------
Date: Wed, 17 Feb 1999 13:36:14 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: PFR: mkpath (Was: Re: How to create a directory using perl on linux?)
Message-Id: <linberg-1702991336140001@ltl1.literacy.upenn.edu>
In article <m3btiy9nml.fsf@moiraine.dimensional.com>, Daniel Grisinger
<dgris@moiraine.dimensional.com> wrote:
> How general should the repository's contents be? Should we avoid
> anything that already has a better implementation elsewhere, or should
> we celebrate TMTOWTDI? In cases (like mkpath) where a good other
> solution exists should I just put a pointer to the appropriate modules
> into the repository?
I'd opine that more is better, if you're willing to do the housekeeping. :)
If there's scheduling/maintenance room to include a note about related
modules on things in the repository, I think that might be the ideal
solution. I like to look at good code, even if modules are available...
and yes, I know I can look at the module code, but who knows, someone
might discover better ways of thing things than are in the modules, or
someone might get an idea for creating one after looking at an online
snippet.
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: Wed, 17 Feb 1999 13:45:57 -0500
From: Tom McGlynn <tam@silk.gsfc.nasa.gov>
Subject: Re: PFR: UTC_to_Epoch
Message-Id: <36CB0E65.3E1F9B15@silk.gsfc.nasa.gov>
Gareth Rees wrote:
>
> Tom McGlynn <tam@silk.gsfc.nasa.gov> wrote:
> > I do have applications where the leap seconds matter.
>
> If leap seconds matter to your application you may be better off using
> something other than UTC for your time. TAI (International Atomic Time)
> has no leap seconds.
>
> --
> Gareth Rees
I'm sorry that I seem not to be clear about this. I am not
suggesting that this routine should handle leap seconds. I am
suggesting that it document the fact that it won't. I am perfectly
aware of these issues but someone picking up this routine might
not be. The comments in the proposed function state
> # UTC_to_Epoch converts a broken-down date/time array from UTC to time
> # in seconds since the Unix Epoch (midnight on 1 January, 1970). It is
> # essentially the inverse of gmtime.
>
This is simply wrong and misleading, especially since the function nominally
has an accuracy of the order of seconds (i.e., there is a seconds argument).
As Gareth himself points out, it would be (other than a constant offset)
correct to say that this is a TAI_to_Epoch converter.
However since in most applications the existence of leap-seconds do not matter,
I would not suggest changing the code. I would simply add an additional
sentence to the above along the lines of:
"Leap seconds are not handled by this routine (or other Unix time functions)."
Personally I find the lack of documentation of this issue in the Unix
man pages to be an example of shoddy work.
Regards,
Tom McGlynn
tam@silk.gsfc.nasa.gov
------------------------------
Date: Wed, 17 Feb 1999 13:28:02 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: print: location not working?
Message-Id: <comdog-ya02408000R1702991328020001@news.panix.com>
In article <36cb0192.14958390@nntp4.mindspring.com>, curtiss@desertisle.com (Curtiss Hammock) posted:
> <!--#exec cgi = "/cgi-bin/randhom2_flash.pl" -->
> #!/usr/bin/perl
> print "Location:
> http://www.webserver.com/flash/cgi_test/index1.shtml\n\n";
> exit 0;
>
> Am I wrong in thinking that this should load "index1.shtml"? Right
> now, it just loads a page with a *link* to the page in question.
you are wrong. it does exactly what it is documented to do. you might
check the CGI Meta FAQ for details.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 17 Feb 1999 18:04:26 GMT
From: "Charles Bucher" <cbucher@tampabay.rr.com>
Subject: Real-time Browser Updating
Message-Id: <KwDy2.1616$Rw6.4410@newse2.tampabay.rr.com>
I am writing a CGI script on a WinNT, Perl5 enabled server and would like to
have the output sent to the browser in real-time. For example, when I run
the following script:
#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
print "<HTML>\n";
print "This is before the sleep call!<br>";
sleep (20);
print "This is after the sleep call!<br>";
print "</HTML>\n";
I would like the browser to print the fist line, wait 20 seconds, and then
print the second line. Instead, the browser reports "Connecting....", waits
20 seconds, and then prints both lines at the same time.
Is there a function that forces the server to send the response to the
browser immediately? Any help would be greatly appreciated.
Thanks,
Charles
c.e.b.@ix.netcom.com
------------------------------
Date: 17 Feb 1999 19:43:04 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Real-time Browser Updating
Message-Id: <831zjohnwn.fsf@vcpc.univie.ac.at>
Re: Real-time Browser Updating, Charles
<cbucher@tampabay.rr.com> said:
Charles> I am writing a CGI script on a WinNT, Perl5
Charles> enabled server and would like to have the
Charles> output sent to the browser in real-time.
Charles> For example, when I run the following
Charles> script:
1. you need to really make sure that stdout is
unbuffered in the script.
2. you need to use an nph- script.
3. ...and a browser that behaves as you expect :-)
Look at the CGI.pm module for handling nph stuff
(and for many other good reasons like HTML
shortcuts).
Related to this is the concept of multipart streams,
e.g. for doing in-situ image animations in an IMG
cell.
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: 17 Feb 1999 14:06:29 -0600
From: Dale Henderson <dhenders@cpsgroup.com>
Subject: Re: Real-time Browser Updating
Message-Id: <871zjo23sq.fsf@camel.cpsgroup.com>
>>>>> "Charles" == Charles Bucher <cbucher@tampabay.rr.com> writes:
Charles> I am writing a CGI script on a WinNT, Perl5 enabled
Charles> server and would like to have the output sent to the
Charles> browser in real-time. For example, when I run the
Charles> following script:
Charles> #!/usr/bin/perl -w
Charles> print "Content-type: text/html\n\n";
Charles> print "<HTML>\n";
Charles> print "This is before the sleep call!<br>";
Charles> sleep (20);
Charles> print "This is after the sleep call!<br>";
Charles> print "</HTML>\n";
At least one of your problems is buffering. Perl buffers stdout
and only flushes at aboutr every 2k or so (I think) or at the end
of the file. You can tell it to autoflush after a print by
setting $| to a non-zero value (i.e. put $|=0 at the begining of
the program.) and this will cause perl to print; sleep; print;
instead of sleep; print. However you may also hav a problem with
the browser buffering its input. :(
--
Dale Henderson <mailto:dhenders@cpsgroup.com>
"Imaginary universes are so much more beautiful than this stupidly-
constructed 'real' one..." -- G. H. Hardy
------------------------------
Date: 17 Feb 1999 17:50:39 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: regex poll
Message-Id: <7aevhf$i9n$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Chris Nandor
<pudge@pobox.com>],
who wrote in article <pudge-1702991004050001@192.168.0.77>:
> In article <39soc6ufbq.fsf@ibnets.com>, Uri Guttman <uri@ibnets.com> wrote:
>
> >as ilya and i are having another war over MRE and versions of perl, i am
> >posting this poll. i want to know what regex features people use and how
> >often. i have listed all features i found in the desktop reference which
> >covers 5.005. if you see some that i have missed, add them. this is both
> >for s/// and m//.
>
> Uri, as this poll is being conducted in an entirely unscientific manner,
> the results will be useless for arguing for either position, whatever the
> positions are.
Definitely, but they might be entertaining nevertheless.
Ilya
------------------------------
Date: 17 Feb 1999 13:08:41 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: regex poll
Message-Id: <x790dwnbrq.fsf@home.sysarch.com>
>>>>> "IZ" == Ilya Zakharevich <ilya@math.ohio-state.edu> writes:
IZ> <pudge@pobox.com>],
IZ> who wrote in article <pudge-1702991004050001@192.168.0.77>:
>> Uri, as this poll is being conducted in an entirely unscientific
>> manner, the results will be useless for arguing for either
>> position, whatever the positions are.
IZ> Definitely, but they might be entertaining nevertheless.
i think so too. i have about 10 responses. for some reason they are
coming to me and not the group even though i don't see a
followup-to-sender header. when i stop getting them (in a couple of
days) i will post a summary.
so far (by a quick visual scan) most of the fancy features are rarely
used.
and chris, if you don't like polls, don't reply. i never claimed
anything with this poll, i just asked for responses. people can make of
it what they wish.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Wed, 17 Feb 1999 13:27:08 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: regex poll
Message-Id: <linberg-1702991327080001@ltl1.literacy.upenn.edu>
Here are mine; FWIW, I consider myself roughly intermediate... except when
compared with most of you in .moderated, where I consider myself roughly a
beginner. :)
dot .: often
alternation |: sometimes
grouping (): often
non-grabbing group (?:): never
back ref \1\2: never
group vars $1$2: often
special vars $`$&$': never
char class []: often
class abbrev \d\D\s\S\w\W: almost-always
quantifiers ?+*{}: almost-always
non-greedy ?: often
anchors ^$\A\Z\z: almost-always
look ahead/behind pos/neg (?=!<<!): never
embedded modifier (?misx): never
embedded comments (?#): never
/x comments #: sometimes
/m modifier: sometimes
/s modifier: sometimes
/i modifier: most-times
/x modifier: sometimes
/o modifier: never
/g modifier: sometimes
/c modifier: never
/e modifier: never
/ee modifier: never
pos function: never
alternate delimiters: sometimes
embedded code (?{}): never
conditional pattern (?()true|false): never
anchored pattern (?>): never
regex object qr//: never
re pragmas: never
> as a bonus what version(s) of perl do you use?
5.005_02
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: Wed, 17 Feb 1999 14:49:45 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: regex poll
Message-Id: <pudge-1702991449450001@192.168.0.77>
In article <x790dwnbrq.fsf@home.sysarch.com>, Uri Guttman
<uri@sysarch.com> wrote:
>and chris, if you don't like polls, don't reply. i never claimed
>anything with this poll, i just asked for responses. people can make of
>it what they wish.
I think you are speaking out of both sides of your mouth. You
specifically stated that this poll sprung from a disagreement you and Ilya
are having about new regex features:
# as ilya and i are having another war over MRE and versions of perl, i am
# posting this poll.
The reasonable asumption is that you plan on using this data for
something, when that is completely unwarranted. But now you say you are
not claiming anything with this poll. This is a lie I've seen many times
in my years, in many forms: "this poll doesn't mean anything, but we spent
time on it and analyzed it anyway." Why do it if it is a fact that the
results are meaningless? I can only fathom that you are hoping that
meaningless facts will bolster your case against Ilya, whatever it is.
And that is Wrong, in the moral sense, and it is Wrong, in the logical
sense.
I urge everyone to refuse to participate in such a thing. There's no
knowledge to be gained by such a "poll". It is entirely useless. By
participating, you are legitimizing that which is de facto illegitimate.
If you have already sent your data to Uri, I urge you to ask him to not
include your data in his analysis.
Why am I doing this? Uri contends this poll and its results have their
merits. I contend they are meritless. Uri intends, it is clear, to use
this data irresponsibly, to say that which cannot be said. No matter what
his results are, they will be unindicative of any reality.
I have several goals in life. One is to help stomp out the irresponsible
use of information. This is a clear example of it. I ask you all to help
by not participating.
I've said my peace, I'm done.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Wed, 17 Feb 1999 13:00:24 -0800
From: "Dan Kubilos" <dkubilo@oxnardsd.org>
Subject: Regular Expression Help
Message-Id: <36cb2f2f.0@news.vcss.k12.ca.us>
First, I have checked the FAQ, the perlre man page, and "Learning Perl"
Too many hours for such a simple thing...
I am running RedHat Linux 5.2 on a p200 box.
I wrote a perl (5.004_04) script to addusers
I want to accomplish 3 things using regex that are driving me batty.
1. I want to force a username between 3 and 8 alpha characters
I tried $variable =~ /[a-z]{3,8}?/
This only checks that there are 3 minimum. but still matches any number of
[a-z] so dkdkdkdkdkdkdkdk matches ??
2. I want to force full name as First Last with no middle initial
$variable =~ /[A-Z]\D+\s[A-Z]/ matches with Dan C Kubilos ??
3. Probably not regex, but again me the newbie dude is stumped.
I want to check that group number entered is valid.
tried $varible == 30...230 to no avail
tried $variable =~ /^[2-3]{1}[0-9]{1,2}/
again to no avail. I would appreciate any help, suggestions.
Thanks
Dan Kubilos
------------------------------
Date: Wed, 17 Feb 1999 10:33:55 -0800
From: "Richard L. England" <richard_england@mentorg.com>
Subject: Socket problems with 5.005_2 on Solaris 2.7
Message-Id: <36CB0B92.B8F5C734@mentorg.com>
I have a perl script that ran fine under 5.001 on several platforms
which now fails under 5.005_02 on Solaris 2.7 but runs on HPUX 11.00.
The failure indication is:
Socket version 1.3 required--this is only version at
/usr/mgc/lib/perl5005_02/IO/Socket.pm line 118.
It appears as though there should be something "filled in" after the
word "version" in the message. I have found reference to a version
1.7 in the Socket code but I'm not sure if it has any bearing on this
issue or not.
Has anyone successfully built this version on Solaris 2.7 using the
later versions of the Cygnus compiler?
The installation tests ran with no problems. I used the same Policy
file for the builds on Solaris and HPUX and attempted to make sure the
same options were available on both.
Can anyone send me in the right direction to reconcile this? I am a
complete novice in the Sockets area so please be gentle.
--Richard
--
// Richard L. England richard_england@mentorg.com
// Mentor Graphics Corp., Wilsonville, OR 97070-7777 503.685.1240
// "Your mouse has moved. Windows must be restarted for the change
// to take effect. Reboot now?"
------------------------------
Date: 17 Feb 1999 07:54:45 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Speed Up Perl
Message-Id: <36cad835@csnews>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
pvdkamer@inter.NL.net writes:
:Does anyone have a sulution to speed up perl scripts ?
:i've got several perl scripts wich are all comparing substrings in 2
:textfiles.
:Perl running on Linux is better performing and Perl running on Win32
:(win98) is not performing at all.
Likely this is a function of your operating system, or lack thereof.
It might also be a bad algorithm, but one would imagine that were this
the cause, it would have shown up under a real system, too.
:Does anyone have a solution to speed up perl script mayby by compiling
:them or something else ?
No, that's won't help at all.
--tom
--
If I allowed "next $label" then I'd also have to allow "goto $label",
and I don't think you really want that... :-)
--Larry Wall in <1991Mar11.230002.27271@jpl-devvax.jpl.nasa.gov>
------------------------------
Date: Wed, 17 Feb 1999 19:54:37 GMT
From: cory@techlounge.com
Subject: Subroutines and variables
Message-Id: <7af6po$itd$1@nnrp1.dejanews.com>
I have written one subroutine that calls another (see below). Both
subroutines are passed a variable with the same name, $action. I need to
call the Refresh subroutine two times passing it a different value each time.
The problem comes in on the second call when I pass it a different value.
When the Refresh sub calls the Sort sub with the "project" value, the Sort
sub uses the first value "archive". Obviously this is caused by the way I am
storing the values. What can I do to correct this problem?
$FORM{'action'} = "archive";
&Refresh($FORM{'action'});
&Refresh("project");
sub Refresh {
my($action) = @_;
if ($action eq 'archive') {
$SELECTED_DATA_FILE = $ARCHIVE_DATA_FILE;
}
else {
$SELECTED_DATA_FILE = $PROJECT_DATA_FILE;
}
&Sort($action);
}
sub Sort {
my($action) = @_;
if ($action eq 'archive') {
$SELECTED_DATA_FILE = $ARCHIVE_DATA_FILE;
}
else {
$SELECTED_DATA_FILE = $PROJECT_DATA_FILE;
}
# Perform sorting...
}
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 17 Feb 1999 18:14:35 GMT
From: dgeller@cahners.com
Subject: Using system in NT to move files
Message-Id: <7af0u1$d80$1@nnrp1.dejanews.com>
I have a program that is supposed , as the last thing it does, to move a file
from one directory to another (on the same disk). The command is constructed
and looks like, for example,
move k:\AdServer\logs\Z-1999020.cxxxxxx.com-9678-AdSerL
k:\AdServer\logs\Archive\AdServer\Z-1999020.cxxxxxx.com-9678-AdSerL
The command works just fine when executed at DOS level. But when executed in
the program within a system call, nothing seems to happen -- system returns
65280
I've tried various possibilities of absolute and relative file names,
imagining that when system forks the new process wants fully qualified file
names, but no luck. (I use Perl rename within the program and that's ok, but
it doesn't work across directories, which is no surprise) I know i'm missing
something basic here, and I'd appreciate it if someone would point it out to
me.
Dennis Geller
dgeller@cahners.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
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 4920
**************************************