[11122] in Perl-Users-Digest
Perl-Users Digest, Issue: 4722 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 22 13:17:13 1999
Date: Fri, 22 Jan 99 10:00:22 -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 Fri, 22 Jan 1999 Volume: 8 Number: 4722
Today's topics:
Re: ** Seems Like a Natural for Perl ** <mjw@metalink.net>
[Q] regexp or split? How do I prune this string: d20+4 (Andreas Gustafsson)
Re: ancestry of perl features <tchrist@mox.perl.com>
Re: ancestry of perl features <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: File Upload. (Robert Saunders)
First line skip when reading file <gnew@smip.com>
Re: First line skip when reading file <jeromeo@atrieva.com>
Re: Help with RE for separate Perl codes and comments <016781c@acadiau.ca>
Re: How do I use modules? <chrisl@hamptons.com>
Re: How long would the Unixes last without Perl? <kperrier@blkbox.com>
Re: How to set keyboard timeout <qcoldiro@unlinfo.unl.edu>
Re: Is there an HTML to CGI.pm converter?? (Randal L. Schwartz)
Re: IS THIS POSSIBLE?? <kperrier@blkbox.com>
Re: length($string) in UNIX environment dhosek@webley.com
Re: list of hashes dhosek@webley.com
Re: Looking for RCP/RSH Client written in Perl <ekkehard.goerlach@pharma.novartis.com>
Net::Ping woes !!! <jreynolds@multistream.ie>
Passing param from include file? pkey@sghms.ac.uk
Re: PLease Help CGI configuration problem dhosek@webley.com
Re: PROOF: Schwartz is LORD of the Transform! <jeromeo@atrieva.com>
Re: Regular Expression Question (Larry Rosler)
Re: Regular Expression Question (Bart Lateur)
Re: Safely editing /etc/passwd. (Randal L. Schwartz)
Re: Status of Threaded Perl <dgris@moiraine.dimensional.com>
Undefining $1 after regexp match blakekr@my-dejanews.com
Re: Undefining $1 after regexp match (Larry Rosler)
Re: Undefining $1 after regexp match <woerdehoff@sdm.de>
win32::netadmin does not work <gehring@politik.uni-mainz.de>
Re: Y2K? dhosek@webley.com
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 22 Jan 1999 11:57:39 -0500
From: "Matt Wiseman" <mjw@metalink.net>
Subject: Re: ** Seems Like a Natural for Perl **
Message-Id: <78aail$3a4$1@news0-alterdial.uu.net>
Also, Outlok express version 4.0 has an "inbox assistant" that will
automatically do this. . .no need to code
David W. Bourgoyne wrote in message ...
>
>Here's the situation. Everyone at my household has a unique email
>address at a mail forwarding service. All emails get forwarded to my
>single ISP account. I would like to develop a POP3 Client that sucks
>all the email off the ISP, looks at the To: fields and appends it to the
>correct persons mbox. Also, I would like the POP3 Client to
>automatically respond (send email back to the Sender) to image request.
>
>Seems Like a Natural for Perl!!!
>
>I was going to use the following modules:
>
>POP3Client - for popping the mail.
>MailFolder - for writing the mbox files.
>MIME-tools - for constructing the reply to an image request and
> inserting the image into the outgoing email.
>
>MailFolder looks old, is there a better module for writing the mbox
>file? Is this a good approach? Do I need any other modules? Any and all
>comments are most welcome.
>
>Regards,
>
>David
>
------------------------------
Date: 22 Jan 1999 18:38:50 +0100
From: ante@Zeke.Update.UU.SE (Andreas Gustafsson)
Subject: [Q] regexp or split? How do I prune this string: d20+4 ??
Message-Id: <78ad3a$e59$1@Zeke.Update.UU.SE>
Keywords: regexp, perl,
I'm trying to pluck out just the numbers /after/ 'd6' in this string,
but I can't do it!
the string: d6+4
my mission is to get the numer after d6 and put it in a new variable.
how do I do it? regexp? split()?
I've tried both and haven't gotten the desired results.
/andreas
--
=-=-=-=-=-=-=-=-=-=-=-=-=-= Ad Astra!! =-=-=-=-=-=-=-=-=-=-=-=-=-=
Me: sf-fan, philosopher, historian, dreamer...
Loves: my good friends, ale, art in many forms, dreaming...
=-=-=-=-=-=-=-=-=-=-=-=-=-=-= mail me: ante@update.uu.se /FIAWOL!
------------------------------
Date: 22 Jan 1999 10:06:44 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: ancestry of perl features
Message-Id: <36a8b024@csnews>
In comp.lang.perl.misc, Uri Guttman <uri@ibnets.com> writes:
:some are very obvious (or not). here is a starting list. feel free to
:add, comment or flame.
:
:math infix ops (+, *, /, etc) C
:exponentiation (**) PL/I (others too)
No, FORTRAN, and thence I believe to BASIC. All your PL/I notions are
false, because Larry wasn't a PL/I guy. He was a BASIC-PLUS guy.
Keep that in mind.
And most of the awk stuff (string hacking, hashes) actually
should be more properly traced to awk's ancestor, Snobol.
:scalar range (..) awk (list .. is perl)
Editors. Sed and Awk.
:bind (=~) awk
No, csh.
:scalars as string or number sh
And awk. And lisp. And many, many other things. I wouldn't blame this
on shells.
:arrays of scalars csh? (the $a[0] syntax is similar)
Not really. csh has a strange notion of this. But try anything else.
:varying lenghth strings (no \0 needed) sh, PL/I
Gosh, no. Think BASIC and awk.
:substr PL/I
Nope, awk.
:lists lisp, apl
and shell.
:slices apl
Um, doesn't Ada have this, and later versions of Fortran?
I'm trying to remember whether BASIC-PLUS did.
:statement modifiers perl?
No, BASIC-PLUS from RSTS/E.
:glob (<*>) csh
You mean /etc/glob. :-) Or shells in general.
But you're really forgetting a bunch.
blocks Algol
# comments shells
system functions Unix libc
$ for variables shells
' " ` shells
pick your own quotes m//, s/// sed; other editors
sort function libc's qsort()
// repeat last match sed; other editors
nesting brace quoting tcl
control flow:
do{}, if(), while(), for C
foreach shell (csh foreach, sh for i in)
labelled loops lots of languages, but not C
unless and until BASIC-PLUS
all functions variadic in their lisp, shell
calling and returning lists
OO set-up (hashes, classes) python
universal base class smalltalk(?)
require lisp
importing Ada, somewhat
open syntax gated to fopen/popen shell
[] and {} dyna structs python, somewhat
(actually, python fails a bit here compared to perl)
formats:
keywords Fortran
wysiwiggery COBOL pictures
syntax @<< etc BASIC's PRINT USING
$0 as program name shells
regex syntax Thompson's ed(1) etc
$0 mutable for ps sendmail
$. assemblers, editors
$?, $$ shells
$! C's errno
closures lisp
/i flag grep -i
grep and map lisp really (grep misnomer)
BEGIN and END awk
\u \U \l \L vi
\w \s emacs
\e $% troff
-e -f -d /bin/test
pack u format uuencode, of course
chr ord Pascal
interpreted systems programming BASIC-PLUS on RSTS/E
$pack'var syntax Ada
tied arrays BASIC-PLUS
next awk
"and" "or" "not" REXX conference Larry attentded
print default args awk
autoloading lisp
It's more interesting to figure out what *IS* original,
unique unto Perl. There are quite a few mysteries yet.
I'll let you start that list yourself. :-)
--tom
--
"If you think Emacs is such a great editor, just look what it did for
Richard Stallman's typing skills!"
------------------------------
Date: 22 Jan 1999 18:15:13 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: ancestry of perl features
Message-Id: <83r9snp6u6.fsf@vcpc.univie.ac.at>
Re: ancestry of perl features, Tom
<tchrist@mox.perl.com> said:
Tom> ...
Tom> args awk
Tom> autoloading lisp
And of course
recursion perl
:-)
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: Fri, 22 Jan 1999 17:27:20 GMT
From: robert@iminet.com (Robert Saunders)
Subject: Re: File Upload.
Message-Id: <8E3CA6985810B0B1.C8B64E9A1EE20548.8F0D9EE523191716@library-proxy.airnews.net>
Sam would you have a example of code you might use with the CGI.pm. I
am interested in this topic. and would be interested in seeing some
code to play with
Robert Saunders
robert@iminet.com
On Thu, 21 Jan 1999 08:57:23 -0800, samc@empirewest.com (Sam Curren)
wrote:
>But what happens with a binary file? Now it has newlines periodicly
>through it.
>
>use CGI.pm and pull the values out that way. Much more powerful and
>simple to use.
>
>-Sam Curren
>
>In article <36A6ED92.7EC03B43@khayal.com>, ghulam@khayal.com says...
>> Assuming that your file input variable is "cv" , the following should
>> suffice :
>>
>> #-------Beginning Code----------
>>
>> #!/usr/bin/perl
>> require "cgi-lib.pl";
>> &ReadParse;
>> open (F, ">uploaded.dat");
>> print F "$in{'cv'}\n";
>> close (F);
>>
>> #-------End of Code-------------
>> Note : You can name the new file to whatever you want instead of
>> "uploaded.dat" depending on type.e.g "wordfile.doc"
>>
>> piece of cake, huh?
>>
>> Alex Blyumenkrants wrote:
>>
>> > Hi!
>> >
>> > I have the following problem:
>> >
>> > i need to upload a file from an Html,
>> > if i use type="file"
>> > what should i do to save this file in my Cgi?
>> >
>> > Thank You,
>> > Alex
>>
>>
------------------------------
Date: Fri, 22 Jan 1999 11:36:16 -0500
From: "Gary C. New" <gnew@smip.com>
Subject: First line skip when reading file
Message-Id: <36A8A8FF.FA2A017B@smip.com>
I've narrowed my problem down to this:
When trying to use a simple while loop to read in multi. lines from a
text file the first line of the file is always skipped.
# This opens the index.dat file for reading into @temp
open(INDEX_DAT, "index.dat") || die "Can't open index.dat.\n";
while (<INDEX_DAT>) {
@temp = <INDEX_DAT>;
}
close(INDEX_DAT);
# This suggests that the first line del prob is prior to this code
# open(INDEX_TMP, ">index.tmp") || die "Can't open index.tmp.\n";
foreach $_ (sort @temp) {
print "$_\n";
}
# close(INDEX_TMP);
exit;
My text file (index.dat) looks simular to this:
Bowden_Jeffrey_T # line 1
Brimhall_Trent_S # line 2
When I execute it at command line all I get is:
>Brimhall_Trent_S
Any clues as to why this is happening?
Gary
------------------------------
Date: Fri, 22 Jan 1999 08:56:01 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
To: "Gary C. New" <gnew@smip.com>
Subject: Re: First line skip when reading file
Message-Id: <36A8ADA1.D300D10A@atrieva.com>
Gary C. New wrote:
> When trying to use a simple while loop to read in multi. lines from a
> text file the first line of the file is always skipped.
>
> # This opens the index.dat file for reading into @temp
> open(INDEX_DAT, "index.dat") || die "Can't open index.dat.\n";
> while (<INDEX_DAT>) {
> @temp = <INDEX_DAT>;
> }
> close(INDEX_DAT);
When while(<INDEX_DAT>) is evaluated, $_ is initialized to the first
line, and I'll guess that $. is incremented. Then when @temp =
<INDEX_DAT> is evaluated, it begins initializing at the second line.
What you want to do is remove the while(<FOO>){} construct, and
initialize @tmp as you do now.
@tmp=<INDEX_DAT>;
Or, if you like the while construct:
while(<INDEX_DAT>){
push @tmp,$_;
}
See perlvar for more information on $., and other useful perl variables.
Good Luck!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Fri, 22 Jan 1999 13:03:54 -0400
From: Jerry Chen <016781c@acadiau.ca>
Subject: Re: Help with RE for separate Perl codes and comments
Message-Id: <36A8AF7A.1D34102B@acadiau.ca>
Jerry Chen wrote:
> I have some difficulties to parse Perl code to identify
> the source part and comment part using
> regular expression.
Just to follow up with my question:
I was working on it, and it comes close.
I am not expecting 100% correct outputs, but maybe 95%??
(for most of day to day programming source codes)
Sorry for all the if statements.. I can't think a simple
way to do it. Any way to improve it??
Thaks you all for all valuable inputs.
Here is a simple I wrote file to do the checking:
#!/usr/local/bin/perl -w
#
# File: getcode.pl
# Description:
# Separate the comments from a line mix with codes and comment.
# Author: Jerry Chen
# Date: Jan 22, 1998
# Note: This is just a test. Not correct.
###
use strict;
MAIN:
{
my (@data, $data);
my ($source, $comment) = "";
open (FILE, "<$ARGV[0]"); # read in a file from frist argv
@data = <FILE>; # read into an array
close (FILE);
foreach $data (@data) {
if ($data =~ /^(\s*)$/) {
print "Empty line : $1";
next;
} elsif ($data =~ /^(([^\#]|[^\\\#])*)$/) {
print "All source : $1";
next;
} elsif ($data =~ /^(\s*\#.*)$/) {
print "All comment: $1\n";
next;
# this will be wrong in this case (but don't happen
# often):
# ^print<<END;
# ^ # this is not a comment
# ^END
#
} else {
# now check for the mix
if ($data =~ /\;\s*\#.*$/) {
# if # is after ;
$source = $data;
$source =~ s/^(.*;)\s*(\#.*)$/$1/;
$comment = $2;
$source =~ s/\n//; # take out \n in source
} elsif ($data =~ /(\"|\'|\[).*\#.*(\"|\'|\])[^\#]+$/) {
# ignore if # is in "", '', [], others??
print "All source : $data";
next;
} elsif ($data =~ s/^(.*)(\#.*)\n//g) {
$source = $1;
$comment = $2;
} else {
print "Other : $data";
next;
}
print "Mix source : $source || comment: $comment\n";
}
} # for #
}
# --------------------
For the test file:
#!/usr/local/bin/perl
# file: syntax.pl
# Test Perl Syntax.
###
print "this is a source code line\n";
print "this is a mix\n"; # mix
sub getname { # hello1
} # hello
print "is this mix?\n" # hello??
;
print " this is a number sign # in a string\n";
print " how about this?"#hello??
;
print "this ? #" #hello?
;
time /3 ;#/; print "hello\n";
# should be mix
sin /3 ;#/; print "goodbye\n";
# should be all code
$temp =~ s#hello#worl#;
# should be all code
$array [$#array] = qq;
# should be all code
exit; #;#
------------------------------
Date: Fri, 22 Jan 1999 15:39:45 GMT
From: Chris <chrisl@hamptons.com>
Subject: Re: How do I use modules?
Message-Id: <36A89BC1.98B4D3CB@hamptons.com>
Thanks Martien! I fully expected the CGI module to come with my Perl, and when
it didn't what was probably what confused me the most. Well, it turns out that
I must have installed some sissy version of Perl, cause I didn't have it (or
perldoc!). Well I went to activestate.com and downloaded a more complete Perl,
and all is well.
Thank you for solving the mystery!
Chris
Martien Verbruggen wrote:
> In article <36A682D3.8FF3C912@hamptons.com>,
> Chris <chrisl@hamptons.com> writes:
>
> > actually get a hold of CGI.pm, and I couldn't find anything on how to
> > use modules.
>
> Any recent version of perl comes with CGI.pm. Most modules nowadays
> have documentation inside of them, in pod format. Any recent perl
> comes with a program called 'perldoc' that gives you access to these
> documents, as well as all the perl documentation:
>
> # perldoc perldoc
> # perldoc perl
> # perldoc CGI
> # perldoc perlfaq
> # perldoc -f open
> # perldoc -q "faq.*regexp"
> # perldoc perlmod
> :)
>
> Martien
> --
> Martien Verbruggen |
> Interactive Media Division | Begin at the beginning and go on till
> Commercial Dynamics Pty. Ltd. | you come to the end; then stop.
> NSW, Australia |
------------------------------
Date: 22 Jan 1999 11:41:05 -0600
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: How long would the Unixes last without Perl?
Message-Id: <ysivhhzi4su.fsf@blkbox.com>
"Phlip" <address@web.page> writes:
> Newsgroupies
>
> Ever since Linux got me (not the other way around), I have observed
> that
> Perl is as close to an OS component as makes no difference.
>
> Is anyone out there running a Unix with no Perl installed?
I don't think that there is a commercial UNIX on the market today that
ships and installes perl by default.
Kent
------------------------------
Date: Fri, 22 Jan 1999 10:52:34 -0600
From: quinn coldiron <qcoldiro@unlinfo.unl.edu>
Subject: Re: How to set keyboard timeout
Message-Id: <36A8ACD2.C0C9F692@unlinfo.unl.edu>
Mark Fearer wrote:
> Anyone know how to have a perl program terminate execution if the user
> running it
> hasn't touched the keyboard in a predermined amount of time?
>
> --
> --------------------------------------------------
> Mark Fearer * C:\DOS
> mfearer@mail.fearernet.com * C:\DOS\RUN
> http://www.fearernet.com/mfearer * RUN\DOS\RUN
OK, I am playing with this now. I wrote this:
#!/usr/bin/perl
sub pError{
alarm(0);
die;
}
$SIG{'ALRM'} = \&pError;
alarm(3);
$i = 1;
while($i < 999){
print"$i\n";
}
print"Finished\n";
which dies after 3 seconds of the endless loop.
What I'm stuck on is this. What if I'm not in a loop, I just have
something like 3 statements:
statement1;
statement2;
statement3;
and if statement2 timesout, I move to statement3. How do I do that? It
doesn't work if I put next; in the error procedure.
Quinn
------------------------------
Date: 22 Jan 1999 09:19:03 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Is there an HTML to CGI.pm converter??
Message-Id: <m1r9snkyyg.fsf@halfdome.holdit.com>
>>>>> "dturley" == dturley <dturley@pobox.com> writes:
dturley> I just answewred this question a couple of weeks ago. Randal
dturley> Schwartz did just this in a column in Web Techniques
dturley> http://www.stonehenge.com/merlyn/WebTechniques/col31.listing.txt
Wrong number. s/31/30/
The corresponding column is at
<URL:http://www.stonehenge.com/merlyn/WebTechniques/col30.html>.
dturley> I've used the script a bunch. It doesn't do forms, I just use
dturley> placeholders and fix manually.
Yes, as with all my other columns, this is not really an end-user
solution... it's merely a "proof of concept". The output HTML will be
functionally equivalent to the input HTML, so you can do something
like:
html2cgi <my.html | perl >result.html
where Perl is seeing essentially "use CGI;" at the beginning, and
the results should render the same.
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: 22 Jan 1999 11:41:44 -0600
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: IS THIS POSSIBLE??
Message-Id: <ysiu2xji4rr.fsf@blkbox.com>
"Administrador" <ablasco@mad.servicom.es> writes:
> Hi there,
>
> I need a script that runs from our server and that script should load a
> remote page from another site every 5 seconds. I think it is easy to
> program. It should have a configuration screen to start the robot, stop
> the robot, and a put the url of the page to load every xx seconds. This
> robot should work on the server, and if I cut the connection it will
> still log every 5 seconds until i stopit.
>
> Is this possible? Can anyone help me!
Yes.
------------------------------
Date: Fri, 22 Jan 1999 17:05:04 GMT
From: dhosek@webley.com
Subject: Re: length($string) in UNIX environment
Message-Id: <78ab3o$485$1@nnrp1.dejanews.com>
In article <788fbp$7m8@bgtnsc03.worldnet.att.net>,
"sysadmin" <charlesjourdan@worldnet.att.net> wrote:
> I want to count each character in a string which is a series of numbers
> My debug output seems like there are 2 hidden chars
> Are these [\n][NULL] ?
> Notice how next to last position causes a newline
> Not sure
Two things to be aware of: First, and most important, you count starting with
0, so if you have a string of length 52, those 52 characters will be numbered
0 to 51
Second, when you get a line in perl, the resulting string has a newline at
the end. If you don't want that newline in your string, remember to do a
chomp() to get rid of it.
If you don't have a llama book, you may want to pick one up. It'll get you up
to speed on a lot of this sort of stuff.
-dh
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 22 Jan 1999 17:01:24 GMT
From: dhosek@webley.com
Subject: Re: list of hashes
Message-Id: <78aass$3ug$1@nnrp1.dejanews.com>
In article <788h1m$4me$1@client2.news.psi.net>,
abigail@fnx.com wrote:
> dhosek@webley.com (dhosek@webley.com) wrote on MCMLXIX September MCMXCIII
> in <URL:news:788c48$f0f$1@nnrp1.dejanews.com>:
> // It would have been nice if the docs had mentioned that you can get an
actual
> // array returned from ct_fetch
> It's right there! The first 5 words of the section about ct_fetch!
> @data = $dbh->ct_fetch([$doAssoc [, $wantRef]])
> Retrieve one row of data.
> You *do* know what that `@' means, I hope. Or know what a "a row" is.
Oops, I meant to say ct_sql. And it probably is there, so continue to gloat.
I'll stand by my assertion that the docs are a bit cursory and could stand to
use some elaboration and more examples.
-dh
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 22 Jan 1999 17:52:11 +0000
From: Ekkehard Goerlach <ekkehard.goerlach@pharma.novartis.com>
Subject: Re: Looking for RCP/RSH Client written in Perl
Message-Id: <uk8yfnqk4.fsf@pharma.novartis.com>
Hello,
if perl is not a requirement you may take a look at Winsock RSHD/NT from
Denicomp Systems (http://www.denicomp.com).
I cannot really comment on it, yet. But the first installation went fine
and worked as expected.
Ekkehard
(ekkehard.goerlach@pharma.novartis.com)
------------------------------
Date: Fri, 22 Jan 1999 17:18:42 +0000
From: John Reynolds <jreynolds@multistream.ie>
Subject: Net::Ping woes !!!
Message-Id: <36A8B2F1.865DE452@multistream.ie>
In trying to use Net::Ping (perl version 5.005_02) on a glibc Linux
box, the ping command seems to fail
eg.
use Net::Ping;
$host_ip = "127.0.0.1";
$p = Net::Ping->new("tcp");
if($p->ping($host_ip, 2)){
print "in ping\n";
}
else {
print "ping failed\n";
}
$p->close;
will print ping failed.
Note that no args to new eg. "tcp", the following error occurs.
Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16
at /usr/lib/perl5/5.00502/i586-linux/Socket.pm line 275.
Anybody got any tips to fix this ??
Thanx
John Reynolds
------------------------------
Date: Fri, 22 Jan 1999 16:00:51 GMT
From: pkey@sghms.ac.uk
Subject: Passing param from include file?
Message-Id: <36a8a0a1.1382928@news.hgmp.mrc.ac.uk>
I have a cgi script that uses an include file.
I wnat to pass a valuse from the execution of the include file back
into the 'main' source.
Will return $param do this or is something else necessary?
------------------------------
Date: Fri, 22 Jan 1999 16:47:47 GMT
From: dhosek@webley.com
Subject: Re: PLease Help CGI configuration problem
Message-Id: <78aa3f$363$1@nnrp1.dejanews.com>
In article <36A7B136.C2DF9959@tivoli.com>,
Bruce Hartley - TPS Consultant <bruce.hartley@tivoli.com> wrote:
> It seems everything I am trying gives me this sort of error. here is some
example
> code I just tryied. I know this is different but still is confusing me.
> It gives me the error/warming:
> (offline mode: enter name=value pairs on standard input)
OK, you really need to read the documentation for CGI.pm.
perldoc CGI will pull up the docs for you. If for some reason you don't have
perldoc on your system, you can also find this on the web. Do a Yahoo search
for CGI.pm & pick the obvious page.
As to what's happening here, when you run a perl script written with use CGI
from the command line, the script will pause and allow you to enter CGI
parameters on STDIN. For example, if your script is normally called with
something like
POST /cgi-bin/myscript.pl?foo=bar
You could type
foo=bar
when that prompt comes up and get the equivalent effect to the call above.
When you've finished entering parameters (or if you don't have any at all),
just type ctrl-D (ctrl-Z under Windows or OS/2) to close stdin and let the
program get on with its work.
-dh
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 22 Jan 1999 08:34:39 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: PROOF: Schwartz is LORD of the Transform!
Message-Id: <36A8A89F.62FFBFC4@atrieva.com>
@sorted_arr = map {$_->[0]}
sort { $a->[1] cmp $b->[1] }
map {[$_ , (split(',,', $_))[$index_to_sort_by]]}
@arr;
IT CANNOT BE DENIED!!!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Fri, 22 Jan 1999 08:25:34 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Regular Expression Question
Message-Id: <MPG.1112465d6588e5309899b9@nntp.hpl.hp.com>
In article <36ab7885.15962138@news.skynet.be> on Fri, 22 Jan 1999
13:11:31 GMT, Bart Lateur <bart.lateur@skynet.be> says...
> parab0la@my-dejanews.com wrote:
>
> >I'm try to match the pattern /helloworld/ or /byeworld/. Is there any way
> >that I can combine them in one regexp, something like /\(hello|bye\)world/ ?
>
> Is your syntax based on the syntax in Nisus (wordprocessor), or
> something?
'something' would include something as popular as vi! It is maddening
to do a substitution with capture (which looks just like Perl:
s/.../.../g) and have to remember to backslash the parentheses in the
regex and to use '\1' etc. in the substitution instead of '$1'.
It is even more frustrating having used vi for many years before having
to learn to do it the Perl way. I need a mental mode toggle. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 22 Jan 1999 17:06:03 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Regular Expression Question
Message-Id: <36aaafac.539583@news.skynet.be>
Jonathan Feinberg wrote:
>There are plenty of non-word
>characters that don't require quoting.
True. But backwacks + non-word characters ALWAYS means quoting in Perl.
And that was essentialy what I was trying to say.
.... !!! Orthogonality alert! ;-)
Bart.
------------------------------
Date: 22 Jan 1999 09:27:28 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Safely editing /etc/passwd.
Message-Id: <m1lnivkykf.fsf@halfdome.holdit.com>
>>>>> "Mike" == Mike Ellwood <mwe@unixfe.cc.rl.ac.uk> writes:
Mike> Is there any way of locking out a critical file like this
Mike> from being updated by another process?
Not inherently. Everything that changes a file must agree to a
consistent way of locking in one of a dozen incompatible ways.
I generally rely on a vendor to be self-consistent amongst their own
tools, so I look to a tool that modifies a critical resource for the
method. For the password file in particular, passwd(1) and vipw(8)
both have to use the same method (generally creating passwd.lock, if I
recall). The neat thing about vipw(8) is that you can specify an
EDITOR in the environment of any program of your choosing. I've
specified a "created-on-the-fly" Perl program to do this before, and
it'll be handed a single parameter of a file in /tmp.
But in general, no, there's no solution. Each one must be created ad
hoc, and cooperate with anyone else using the same critical resource.
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: 22 Jan 1999 09:05:36 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Status of Threaded Perl
Message-Id: <m3lniv47jj.fsf@moiraine.dimensional.com>
meowing@banet.net (Fluffy) writes:
> Daniel Grisinger <dgris@moiraine.dimensional.com> wrote:
> Then I'll have to tell the nntp daemon I'm reading this article through
> that it shouldn't have been running for over 2 days.
Bad NNTP daemon! No biscuit. :-)
> It's worth noting
> that if your underlying thread library is unstable (and quite a few
> are), perl's not going to be very happy. (I've had individual threads
> in the process die, but those are problems in the INN library that I
> can reproduce in plain single-threaded C.)
Hmmmm... possibly. But I've had nothing but bad luck on Solaris, which,
if I understand correctly, has one of the best thread implementations
available.
> > No, what does coredump in one release may not in the next.
>
> One of the problems right now is that variables which shouldn't be
> in scope, are. If you mess with things you can touch right now but
> shouldn't, it'll ruin your day. Don't do that, and it's much more
> happy.
Establishing what can and cannot be touched is a trifle more
difficult. In my (somewhat limited) testing I've run into
problems with core portions of perl. Heavy use of regular expressions
seems to be the worst offender, triggering core dumps for me on
a fairly consistent basis.
Things get even worse when you start loading up modules. Scanning
over my p5p archives it appears that Net::*, LWP, and IO::* all
break badly when run under use Thread;. I don't know about you, but
I have very little code that doesn't touch IO:: or Net::.
> > If you want to play with threads you will be happier with _5x than
> > with _0x (you're more likely to see fixes show up in the dev branch
> > than in the maint).
>
> That isn't necessarily true. 5.005_54 leaks a *lot* of memory when the
> Threads module is in there. 5.005_03-pre doesn't. That's because _03
> is several weeks newer than _54 so it's already got lots of the
> patches one can expect to see in _55.
I hadn't considered that, but you are probably correct that _03 is
going to be superior to _54 for threads. The original statement
stands, though, as this (maint ahead of dev) is hardly a common
circumstance.
> I'll take running code over FUD any day. Thanks, drive through.
Me, too. If you can (meaning if it belongs to you, not somebody else),
could you share your NNTP code with me. I'd like to see if you are
doing something very different that gives you more reliable execution than
what I've experienced.
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: Fri, 22 Jan 1999 16:36:15 GMT
From: blakekr@my-dejanews.com
Subject: Undefining $1 after regexp match
Message-Id: <78a9du$2jf$1@nnrp1.dejanews.com>
*Very* dumb question here, but I can't find the answer in my books -- maybe my
approach is wrong.
I have a bunch of "source" documents that I need to open, parse and display.
So the script needs to know which element is a byline, an article, a title,
etc. The byline might show up before or after "title," though, and some
fields won't exist in every article. So I'm pattern-matching separately for
each, e.g.:
$filestring =~ /selections\|([^\|]*)\|/;$selections = $1;
$filestring =~ /bio\|([^\|]*)\|/; $bio = $1;
$filestring =~ /author\|([^\|]*)\|/; $author = $1;
The problem is, I don't know how to undefine $1 and its cousins after each
pattern match (obviously, "undef $1" doesn't do it). Help?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 22 Jan 1999 09:15:45 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Undefining $1 after regexp match
Message-Id: <MPG.11125220ad362e809899ba@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <78a9du$2jf$1@nnrp1.dejanews.com> on Fri, 22 Jan 1999
16:36:15 GMT, blakekr@my-dejanews.com <blakekr@my-dejanews.com> says...
...
> $filestring =~ /selections\|([^\|]*)\|/;$selections = $1;
> $filestring =~ /bio\|([^\|]*)\|/; $bio = $1;
> $filestring =~ /author\|([^\|]*)\|/; $author = $1;
>
> The problem is, I don't know how to undefine $1 and its cousins after each
> pattern match (obviously, "undef $1" doesn't do it). Help?
Assign conditionally depending on the success of the match. For
example,
$selections = $filestring =~ /selections\|([^\|]*)\|/ ? $1 : undef;
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 22 Jan 1999 18:30:10 +0100
From: Hendrik =?iso-8859-1?Q?W=F6rdehoff?= <woerdehoff@sdm.de>
Subject: Re: Undefining $1 after regexp match
Message-Id: <36A8B5A2.3C39FE53@sdm.de>
blakekr@my-dejanews.com wrote:
> $filestring =~ /selections\|([^\|]*)\|/;$selections = $1;
> $filestring =~ /bio\|([^\|]*)\|/; $bio = $1;
> $filestring =~ /author\|([^\|]*)\|/; $author = $1;
>
> The problem is, I don't know how to undefine $1 and its cousins after each
> pattern match (obviously, "undef $1" doesn't do it). Help?
Try
($selections) = ( $filestring =~ /selections\|([^\|]*)\|/ ) ;
# no need to initialise $selections beforehand
or use
$selections = undef;
$selections = $1 if $filestring =~ /selections\|([^\|]*)\|/;
or even
$selections = $filestring =~ /selections\|([^\|]*)\|/ ? $1 : undef;
Yours
Hendrik
Pursuant to US Code, Title 47, Chapter 5, Subchapter II, Sec. 227,
any and all unsolicited commercial E-mail sent to this address
is subject to a download and archival fee in the amount of $500
US (per infraction). E-mailing denotes acceptance of these terms.
--
Hendrik W"ordehoff |s |d &|m | software design & management
| | | | GmbH & Co. KG :
woerdehoff@sdm.de | | | | Thomas-Dehler-Str. 27 >B)
Tel/Fax (089) 63812-337/515 81737 M"unchen :
------------------------------
Date: Fri, 22 Jan 1999 17:31:03 +0100
From: "Uwe W. Gehring" <gehring@politik.uni-mainz.de>
Subject: win32::netadmin does not work
Message-Id: <36A8A7C7.E1DA0915@politik.uni-mainz.de>
After hours, I could not figure out why the following script does not
return the required values, except $NAME and $DOMAIN. I tried hard to
find FMs but nothing could help.
Sample Script:
# perltest.pl
use Win32::NetAdmin;
$NAME = Win32::LoginName;
print "Hallo $NAME!\n";
Win32::NetAdmin::UserGetAttributes("", $NAME, $PASSWORD,
$PWAGE, $PRIV, $HOMEDIR, $COMMENT, $FLAGS, $SCRIPTPATH);
print
"\$NAME=$NAME\n\$PASSWORD=$PASSWORD\n\$PWAGE=$PWAGE\n\$PRIV=$PRIV\n\$HOMEDIR=$HOMEDIR\n\$COMMENT=$COMMENT\n\$FLAGS=$FLAGS\n\$SCRIPTPATH=$SCRIPTPATH\n";
Win32::NetAdmin::GetDomainController("","",$DOMAIN);
print "\$DOMAIN=$DOMAIN\n";
exit;
Running with "perl -w ..." the answer is:
Name "Win32::NetAdmin::pack" used only once: possible typo at
..\lib/Win32/NetAd
min.pm line 186.
Hallo gehring!
Use of uninitialized value at u:\scripts\perltest.pl line 12.
Use of uninitialized value at u:\scripts\perltest.pl line 12.
Use of uninitialized value at u:\scripts\perltest.pl line 12.
Use of uninitialized value at u:\scripts\perltest.pl line 12.
Use of uninitialized value at u:\scripts\perltest.pl line 12.
Use of uninitialized value at u:\scripts\perltest.pl line 12.
Use of uninitialized value at u:\scripts\perltest.pl line 12.
$NAME=gehring
$PASSWORD=
$PWAGE=
$PRIV=
$HOMEDIR=
$COMMENT=
$FLAGS=
$SCRIPTPATH=
$DOMAIN=\\POLITIK-NTSRV1
Any Ideas?
TIA
------------------------------
Date: Fri, 22 Jan 1999 16:55:10 GMT
From: dhosek@webley.com
Subject: Re: Y2K?
Message-Id: <78aah9$3mp$1@nnrp1.dejanews.com>
In article <7883h3$2dc$1@client2.news.psi.net>,
abigail@fnx.com wrote:
> Tuomas Angervuori (tumppi@icon.fi) wrote on MCMLXIX September MCMXCIII in
> <URL:news:Un3NuHgI1diW-pn2-YtK140duKMbY@atte.dyn.icon.fi>:
> || I have a script which compares two dates.
> || -Clip-
> || ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> || localtime(time);
> || #if current date is newer than the one mared in data files, update...
> || if (($year == $year_data) and ($mon >= $mon_data)) {
> || if ($mday > $mday_data) {
> || &update;
> || }
> || }
> || if ($year > $year_data) {
> || &update;
> || }
> || -Clip-
> ||
> || $year_data, etc, are found from the data files.
> ||
> || As you might have noticed, this isn't year 2000 compatible.
> And why isn't it year 2000 compatible?
The fact that the localtime function returns a year in 2-digit format
confuses a lot of people who assume that this means that it will return 00
for the year 2000. It will, in fact return 100 for the year 2000. To convert
a year to 4-digit format (which presumably was the source of the original
poster's concern), it is adequate to simply add 1900 to the year. On the
other hand, if you're still using a 32-bit system in the year 2038, Unix date
functions in general will fail (or at least those that use seconds since
1970).
As the year progresses, this will probably become an increasingly frequently
asked question.
-dh
-----------== 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 4722
**************************************