[12867] in Perl-Users-Digest
Perl-Users Digest, Issue: 277 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 27 21:17:14 1999
Date: Tue, 27 Jul 1999 18:10:12 -0700 (PDT)
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, 27 Jul 1999 Volume: 9 Number: 277
Today's topics:
Re: POSIX module <trcull@my-deja.com>
Re: reg expression <llornkcor@llornkcor.com>
Re: Removing special characters in perl (Abigail)
Re: Selecting files by permisions (Abigail)
Re: Sending HTML emails from perl script <llornkcor@llornkcor.com>
Re: Simple form problem (elephant)
Re: Simple form problem (Abigail)
Re: Simple form problem (Abigail)
Re: stopping email overflow on failure (Abigail)
Re: stopping email overflow on failure <tchrist@mox.perl.com>
Re: This is just a test. Sorry. Don't reply. (Abigail)
Re: Using perl to ftp non interactively <llornkcor@llornkcor.com>
Re: Using perl to ftp non interactively (Abigail)
What's the deal -- with these hanging CGI scripts? <raceE@yahoo.com>
Re: Which group is appropriate? (Abigail)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 27 Jul 1999 23:21:26 GMT
From: Tim Cull <trcull@my-deja.com>
Subject: Re: POSIX module
Message-Id: <7nleth$snq$1@nnrp1.deja.com>
In article <379E09F2.71B25A1C@texas.net>,
Tom Briles <sariq@texas.net> wrote:
> Calm the heck down...the answers Tom and Abigail gave were perfectly
> reasonable.
They seemed pretty smart-allecky to me, but if I misread them I
apologize. Thus are the limitations of the printed form, I suppose.
> If you must try a web page, perhaps:
>
> http://theory.uwinnipeg.ca/CPAN/
>
That's perfect! It seems to be exactly what I was looking for, thank
you.
--Tim
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 27 Jul 1999 18:05:46 -0600
From: llornkcor <llornkcor@llornkcor.com>
Subject: Re: reg expression
Message-Id: <lnc17i5h.fsf@wind.localdomain>
My point is this:
If she is tired of answering stupid questions that may be answered in
the FAQ's, than why does she even bother to post any kind of message
at ALL, especially when it is degrading the poster. Just adding more
useless drivel to the group like this thread is doing.
--
llornkcor rocknroll
SpiritShip MultiMedia Recording Studio
www.llornkcor.com
(0 0)
+=======================----oOO--(_)--OOo----=========================+
__ _
/ / (_)__ __ ____ __
/ /__/ / _ \/ // /\ \/ /
/____/_/_//_/\_,_/ /_/\_\
The choice of a GNU generation...
------------------------------
Date: 27 Jul 1999 19:37:53 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Removing special characters in perl
Message-Id: <slrn7psk63.2er.abigail@alexandra.delanet.com>
ryan7879@my-deja.com (ryan7879@my-deja.com) wrote on MMCLVI September
MCMXCIII in <URL:news:7nlafh$q2a$1@nnrp1.deja.com>:
~~ I'm new to Perl and I am having trouble removing a "+" character from a
~~ string. The plus exists because the string has it's value submitted
~~ from one web page to another, so the blank spaces are url encoded. The
~~ following works for letters or combinations of letters, but fails on the
~~ s/+/ /g; line when a plus sign is involved. Does anyone know how to get
~~ around this?
Is there any reason for posting the same question multiple times?
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 27 Jul 1999 19:45:22 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Selecting files by permisions
Message-Id: <slrn7pskk6.2er.abigail@alexandra.delanet.com>
Keith Lee (leejk@cat.com) wrote on MMCLVI September MCMXCIII in
<URL:news:7nl825$dgi$1@ns1.cat.com>:
|| Hello,
|| I have been working on a little script to change the permissions of all
|| new files in a directory to 0644. This directory has over 5000 files in it,
|| so I would like to skip over files that are already set to 0644. I can't
|| seem to be able to compare the files permissions though. The code I have so
|| far does them all no matter if they are already set to 0644. I have tried
|| using -R -W -r in place of the stat function below, but I don't think you
|| can combine these together. Can anyone suggest a better approach to this?
||
|| unless ((stat($file))[2] eq 0644) {
This won't work because (stat $file) [2] returns more than the permission
bits - just as the manual say. Do something like:
unless (((stat $file) [2] & 07644) == 00644) { ... }
Or, if you don't care about suid, gid and sticky bits:
unless (((stat $file) [2] & 0644) == 0644) { ... }
Personally, I would just do a 'chmod 644 *' in the directory.
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 27 Jul 1999 17:59:24 -0600
From: llornkcor <llornkcor@llornkcor.com>
Subject: Re: Sending HTML emails from perl script
Message-Id: <oggx7ig3.fsf@wind.localdomain>
Might need to add this print line in your script, perhaps??
print "Content-type: text/html; charset=\n\n";
before the print "<tags>";
--
llornkcor rocknroll
SpiritShip MultiMedia Recording Studio
www.llornkcor.com
(0 0)
+=======================----oOO--(_)--OOo----=========================+
__ _
/ / (_)__ __ ____ __
/ /__/ / _ \/ // /\ \/ /
/____/_/_//_/\_,_/ /_/\_\
The choice of a GNU generation...
------------------------------
Date: Wed, 28 Jul 1999 09:54:10 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: Simple form problem
Message-Id: <MPG.1208f1abb2128edb989b92@news-server>
The Barry Family writes ..
>When I filled in the form and pressed submit, it listed all the
>enviromental variables fine, but it didn't show anything for the
>variables from the form. Does anyone know what the problem with this
>could be?
the code that you supplied here .. with the form HTML code that you
supplied here .. BOTH worked perfectly on my web server
I'd suggest that you TRIPLE check your HTML code to ensure that it is
exactly as it appears here .. I'm guessing that you've got a typo
somewhere there which means that the information on the form isn't being
submitted correctly
best actually if you just copy-and-paste the code from your usenet post
straight into your HTML file .. it worked for me
--
jason - remove all hyphens for email reply -
------------------------------
Date: 27 Jul 1999 19:53:46 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Simple form problem
Message-Id: <slrn7psl3t.2er.abigail@alexandra.delanet.com>
The Barry Family (jwbarry@ibm.net) wrote on MMCLVI September MCMXCIII in
<URL:news:379DF832.63C3662A@ibm.net>:
`` I am just beginning to learn how to use perl and I am having a problem
`` with submitting a form to a perl program. I am using the POST method.
`` When I say to submit, I want it to list each variable and what was typed
`` in it. I have seen examples of this working with other peoples pages,
`` and I can't figure out what I am doing wrong.
I guess it's lack of code....
Abigail
--
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print
qq{Just Another Perl Hacker\n}}}}}}}}}' |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 27 Jul 1999 19:56:54 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Simple form problem
Message-Id: <slrn7psl9q.2er.abigail@alexandra.delanet.com>
The Barry Family (jwbarry@ibm.net) wrote on MMCLVI September MCMXCIII in
<URL:news:379E14B1.7AEBE13A@ibm.net>:
'' I copied the code from a tutorial at
'' http://www.speakeasy.org/~cgires/cgi-tour.html directly to a test file
'' on my web page.
'' here is the code for that:
''
'' #!/usr/local/bin/perl
There's no -w.
There's no use strict;
There's no use CGI;
'' read(STDIN,$in,$ENV{'CONTENT_LENGTH'});
Well, how much *did* you read?
You should be using -w, use strict, and do use the standard CGI module
instead of rolling your own, flawed one.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 27 Jul 1999 18:15:45 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: stopping email overflow on failure
Message-Id: <slrn7psfc5.2er.abigail@alexandra.delanet.com>
I R A Darth Aggie (fl_aggie@thepentagon.com) wrote on MMCLVI September
MCMXCIII in <URL:news:slrn7pre44.b5m.fl_aggie@thepentagon.com>:
{} On Tue, 27 Jul 1999 01:24:46 GMT, Andrew Johnson <andrew-johnson@home.com>, i
{} <yT7n3.49$K%6.2928@news1.rdc2.on.home.com> wrote:
{} +
{} + perhaps the Schrodinger::Fish module would be more
{} + instructive as it seems the original poster is intent
{} + on not opening the box.
{}
{} Good point, but wouldn't that conflict with the Schrodinger::Cat
{} module?
Schrodingers cat doesn't like fish.
Abigail
--
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 27 Jul 1999 17:19:20 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: stopping email overflow on failure
Message-Id: <379e3e78@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
abigail@delanet.com writes:
:Schrodingers cat doesn't like fish.
However, he appreciates having an umlaut or an 'e' in his name. :-)
--tom
--
User n.:
A programmer who will believe anything you tell him.
------------------------------
Date: 27 Jul 1999 19:59:02 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: This is just a test. Sorry. Don't reply.
Message-Id: <slrn7psldq.2er.abigail@alexandra.delanet.com>
Michel Thibault (LMC) (lmcmith@lmc.ericsson.se) wrote on MMCLVI September
MCMXCIII in <URL:news:379DD60C.AE3B2C@lmc.ericsson.se>:
||
|| This is just a test. Sorry. Don't reply.
It failed. Your newsreader must be broken! Instead of a newsgroup
whose last component is 'test', it posted your test in a regular
newsgroup!
Consider getting a better newsreader.
Or does your newsreader need a better user?
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 27 Jul 1999 18:35:46 -0600
From: llornkcor <llornkcor@llornkcor.com>
Subject: Re: Using perl to ftp non interactively
Message-Id: <d7xd7grh.fsf@wind.localdomain>
"Keith" <keithcp@yahoo.com> writes:
I didn't write this, nor have I tried it out....
#!/usr/bin/perl -*-Perl-*-
# Usage:
# auto-upload -h (host) [-p (port)] -u (username) -w (password)
# (files)...
# e.g.
# auto-upload -h ftp.foo.com -u whoever -w whatever foo.txt bar.txt
require 5;
use IO::Socket;
# System error handler.
sub sys_err { die("$0: $!\n"); }
# Set program defaults.
sub set_defaults {
undef($host);
$port = 21;
undef($user);
undef($pwd);
@files = ();
}
# Parse the command line arguments.
sub parse_args {
my($arg, $last);
for $arg (@ARGV) {
if ($last) {
if ($last eq '-h')
{ $host = $arg; }
elsif ($last eq '-p')
{ $port = int($arg); }
elsif ($last eq '-u')
{ $user = $arg; }
elsif ($last eq '-w')
{ $pwd = $arg; }
undef($last);
}
elsif ($arg =~ /^-/) {
if ($arg =~ /^-[hpuw]$/)
{ $last = $arg; }
else
{ die("$0: unknown option\n"); }
}
else
{ push(@files, $arg); }
}
}
# Input a single line from a socket and echo it.
sub get_line {
my($sock) = @_;
my($in);
($in = <$sock>) =~ s/[\r\n]//g;
print("< $in\n");
return $in;
}
# Output a single line to a socket and echo it.
sub put_line {
my($sock, $out, $show) = @_;
print $sock ("$out\r\n");
if ($show)
{ print("> $show\n"); }
else
{ print("> $out\n"); }
}
# Main program.
set_defaults;
parse_args;
$host || die("$0: no host specified\n");
$user || die("$0: no user specified\n");
$pwd || die("$0: no password specified\n");
@files || die("$0: nothing to do\n");
$ftp = new IO::Socket::INET(Proto => 'tcp', PeerAddr => $host,
PeerPort => $port) || die("$0: cannot open control connection\n");
binmode($ftp);
$ftp->autoflush(1);
$state = 0;
while ($in = get_line($ftp)) {
next if ($in =~ /^...-/);
if ($state == 0) {
die if ($in !~ /^2/);
put_line($ftp, "USER $user");
$state = 1;
}
elsif ($state == 1) {
die if ($in !~ /^3/);
put_line($ftp, "PASS $pwd", "PASS (hidden)");
$state = 2;
}
elsif ($state == 2) {
die if ($in !~ /^2/);
put_line($ftp, "TYPE I");
$state = 3;
}
elsif ($state == 3) {
die if ($in !~ /^2/);
if (scalar(@files) == 0) {
put_line($ftp, "QUIT");
$state = 8;
next;
}
if ($files[0] =~ m:./:) {
$pos = index($files[0], '/', 1);
put_line($ftp, "MKD " . substr($files[0], 0, $pos));
$state = 4;
}
else {
put_line($ftp, "PASV");
$state = 5;
}
}
elsif ($state == 4) {
# ignore the return code
$pos = index($files[0], '/', $pos + 1);
if ($pos == -1) {
put_line($ftp, "PASV");
$state = 5;
}
else
{ put_line($ftp, "MKD " . substr($files[0], 0, $pos)); }
}
elsif ($state == 5) {
die if ($in !~ /^2/);
($h1, $h2, $h3, $h4, $p1, $p2) = $in =~
/(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)/;
$ftp_temp = new IO::Socket::INET(Proto => 'tcp',
PeerAddr => "$h1.$h2.$h3.$h4", PeerPort => $p1 * 256 + $p2) ||
die("$0: cannot open upload connection\n");
binmode($ftp_temp);
$ftp_temp->autoflush(1);
put_line($ftp, "STOR " . $files[0]);
$state = 6;
}
elsif ($state == 6) {
die if ($in !~ /^1/);
open(FH, $files[0]) || die("$0: cannot open file\n");
binmode(FH);
while (sysread(FH, $data, 16384)) {
$len = length($data);
syswrite($ftp_temp, $data, $len) == $len ||
die("$0: cannot transfer file\n");
}
close(FH);
close($ftp_temp);
shift(@files);
$state = 3;
}
else {
die if ($in !~ /^2/);
exit(0);
}
}
die;
>Can anyone tell me if there is a way to use ftp in a perl script.
>I believe that I might need to use a Here Document type of syntax but am not
>positive.
>Any help would be appreciated.
>Thanks.
>
>
--
llornkcor rocknroll
SpiritShip MultiMedia Recording Studio
www.llornkcor.com
(0 0)
+=======================----oOO--(_)--OOo----=========================+
__ _
/ / (_)__ __ ____ __
/ /__/ / _ \/ // /\ \/ /
/____/_/_//_/\_,_/ /_/\_\
The choice of a GNU generation...
------------------------------
Date: 27 Jul 1999 20:02:29 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Using perl to ftp non interactively
Message-Id: <slrn7pslk9.2er.abigail@alexandra.delanet.com>
Keith (keithcp@yahoo.com) wrote on MMCLVI September MCMXCIII in
<URL:news:7nkrlq$s3t$1@bmerhc5e.ca.nortel.com>:
{} Can anyone tell me if there is a way to use ftp in a perl script.
Yes, there is a module for that on CPAN.
{} I believe that I might need to use a Here Document type of syntax but am not
{} positive.
What makes you think that?
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Wed, 28 Jul 1999 00:28:40 GMT
From: "JME" <raceE@yahoo.com>
Subject: What's the deal -- with these hanging CGI scripts?
Message-Id: <Y8sn3.90$yZ1.7293@news.cwix.com>
Hi all,
THE SETUP:
I've got a Perl script that uses CGI and DBI libraries. It runs on an AIX
box running Perl version 5.004_04. Clients execute it and it creates a
dynamic html page. The traffic rate is about 3-4 hits per minute. The page
is displayed completely and the script exits successfully.
THE PROBLEM:
Even though the script exits successfully, occasionally (say, 1 out of 30
times) the process still hangs out there. If I execute a 'ps' command on
the command line, you can still see the process.
THE TEMPORARY FIX:
In the interim, while I try to debug this problem, I have a cron job that
runs hourly and kills process that have been out there too long. It works,
but it is obviously not the best solution.
THE QUESTION:
Any ideas why a script would hang after it seemingly completes? Obviously,
this is not a universal problem or you'd all be screaming about it. I could
upgrade to the latest release of Perl, but I don't think that's the
problem -- my development box, which is Sun Solaris, also uses 5.004_04 but
does not have this problem.
Thank you all!
JME
------------------------------
Date: 27 Jul 1999 18:57:50 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Which group is appropriate?
Message-Id: <slrn7pshr1.2er.abigail@alexandra.delanet.com>
Bart Lateur (bart.lateur@skynet.be) wrote on MMCLVI September MCMXCIII in
<URL:news:37a22214.14104135@news.skynet.be>:
'' Tad McClellan wrote:
''
'' > Your ISP is giving you a clue that the *don't maintain* their
'' > newserver when they include newsgroups that were removed
'' > *several years* ago.
''
'' I've written to my ISP about that. Their reply was that they had deleted
'' it several times already, but it got recreated automatically, as soon as
'' posts for this newsgroup arrive.
Then they have a broken setup.
'' I think that's a good thing. It shows that no manual intervention is
'' necessary for my ISP to add new newsgroups.
If you think this is the only way to add new newsgroups without manual
intervention, both you and your ISP are clueless.
Go learn about 'newgroup' control messages, grasshopper.
Abigail
--
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
|perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
|perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
|perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
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 V9 Issue 277
*************************************