[18224] in Perl-Users-Digest
Perl-Users Digest, Issue: 392 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 1 21:05:45 2001
Date: Thu, 1 Mar 2001 18:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <983498712-v10-i392@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 1 Mar 2001 Volume: 10 Number: 392
Today's topics:
Re: Display Delay in Perl? <mjcarman@home.com>
Re: Guidance on printed output <flavell@mail.cern.ch>
Help Matt with small programs <mshort@usol.com>
Re: Help Matt with small programs <brondsema@my-deja.com>
Re: Here is the script i'm working on = internal server <flavell@mail.cern.ch>
Re: Here is the script i'm working on = internal server <krahnj@acm.org>
Re: How the CLPM turns <wyzelli@yahoo.com>
Looking for better sources <hafateltec@hotmail.com>
Re: Net::Telnet to AS/400 (David Efflandt)
No server error now but the nothing revoves from the li <fabianos@telia.com>
No server error now but the nothing revoves from the li <fabianos@telia.com>
Re: No server error now but the nothing revoves from th <billk@cts.com>
Re: Perl, Cookies, and Apache. <parrot0123@yahoo.ca>
Re: Perl, Cookies, and Apache. <parrot0123@yahoo.ca>
Re: Perl, Cookies, and Apache. (Sam Holden)
Re: Perl, Cookies, and Apache. <DNess@Home.Com>
Re: Perl, Cookies, and Apache. <parrot0123@yahoo.ca>
Re: Perl, Cookies, and Apache. <parrot0123@yahoo.ca>
Re: Perl, Cookies, and Apache. <hafateltec@hotmail.com>
Re: Perl, Cookies, and Apache. <parrot0123@yahoo.ca>
Re: perlpod docs? <bwalton@rochester.rr.com>
Re: Please help - Find files recursively by File::Find <krahnj@acm.org>
Re: Please help - Find files recursively by File::Find (Tad McClellan)
Re: problem with mkdir (Monte)
Re: problem with mkdir <godzilla@stomp.stomp.tokyo>
Re: Problem with Regular Expression Match <krahnj@acm.org>
Re: Problem with Regular Expression Match <godzilla@stomp.stomp.tokyo>
Re: referer() and https? (reader of news)
Re: REGEX GURU HELP NEEDED.... <bwalton@rochester.rr.com>
Re: regex help please <bart.lateur@skynet.be>
sendmail problem <brondsema@my-deja.com>
Re: use strict; (Tad McClellan)
Re: use strict; (Abigail)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 01 Mar 2001 16:26:38 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: Display Delay in Perl?
Message-Id: <3A9ECC9E.A9962588@home.com>
Anno Siegel wrote:
>
> According to Abigail <abigail@foad.org>:
>>
>> Turn buffering off:
>>
>> perl -we '$| = 1; map {sleep print} "Hello" =~ /./g'
>
> Gee, you can give this special twist to just any program. What if
> you want a two-second delay? Oh, I know, override print().
What startles me isn't that Abigail can put a twist to any program --
it's that it always seems to be the first way he thinks of.
-mjc
------------------------------
Date: Fri, 2 Mar 2001 00:05:41 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Guidance on printed output
Message-Id: <Pine.LNX.4.30.0103012356130.28084-100000@lxplus003.cern.ch>
On Thu, 1 Mar 2001, Michael Carman wrote:
> > <P STYLE="page-break-after: always">
>
> This has nothing to do with Perl.
Right, so the poster should seek accurate information in a more
appropriate place.
> It's an HTML thing,
No it isn't. The working parts are CSS, merely enclosed in HTML.
> and I suspect that
> it's a browser-specific extension at that.
Nope.
http://www.w3.org/TR/REC-CSS2/page.html#page-break-props
> If you take this approach,
> you'll want to go to an HTML group
comp.infosystems.www.authoring.stylesheets , really
> and ask how to force page breaks in
^^^^^
"Force" doesn't work on the WWW. Some browsers support this open
published specification, some don't, but that doesn't make it a
browser-specific extension. CSS makes proposals or suggestions, which
a client agent can honour or disregard.
Bon soir.
------------------------------
Date: Thu, 1 Mar 2001 20:58:50 -0800
From: "mshort" <mshort@usol.com>
Subject: Help Matt with small programs
Message-Id: <t9tvemc4keu151@corp.supernews.com>
Perl People,
I worked on this problem for about an hour and gave up. And it was labeled
easy!!
You have to fix this prg with a NEXT and LAST statements, even though there
is a more efficient way with a FOR loop. The program should print out every
multiple of 5, from 0 to 100.
$num=0;
while ($num>=0){
#####Insert code#####
print "$num ";
$num++;
}
Ok here's one program that I did that I THOUGHT should just print 0 through
100 and then exit
$num=0;
while ($num>=0){
next if ($num==0);
last if $num==100;
print "$num ";$num++;
}
I couldn't get this one to work either:
$num=0;
while ($num>=0){
next if (int($num / 5) != ($num/5));
last if $num==100;
print "$num ";$num++;
}
Any help would be greatly appreciated.
Sincerely,
Matt
------------------------------
Date: Fri, 02 Mar 2001 02:04:41 GMT
From: "Dave Brondsema" <brondsema@my-deja.com>
Subject: Re: Help Matt with small programs
Message-Id: <ZcDn6.15359$W05.3643876@news1.rdc1.mi.home.com>
"mshort" <mshort@usol.com> wrote in message
news:t9tvemc4keu151@corp.supernews.com...
> Perl People,
>
> I worked on this problem for about an hour and gave up. And it was
labeled
> easy!!
>
> You have to fix this prg with a NEXT and LAST statements, even though
there
> is a more efficient way with a FOR loop. The program should print out
every
> multiple of 5, from 0 to 100.
>
> $num=0;
> while ($num>=0){
>
> #####Insert code#####
>
> print "$num ";
> $num++;
> }
>
> Ok here's one program that I did that I THOUGHT should just print 0
through
> 100 and then exit
>
> $num=0;
> while ($num>=0){
> next if ($num==0);
> last if $num==100;
> print "$num ";$num++;
> }
>
>
> I couldn't get this one to work either:
>
> $num=0;
> while ($num>=0){
> next if (int($num / 5) != ($num/5));
> last if $num==100;
> print "$num ";$num++;
> }
>
> Any help would be greatly appreciated.
>
> Sincerely,
>
> Matt
>
>
My first programming teacher always told us to "pretend you're the
computer". Go through line by line and do what the computer would do,
writing down the values of any variables as they change. Let's do this with
your first program.
1> $num=0;
2> while ($num>=0){
3> next if ($num==0);
4> last if $num==100;
5> print "$num ";$num++;
6> }
line 1: num is 0, write that down
line 2: num is >= 0, so the code in the while block will execute
line 3: is num == 0? yes. so we do the loop again. we directly go back to
line 2
line 2: num is >= 0, so the code in the while block will execute
line 3: is num == 0? yes. so we do the loop again. we directly go back to
line 2
...
see the problem? on line three, the loop starts over without changing the
value of $num. This is an infinite loop.
Now try it yourself for the 2nd program.
Dave Brondsema
------------------------------
Date: Thu, 1 Mar 2001 23:46:07 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Here is the script i'm working on = internal server error
Message-Id: <Pine.LNX.4.30.0103012335240.21914-100000@lxplus003.cern.ch>
On Thu, 1 Mar 2001, John W. Krahn wrote:
> "Fabian Thorbjörnsson" wrote:
[...]
> > open (FILE, ">>" . $file) or die "cannot open file for appending: $!";
> ^^
> You are opening the file for output
As the O.P said, "for appending".
> and are then trying to read from it. This won't work.
It surely can, after proper positioning first.
> open FILE, "<" . $file or die "cannot open $file for input: $!";
How is this supposed to help, since the O.P wishes to lock the file
exclusively and then write to it?
> > flock (FILE, 2) or die "cannot lock file exclusively: $!";
^^^_ (comment on this later)
> > my @emailfile = <FILE>;
> > seek FILE, 0, 0;
> > truncate FILE, 0;
See? You have even quoted the lines that contradicted your answer,
without apparently having anything to say about them.
This is pretty much the situation as in the FAQ, isn't it? There
the solution used is sysopen(FH, "numfile", O_RDWR|O_CREAT) , but
it can work just as well using open-for-append and then seek.
I believe that the currently-recommended way of dealing with flock
constants is to use the constants defined in Fcntl, rather than
writing numeric constants into the code.
--
This .sig only acknowledges that the message was displayed on
the recipient's machine. There is no guarantee that the
content has been read or understood.
------------------------------
Date: Fri, 02 Mar 2001 01:38:47 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Here is the script i'm working on = internal server error
Message-Id: <3A9EFAF0.E21F8F3A@acm.org>
"Alan J. Flavell" wrote:
>
> On Thu, 1 Mar 2001, John W. Krahn wrote:
>
> > "Fabian Thorbjörnsson" wrote:
> [...]
> > > open (FILE, ">>" . $file) or die "cannot open file for appending: $!";
> > ^^
> > You are opening the file for output
>
> As the O.P said, "for appending".
>
> > and are then trying to read from it. This won't work.
>
> It surely can, after proper positioning first.
Maybe I'm reading perlopentut wrong but it says that:
open(FH, ">> $path");
is equivalent to:
sysopen(FH, $path, O_WRONLY | O_APPEND | O_CREAT);
where O_WRONLY apparently means _write only_
The OP probably wanted:
open (FILE, "+<" . $file)
John
------------------------------
Date: Fri, 2 Mar 2001 09:45:58 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: How the CLPM turns
Message-Id: <asBn6.11$GN1.3344@vic.nntp.telstra.net>
"Brad Baxter" <bmb@ginger.libs.uga.edu> wrote in message
news:Pine.A41.4.21.0103011433270.15630-100000@ginger.libs.uga.edu...
>
> By the way, I tried Abigail's sort routine and it's not working.
> What am I doing wrong?
>
You realise it is case sensitive?
Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass
it around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";
------------------------------
Date: Fri, 2 Mar 2001 11:42:28 +1000
From: "Copenhagen" <hafateltec@hotmail.com>
Subject: Looking for better sources
Message-Id: <NUCn6.8$Bd.2949622@news.randori.com>
I am looking for a source with sample source, tutorials, faqs ect.. on
working with wml / wap in perl. Any help is appriciated. Haven't found
much via websearches. And preferably in english also.
--
WOW Only two days...
Give me a couple more and I will script the world into being :)
------------------------------
Date: Fri, 2 Mar 2001 01:55:48 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Net::Telnet to AS/400
Message-Id: <slrn99tvcg.mp6.efflandt@efflandt.xnet.com>
On Wed, 28 Feb 2001, Dallas Haselhorst <dallas@haysmed.com> wrote:
>Does anyone currently use Net::Telnet for telnetting to an AS/400? If so,
>what type of configuration do you use? In addition, I've been unable to find
>any modules that would do this. Any help on this matter would be greatly
>appreciated, Dallas.
>
>P.S. I'm able to telnet to the system and even run quite a few command as
>long as I use all of the commands in a single cmd() statement (separated by
>\n's and \t's of course); unfortunately, this method simply isn't very clean
>and has lots of other flaws.
I don't know AS/400, but you probably just need to figure out what it uses
for a prompt and set that, or tail of it, for the Prompt for the
connection. Sometimes that can be hard to do if the prompt contains
invisible ANSI escape sequences (like when I set a colored prompt on my
Linux box).
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: Thu, 01 Mar 2001 23:22:58 GMT
From: "Fabian" <fabianos@telia.com>
Subject: No server error now but the nothing revoves from the list
Message-Id: <mRAn6.21174$AH6.2914858@newsc.telia.net>
#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
my $file = '/home/markisspecialisten/www/guestmail.htm'; ## Exempet visar my
framför & ' istället för "
open FILE, "<" . $file or die "cannot open $file for input: $!";
flock (FILE, 2) or die "cannot lock file exclusively: $!";
my @emailfile = <FILE>; # read it into @emailfile
seek FILE, 0, 0; # move to the beginning of the file and then
truncate FILE, 0; # remove all content from it
foreach $line (@emailfile)
{
if ($line !~ /^\Q$email/o)
{
print FILE $line; # we don't need a newline, since the file had them
when we read it into memory.
}
}
close (FILE) or die "cannot close message file: $!";
open (FILE, "<$file") or die "cannot open file for appending: $!";
------------------------------
Date: Thu, 01 Mar 2001 23:24:13 GMT
From: "Fabian" <fabianos@telia.com>
Subject: No server error now but the nothing revoves from the list
Message-Id: <xSAn6.21176$AH6.2914812@newsc.telia.net>
#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
my $file = '/home/markisspecialisten/www/guestmail.htm'; ## Exempet visar my
framför & ' istället för "
open FILE, "<" . $file or die "cannot open $file for input: $!";
flock (FILE, 2) or die "cannot lock file exclusively: $!";
my @emailfile = <FILE>; # read it into @emailfile
seek FILE, 0, 0; # move to the beginning of the file and then
truncate FILE, 0; # remove all content from it
foreach $line (@emailfile)
{
if ($line !~ /^\Q$email/o)
{
print FILE $line; # we don't need a newline, since the file had them
when we read it into memory.
}
}
close (FILE) or die "cannot close message file: $!";
open (FILE, "<$file") or die "cannot open file for appending: $!";
------------------------------
Date: Fri, 02 Mar 2001 01:18:35 GMT
From: "Bill Kelly" <billk@cts.com>
Subject: Re: No server error now but the nothing revoves from the list
Message-Id: <LxCn6.101156$GV2.22749936@typhoon.san.rr.com>
"Fabian" <fabianos@telia.com> wrote:
>
[code snipped]
I've rearranged your program somewhat, and added use of a
separate locking file because . . . well, to demonstrate
that that is another possible approach, I guess - and I
think it makes it easier to deal with the main text file
you're working with. (Just my own opinion.)
I've also added 'use strict;' . . . and explicitly defined
the $email variable because I don't know where you'd intended
that to be set.
So, here is one approach:
-Bill
#!/usr/bin/perl -w
use strict;
use Fcntl qw(:flock);
print "Content-type: text/html\n\n";
my $file = '/home/markisspecialisten/www/guestmail.htm'; ## Exempet visar my framför & ' istället för "
my $lockfile = "$file.lock";
open LOCKFILE, ">>$lockfile" or die "cannot open lock file $lockfile: $!";
flock(LOCKFILE, LOCK_EX) or die "cannot lock file exclusively: $!";
open FILE, "<$file" or die "cannot open $file for input: $!";
my @emailfile = <FILE>; # read it into @emailfile
close (FILE) or die "cannot close message file: $!";
open FILE, ">$file" or die "cannot open $file for output: $!";
my $email = 'someone@somewhere'; # Where does this get set ? ? ?
my $line;
foreach $line (@emailfile)
{
if ($line !~ /^\Q$email/o)
{
print FILE $line; # we don't need a newline, since the file had them when we read it into memory.
}
}
close (FILE) or die "cannot close final message file: $!";
close (LOCKFILE) or die "cannot close lock file: $!";
# (end)
------------------------------
Date: Thu, 01 Mar 2001 23:41:18 GMT
From: "Parrot" <parrot0123@yahoo.ca>
Subject: Re: Perl, Cookies, and Apache.
Message-Id: <y6Bn6.346473$JT5.11426422@news20.bellglobal.com>
Okay, look - I appreciate your answer, but not your final rude comment. I
posted in this newsgroup because I wanted some help, and I thought perhaps
it might have something to do with the Perl code. It seems that's not the
case, but you still have no reason to be offended by my posting that
question here.
Even though it turned out not to be so much related to Perl, it seems that I
have gotten some help here from users who are knowledgable about this -
that's what we're here for after all, right? To help each other out? Is it
a crime if the answer turns out to be a little more off topic than I
thought? I don't think so.
> As has been pointed out this has nothing whatever to do with Perl so
> please stop asking about it here.
------------------------------
Date: Fri, 02 Mar 2001 00:10:12 GMT
From: "Parrot" <parrot0123@yahoo.ca>
Subject: Re: Perl, Cookies, and Apache.
Message-Id: <ExBn6.346898$JT5.11430072@news20.bellglobal.com>
As for your other comment here about me posting jeopardy-style : why the
heck does the way I quote offend you? I find that top-posting is better in
many cases, and I like to use it. What possible problem is there with that?
<nobull@mail.com> wrote in message news:u9n1b5o034.fsf@wcl-l.bham.ac.uk...
> "Parrot" <parrot0123@yahoo.ca> writes jeopary-style. I do not know if
> this is due to ignorance, lazyness, stupidity or a positive desire to
> cause offence. Perhaps he'd like to enlighten us.
>
------------------------------
Date: 2 Mar 2001 00:36:25 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl, Cookies, and Apache.
Message-Id: <slrn99tqo9.1fd.sholden@pgrad.cs.usyd.edu.au>
On Fri, 02 Mar 2001 00:10:12 GMT, Parrot <parrot0123@yahoo.ca> wrote:
>As for your other comment here about me posting jeopardy-style : why the
>heck does the way I quote offend you? I find that top-posting is better in
>many cases, and I like to use it. What possible problem is there with that?
Lots of people find it hard to read - especially in deeply nested
threads - since the sense of context to what you are replying to is lost.
You are free to post in whatever style you want (with some restrictions
on placing kiddie-porn and other such things in your message - but that
depends on what country your in I guess).
However, in this group there seems that there is some correlation between
leven of 'expertness' in perl and dislike of jeopardy posts. If you don't
care that the people most likely to be able to help you, or just hold a
decent conversation don't read your posts, that's fine - just keep on
jeopardy posting.
--
Sam Holden
------------------------------
Date: Fri, 02 Mar 2001 00:36:36 GMT
From: David Ness <DNess@Home.Com>
Subject: Re: Perl, Cookies, and Apache.
Message-Id: <3A9EEB18.B9076B3@Home.Com>
Parrot wrote:
>
> As for your other comment here about me posting jeopardy-style : why the
> heck does the way I quote offend you? I find that top-posting is better in
> many cases, and I like to use it. What possible problem is there with that?
>
You may be only an occasional visitor here, but there are lots of people who work
hard and read hundreds of messages. They have found that jeopardy-style quoting
_does not work well_ when you have to deal with lots of messages.
Since they do the work it is not only polite to follow their rules, you may
well find that people neglect you if you don't. As you want their help, it
is probably wise to follow their procedures.
------------------------------
Date: Fri, 02 Mar 2001 00:52:44 GMT
From: "Parrot" <parrot0123@yahoo.ca>
Subject: Re: Perl, Cookies, and Apache.
Message-Id: <w9Cn6.347100$JT5.11436673@news20.bellglobal.com>
Sam Holden <sholden@pgrad.cs.usyd.edu.au> wrote in message
news:slrn99tqo9.1fd.sholden@pgrad.cs.usyd.edu.au...
> On Fri, 02 Mar 2001 00:10:12 GMT, Parrot <parrot0123@yahoo.ca> wrote:
>
> Lots of people find it hard to read - especially in deeply nested
> threads - since the sense of context to what you are replying to is lost.
Sam - thanks for giving me information in a civil manner, it's nice to know
that there are newsgroup users who do that.
I'd like to explain though - I find jeopard posting to be much more
efficient in cases, like this one, where you are only giving a response on
one thing. Message right up there clear at the top, much preferable. I'll
admit that the other way is much better with complicated messages where you
have more than one thought to respond to. In those cases it's much better
to quote each topic before responding to it.
I'm not a regular newsgroup poster, so I didn't know that there was some
sort of 'taboo' against jeopardy posting. I've been posting messages on
BBS's and such since my early teens though, and frequent many internet
message boards. Frankly I find the idea that somebody can get royally pissed
over the way you quote a message to be absurd.
Frankly, people flaming me about it doesn't give me much incentive to
conform - however, I realize that not everybody in this group is like that,
so if they all find posts easier to read that way, then I'll do it.
------------------------------
Date: Fri, 02 Mar 2001 01:06:16 GMT
From: "Parrot" <parrot0123@yahoo.ca>
Subject: Re: Perl, Cookies, and Apache.
Message-Id: <cmCn6.347210$JT5.11438531@news20.bellglobal.com>
David Ness <DNess@Home.Com> wrote in message
news:3A9EEB18.B9076B3@Home.Com...
> Parrot wrote:
>
> You may be only an occasional visitor here, but there are lots of people
who work
> hard and read hundreds of messages. They have found that jeopardy-style
quoting
> _does not work well_ when you have to deal with lots of messages.
>
> Since they do the work it is not only polite to follow their rules, you
may
> well find that people neglect you if you don't. As you want their help, it
> is probably wise to follow their procedures.
Fair enough David, I can understand that. I still think it's inapropriate
to jump down somebody's throat for quoting in a way that you don't like. If
they want to neglect the messages that don't conform to their quoting style,
they have that right. Flaming somebody for their quoting style though is
excessive, and doesn't help anybody. I can understand not wanting to deal
with a message that you find hard to read, but I can't understand being
OFFENDED by that very same message.
Thank you though, for explaining things to me in a reasonable, flameless
manner.
------------------------------
Date: Fri, 2 Mar 2001 11:18:42 +1000
From: "Copenhagen" <hafateltec@hotmail.com>
Subject: Re: Perl, Cookies, and Apache.
Message-Id: <lyCn6.2$Bd.5505102@news.randori.com>
"Parrot" <parrot0123@yahoo.ca> wrote in message
news:cmCn6.347210$JT5.11438531@news20.bellglobal.com...
> David Ness <DNess@Home.Com> wrote in message
> news:3A9EEB18.B9076B3@Home.Com...
> > Parrot wrote:
> >
> > You may be only an occasional visitor here, but there are lots of people
> who work
> > hard and read hundreds of messages. They have found that jeopardy-style
> quoting
> > _does not work well_ when you have to deal with lots of messages.
> >
> > Since they do the work it is not only polite to follow their rules, you
> may
> > well find that people neglect you if you don't. As you want their help,
it
> > is probably wise to follow their procedures.
>
> Fair enough David, I can understand that. I still think it's inapropriate
> to jump down somebody's throat for quoting in a way that you don't like.
If
> they want to neglect the messages that don't conform to their quoting
style,
> they have that right. Flaming somebody for their quoting style though is
> excessive, and doesn't help anybody. I can understand not wanting to deal
> with a message that you find hard to read, but I can't understand being
> OFFENDED by that very same message.
>
> Thank you though, for explaining things to me in a reasonable, flameless
> manner.
>
>
I happen to agree that some posters in this group just love to flame over
jeopardy-style quoting. A simple "Please do not post in jeopardy-style
quoting manner" would suffice.
------------------------------
Date: Fri, 02 Mar 2001 01:48:33 GMT
From: "Parrot" <parrot0123@yahoo.ca>
Subject: Re: Perl, Cookies, and Apache.
Message-Id: <RZCn6.347548$JT5.11444131@news20.bellglobal.com>
> Use anything you like so long as it's got at least 2 dots in it. Just
> make sure that the web server is configured to belive this is its
> server name and that the resolver on the client is configured to
> believe this name corresponds to the IP address of the server.
Hey Nobull, I'm still offended at the way you jumped down my throat like
that, but you did help me fix the problem I was having - so thank you.
------------------------------
Date: Fri, 02 Mar 2001 01:46:37 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: perlpod docs?
Message-Id: <3A9EFC7B.9B43C652@rochester.rr.com>
ivo welch wrote:
>
> I have been trying to decipher the perlpod documentation. not clear at
> all. (For example, the docs did not mention that one needed a "=cut"
> after the "=head" statements. pod2html complains about wanting a title,
> but this is nowhere described either.) A couple of complete example
> files (with perl) would definitely help...has anyone put together a page
> of examples?
>
> /iaw
At your command prompt, type:
perldoc perlpod
to learn MTYEWTK. Also, you hard drive already has megabytes of POD
examples on it. Look at the code for any Perl module.
--
Bob Walton
------------------------------
Date: Thu, 01 Mar 2001 23:33:55 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Please help - Find files recursively by File::Find
Message-Id: <3A9EDDA8.78272AF9@acm.org>
Luke wrote:
>
> I'm trying to find all the .log files recursively within a big directory.
> I already got it working with this:
>
> use File::Find;
> find(\&wanted,"$root_dir");
> sub wanted {
> $names{$File::Find::name}++ if /\.log$/;
> }
>
> Now I'd like to list only the .log files that are 4 days old. How do I
> go for doing this?
Do you want only files that are exactly four days old or all files that
are four or more days old?
perldoc -f stat
John
------------------------------
Date: Thu, 1 Mar 2001 18:10:40 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Please help - Find files recursively by File::Find
Message-Id: <slrn99tlng.mbv.tadmc@tadmc26.august.net>
Luke <cub@lukebsd.com> wrote:
>I'm trying to find all the .log files recursively within a big directory.
>I already got it working with this:
>
>use File::Find;
>Now I'd like to list only the .log files that are 4 days old. How do I
>go for doing this?
$names{$File::Find::name}++ if /\.log$/ and int(-M) == 4;
perldoc -f -M
perldoc -f int
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 02 Mar 2001 00:55:47 GMT
From: montep@about.com (Monte)
Subject: Re: problem with mkdir
Message-Id: <3a9fef50.51699349@news.hal-pc.org>
On Thu, 01 Mar 2001 12:30:45 -0800, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
>Jason Wong wrote:
> I tried to create a directory in a remote machine
> (web hosting folder) using the following codes,
> which works fine on my own computer:
Godzirra>You cannot create files nor directories on a
>remote machine without direct access such as
>telnet, ftp, a script installed within this
>remote machine or other similar devices.
>
>There is nothing within your example indicating a need
>for cgi-lib nor a need for a read and parse. Your comments,
>as well, do not indicate a need for this.
>
>You indicate you are running this as a cgi script.
>A return of a content type is a minimal must, as
>displayed by my test script below my signature.
>
>Godzilla!
Godzilla/Kiri
Go back to your Apple II. The world of Unix and IIs is too
complicated for you, particularly if you forget your medication.
His problem is:
1. A permissions problem
2. A coding problem.
Most probably the first and definitely the second.
f your gonna spam.....
admin@loopback, $LOGIN@localhost, $LOGNAME@localhost,
$USER@localhost, $USER@$HOST, -h1024@localhost, root@mailloop.com
root@localhost, postmaster@localhost, admin@localhost, abuse@localhost
Chairman Reed Hundt: rhundt@fcc.gov
Commissioner James Quello: jquello@fcc.gov
Commissioner Susan Ness: sness@fcc.gov
Commissioner Rachelle Chong: rchong@fcc.gov
US Postal Service: customer@email.usps.gov
Fraud Watch: fraudinfo@psinet.com
Pyramid Schemes: pyramid@ftc.gov
Federal Trade Commission: consumerline@ftc.gov
net-abuse@nocs.insp.irs.gov
------------------------------
Date: Thu, 01 Mar 2001 17:49:13 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: problem with mkdir
Message-Id: <3A9EFC19.D4C6951E@stomp.stomp.tokyo>
Monte wrote:
> Godzilla! wrote:
> >Jason Wong wrote:
(snipped)
> Godzilla/Kiri
> Go back to your Apple II. The world of Unix and IIs is too
> complicated for you, particularly if you forget your medication.
I would never consider using an Apple/Macintosh.
An Apple/Macintosh is nothing more than an
accessorized Etch-A-Sketch.
Godzilla!
------------------------------
Date: Thu, 01 Mar 2001 23:22:39 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Problem with Regular Expression Match
Message-Id: <3A9EDB14.52595E8E@acm.org>
J Garcia wrote:
>
> I am reading comments from a Web form textbox into a
> $comments scalar and then wherever there is an empty
> line, replacing it with <P> using the following:
>
> $comments =~ s/^\n*$/<P>/mg;
>
> After previewing the form, if the user chooses to make
> a submission, <P> is supposed to be replaced
> with <P> using the following:
>
> $comments =~ s/(<P>)/<P>/mg;
>
> After the record is written to a plain text
> pipe-delimited database file, I check the file but do
> not find any occurences of <P> in the $comments field
> in the database (the blank lines inserted by the user
> in the textbox should be replaced with <P> which is
> what I am trying to do).
>
> After trying everything I could think of, I have not
> been able to figure why the substitution is not
> working. I would really like any help I can get with
> this. Any help would be greatly appreciated. Thanks a
> lot.
$ perl -e '$_ = "This is a \n line of \n\n text with \n\n some newlines
\n in it\n"; print "$_\n"; s/^\n*$/<P>/mg; print "$_\n";
s/(<P>)/<P>/mg; print "$_\n";'
This is a
line of
text with
some newlines
in it
This is a
line of
<P>
text with
<P>
some newlines
in it
This is a
line of
<P>
text with
<P>
some newlines
in it
Is this not doing what you wanted? If not, please show us your code and
explain what it is or is not doing correctly.
John
------------------------------
Date: Thu, 01 Mar 2001 17:16:07 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Problem with Regular Expression Match
Message-Id: <3A9EF457.5015FAC2@stomp.stomp.tokyo>
J Garcia wrote:
(snippage)
> I am reading comments from a Web form textbox into a
> $comments scalar and then wherever there is an empty
> line, replacing it with <P> using the following:
> $comments =~ s/^\n*$/<P>/mg;
Return from an html enabled form action text "AREA"
field, cursor inside, when Enter is hit, will be:
\r\n
This is true in all cases. I have never discovered
any valid exceptions to this rule, no exceptions
claimed which I could at least duplicate. Safe to
presume your return will be \r\n whenever Enter
is hit within a textarea field. This does not
hold true for a simple 'textbox' type submission.
Your $comments =~ s/^\n*$/<P>/mg; is looking
for a match of a line beginning with \n and will
never find this for two reasons. You will not have
a line beginning with \n because you are dealing
with single line input and, a blank line will be
\r\n\r\n in all cases for textarea fields with
Enter being hit twice to create a paragraph break.
Even if Enter is hit as the first textarea entry,
\r will be the very first character, never \n first.
It is always, \r\n for html form textarea submissions.
Your end of line dollar sign $ is not needed and will
create additional problems trying to match your single
line string input. This \r\n will be found mixed in
with your data, when Enter is hit.
These are your magic lines:
$in{Test_Text} =~ s/\r\n\r\n/<P>\n/g;
$in{Test_Text} =~ s/\r\n/<BR>\n/g;
They must be in the precedence order shown. There
is no reason for your intermediate step of using
< and > when writing to your database. I have
added \n with <P> and <BR> to preserve a decent
look in your document source. These \n following
<P> and following <BR> can be removed if you like.
There is a lot of flexibility on these substitutions,
but you need to be very cautious on your match parameters.
Don't break up \r\n\r\n if you want a match for a paragraph
break in your data string.
You commented using a pipe for a delimiter in your
database. Use of metacharacters for delimiters is
a very poor choice and often creates problems. Use
something other than a metacharacter.
Following my signature, there is a test script with
which you may play. It is ready to use. Name this
script test2.cgi for operation. Change it, break it,
fix it and, you will discover how a form action
textfield works and, discover many ways to write
code which will accomplish your stated task.
Godzilla!
--
Be careful about word wrap on my textarea line.
If it is split up, a blank space will precede
your text in this textarea field. It must be
a single line with </TEXTAREA> at the end.
#!perl
print "Content-type: text/html\n\n
<HTML><BODY>
<BR><BR><BR>
<FORM METHOD=\"post\" ACTION=\"test2.cgi\">
<INPUT TYPE=\"submit\" NAME=\"Test\" VALUE=\"Test This\">
<BR>
<TEXTAREA NAME=\"Test_Text\" ROWS=\"3\" COLS=\"65\"
WRAP=\"VIRTUAL\"></TEXTAREA>
</FORM>
<P>\n\n";
&Parse;
sub Parse
{ # Parse #
local (*in) = @_ if @_;
my ($input, $key, $value);
read(STDIN, $in, $ENV{CONTENT_LENGTH});
@in = split(/&/, $in);
foreach $input (0 .. $#in)
{
$in[$input] =~ s/\+/ /g;
($key, $value) = split (/=/, $in[$input], 2);
($value eq "") && next;
$key =~ s/%(..)/pack("c",hex($1))/ge;
$value =~ s/%(..)/pack("c",hex($1))/ge;
$in{$key} .= "\0" if (defined($in{$key}));
$in{$key} .= $value;
}
return 1;
} # Parse #
print "
Incoming:
<XMP>
$in{Test_Text}
</XMP>\n\n";
$in{Test_Text} =~ s/\r\n\r\n/<P>\n/g;
$in{Test_Text} =~ s/\r\n/<BR>\n/g;
print "
Outgoing:
<XMP>
$in{Test_Text}
</XMP>\n\n";
print "
HTML Format:
<P>
$in{Test_Text}
</BODY></HTML>";
exit;
------------------------------
Date: 1 Mar 2001 20:56:01 -0500
From: newsreader@mediaone.net (reader of news)
Subject: Re: referer() and https?
Message-Id: <3a9efdb1@oit.umass.edu>
With opera browser you can switch on or off
sending referer string
On 01 Mar 2001 14:48:36 -0800,
Micah Cowan <micah@cowanbox.com> wrote:
>"John Hall" <jhall@ifxonline.com> writes:
>
>> I have more information;
>>
>> This _does_ work on Netscape, so apparently it's an IE 5.5 problem. ! Daft!
>>
>> Since this isn't the right list for browser issues, i'll pose a different
>> question:
>>
>> Is there another method to get the "referer"?
>
>the Referer field isn't guaranteed to be provided in any case. One
>might argue that, for once, Microsoft is doing the right thing in this
>case, since it may not be prudent to divulge the URL of a connection
>which was supposed to be secure. Providing it, though, isn't
>necessarily the wrong thing, either.
>
>Micah
------------------------------
Date: Fri, 02 Mar 2001 01:39:17 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: REGEX GURU HELP NEEDED....
Message-Id: <3A9EFABD.5D431C6C@rochester.rr.com>
"news.voyagernet.com" wrote:
...
> I just started working with REGEX's and it is lotsa fun, but kinda
> complicated. I am trying to create a REGEX that will let me pull apart a
> sting that would have a name in it.
>
> The name could be in the format:
>
> FNAME LNAME
> LNAME, FNAME
> FNAME LNAME, SUFFIX ( Jr, III )
> and any other "standard formats" for writing out a full name.
>
...
> Bill
Did you try to use Lingua::EN::NameParse; ? It might save you a lot of
effort, since this has already been well done. And, of course, you can
see how it was done just by looking.
--
Bob Walton
------------------------------
Date: Fri, 02 Mar 2001 01:40:30 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: regex help please
Message-Id: <1ttt9t04dod7nt8mblp455bo38sda8nhrj@4ax.com>
The Mosquito ScriptKiddiot wrote:
>i mean, as for the first example,
>it could easily be derived...why is there a need to simplify it to 5x??
Because I don't want to stop at the first derivative. I wanted to go on,
and on, and on, and eventually get a decent Taylor polynomial
approximation for certain functions. If you don't simplyfy, you easily
get 5 terms after the first derivation, 30 at the second, 150 at the
third, etc. It easily blows up. Usually, these terms are closely
related, for example the same variables but a different constant scaling
factor. Grouping these together reduces the effect of blow-up, lowers
memory consumption (and execution time, when you continue doing
derivations), and make the end result more readable.
--
Bart.
------------------------------
Date: Fri, 02 Mar 2001 01:56:17 GMT
From: "Dave Brondsema" <brondsema@my-deja.com>
Subject: sendmail problem
Message-Id: <55Dn6.15338$W05.3639010@news1.rdc1.mi.home.com>
I have a simple perl CGI program to send out newsletters. I haven't really
used sendmail before and I'm having problems. When the following line is
included, I get a server 500 error. When it's not, I get no errors.
open (SENDMAIL, "| /usr/sbin/sendmail -t -n") or die "can't open sendmail:
$!";
I have included use CGI::Carp qw(fatalsToBrowser); at the top of the
program.
perl version 5.00503
/usr/sbin/sendmail is the correct location for this server (f2s.com if you
care)
Any help would be appreciated, thanks!
Dave Brondsema
------------------------------
Date: Thu, 1 Mar 2001 18:29:39 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: use strict;
Message-Id: <slrn99tmr3.mga.tadmc@tadmc26.august.net>
Todd Anderson <todd@mrnoitall.com> wrote:
>Dear persons,
>Is it true with... "use Strict;"
I am not familiar with that module.
There is a similarly named pragma though: "use strict".
Maybe that's what you meant?
>you can't ... " require 'files.pl';
Uhh, that depends on what is in files.pl and what code was
executed before the "require".
Try putting a little more care into phrasing the question and
you will get better answers.
The answer to your questions is:
we do not have enough information to answer your question
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 2 Mar 2001 01:07:48 GMT
From: abigail@foad.org (Abigail)
Subject: Re: use strict;
Message-Id: <slrn99tsj4.8nt.abigail@tsathoggua.rlyeh.net>
Todd Anderson (todd@mrnoitall.com) wrote on MMDCCXXXIX September MCMXCIII
in <URL:news:3A9EC602.C399F46C@mrnoitall.com>:
-: Dear persons,
-: Is it true with... "use Strict;" you can't ... " require 'files.pl';
-: " ?
-:
What happened when you tried?
Abigail
--
my $qr = qr/^.+?(;).+?\1|;Just another Perl Hacker;|;.+$/;
$qr =~ s/$qr//g;
print $qr, "\n";
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V10 Issue 392
**************************************