[12806] in Perl-Users-Digest
Perl-Users Digest, Issue: 216 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 21 17:17:18 1999
Date: Wed, 21 Jul 1999 14:10:14 -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 Wed, 21 Jul 1999 Volume: 9 Number: 216
Today's topics:
Re: searching man pages, perldoc's, FAQ's, README's, HO <dchristensen@california.com>
Re: searching man pages, perldoc's, FAQ's, README's, HO <dchristensen@california.com>
Re: searching man pages, perldoc's, FAQ's, README's, HO <dbc@tc.fluke.com>
Re: Stipping HTML and loosing memory <swiftkid@bigfoot.com>
Re: Stipping HTML and loosing memory (Flint Slacker)
Re: Testing for the existing of a key in a hash (Tad McClellan)
Re: Testing for the existing of a key in a hash (Tad McClellan)
Timeout question <bmc@DELETEpeterboro.net>
Re: Timeout question <mail@netron.de>
Trouble with Error Message (Greg Shalette)
Uploading--HELP <formula@idirect.com>
waitpid crashes perl <Philip_Dye@norstanconsult.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 21 Jul 1999 11:41:50 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: searching man pages, perldoc's, FAQ's, README's, HOWTO's, etc.
Message-Id: <379612d7@news5.newsfeeds.com>
Hello, World!
>Is there a way to search man pages, perldoc's, FAQ's, README's,
>HOWTO's, etc.?
Another idea -- assign a shell variable that unglobs into the
filespecs of interest (you could also put this in your shell login
script, remember to export):
$ PERLPODS='/fsf/lib/perl5/*.pod'
Use the shell variable in a grep invokation (note the dollar sign):
$ grep -i serial $PERLPODS
--
David Christensen
dchristensen@california.com
-----------== 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, 21 Jul 1999 11:43:33 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: searching man pages, perldoc's, FAQ's, README's, HOWTO's, etc.
Message-Id: <379612da@news5.newsfeeds.com>
Hello, World!
Another solution...
-----Original Message-----
From: $Bill Luebkert <dbe@wgn.net>
To: David Christensen <dchristensen@california.com>
Date: Saturday, July 17, 1999 1:15 AM
Subject: Re: searching man pages, perldoc's, FAQ's, README's,
HOWTO's, etc.
>David Christensen wrote:
>>
>> Hello, World!
>>
>> Is there a way to search man pages, perldoc's, FAQ's, README's,
>> HOWTO's, etc.?
>
>I just combined all of the man pages into one file and use vi(m)
to
>search in the file. Easier than other suggestions and you get
context
>which you don't get in grep.
>
>You can find a script to combine the pages or get the combined
pages
>at my webjump/freeyellow sites.
>
>--
> ,-/- __ _ _ $Bill Luebkert ICQ=14439852
> (_/ / ) // // DBE Collectibles
http://www.wgn.net/~dbe/
> / ) /--< o // // Mailto:dbe@wgn.net
http://dbecoll.webjump.com/
>-/-' /___/_<_</_</_ http://www.freeyellow.com/members/dbecoll/
-----------== 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, 21 Jul 1999 12:55:11 -0700
From: Dan Carson <dbc@tc.fluke.com>
Subject: Re: searching man pages, perldoc's, FAQ's, README's, HOWTO's, etc.
Message-Id: <Pine.LNX.3.95.990721124330.3272A-100000@dbc-pc>
>> Is there a way to search man pages, perldoc's, FAQ's, README's,
>> HOWTO's, etc.?
>
>I just combined all of the man pages into one file and use vi(m)
to
>search in the file. Easier than other suggestions and you get
context
>which you don't get in grep.
I like to use 'less'. If you begin a search string with '*', 'less'
doesn't stop at EOF, but continues through all the files in the argument
list. And '@' starts the search with the first file. Handy in general,
and in the specific case of perl pods I use the following script (which
calls 'less').
Tastes great!
-Dan
#!/usr/bin/perl
use Config '%Config';
$poddir = $Config{privlibexp}.'/pod';
chdir $poddir;
$podlist = "perl.pod";
open(LIST,$podlist) || die "Can't read $poddir/$podlist\n";
while (<LIST>) {
next if /^\s*$/;
if (/^\s+(perl\S*)\s+Perl /) {
push(@x,"$1.pod");
$seen{"$1.pod"} = 1;
}
elsif (%seen) {
last;
}
}
for (<*.pod>) {
push(@x, $_) unless $seen{$_};
}
exec "less @x";
------------------------------
Date: Wed, 21 Jul 1999 22:56:52 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Stipping HTML and loosing memory
Message-Id: <7n65b3$eva2@news.cyber.net.pk>
: my($htmlref);
my $htmlref;
would do.
:
: $htmlref = HTML::FormatText->new;
: $_[0] = $htmlref->format(parse_html($_[0]));
:
: undef $htmlref; # Free memory ????
When you sub exists, it is automatically cleaned up because
of my()
: return($_[0]);
Only:
$_[0]
should work.
------------------------------
Date: Wed, 21 Jul 1999 22:02:58 GMT
From: flint@tcn.net (Flint Slacker)
Subject: Re: Stipping HTML and loosing memory
Message-Id: <379a42b5.20692940@news.remarq.com>
Faisal, I believe its creating a circular list, which would mean that
its referring to itself, in that case automatic cleanup will fail.
Flint
On Wed, 21 Jul 1999 22:56:52 +0500, "Faisal Nasim"
<swiftkid@bigfoot.com> wrote:
>: my($htmlref);
>
>my $htmlref;
>would do.
>
>:
>: $htmlref = HTML::FormatText->new;
>: $_[0] = $htmlref->format(parse_html($_[0]));
>:
>: undef $htmlref; # Free memory ????
>
>When you sub exists, it is automatically cleaned up because
>of my()
>
>: return($_[0]);
>
>Only:
>
>$_[0]
>
>should work.
>
------------------------------
Date: Wed, 21 Jul 1999 10:26:24 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Testing for the existing of a key in a hash
Message-Id: <gal4n7.3g8.ln@magna.metronet.com>
Marshall Culpepper (marshalc@americasm01.nt.com) wrote:
: Bruno Pagis wrote:
: > Is there a better way than
: > if ($hash{$key} eq ".")
: > to know that a key has no entry in a hash ?
^^^^^^^^^^^^
print "can't find key '$key'\n" unless exists $hash{$key};
: > I figured out that when a key does not exist, I get a dot returned for
: > the value, but I'm not even sure that it is "standard".
It is not standard.
In fact is exceedingly strange.
Something is broken, or you aren't telling us something...
: this may be what you're looking for:
: if !defined($hash{$key})
: and yes i did test it :)
But it does not test for existence!
It tests for definedness.
They are not the same thing.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 21 Jul 1999 10:40:25 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Testing for the existing of a key in a hash
Message-Id: <p4m4n7.jh8.ln@magna.metronet.com>
Faisal Nasim (swiftkid@bigfoot.com) wrote:
: : Is there a better way than
: : if ($hash{$key} eq ".")
: unless ( $hash { $key } )
Tests if $hash{$key} is TRUE/FALSE, not the same as existence
: unless ( defined $hash { $key } )
Tests if $hash{$key} is defined, not the same as existence
: if ( ! defined $hash { $key } )
ditto.
: if ( ! exists $hash { $key } )
There you go!
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 21 Jul 1999 18:13:54 GMT
From: "Bruce McFarlane" <bmc@DELETEpeterboro.net>
Subject: Timeout question
Message-Id: <C5ol3.1$uc.153@198.235.216.4>
The following block works 99% of the time but occasional the inevitable =
happens and it goes into a loop. Does perl have a timeout function and =
can I add it to this block somehow?
while (($tname eq $sname) || ($xname =3D~ /$sname/m)) {
&retry;
}
bmc
------------------------------
Date: Wed, 21 Jul 1999 20:26:55 +0200
From: Mike Eiringhaus <mail@netron.de>
Subject: Re: Timeout question
Message-Id: <379610EF.218F5A9B@netron.de>
Bruce McFarlane wrote:
> The following block works 99% of the time but occasional the inevitable happens and it goes into a loop. Does perl have a timeout function and can I add it to this block somehow?
>
> while (($tname eq $sname) || ($xname =~ /$sname/m)) {
> &retry;
> }
Try the following:
for($i=XXX; $i && ($tname eq $sname) || ($xname =~ /$sname/m); $i--) {
&retry;
}
# Where XXX is the max loop count.
Mike Eiringhaus
------------------------------
Date: 21 Jul 1999 15:05:41 -0400
From: gshalet@panix.com (Greg Shalette)
Subject: Trouble with Error Message
Message-Id: <7n55m5$94g$1@panix3.panix.com>
The statement:
substr($in{"long_description"}, $TempPos, 0) = "<br>";
where $TempPos is a variable that was just incremented,
is causing the following error message:
"Premature end of script headers"
Other Information:
This is a CGI script which is putting a <br> tag into a string every so often.
The reason that this error is weird is that that if I were to replace, just for
testing purposes, the $TempPos with an integer, or even set a new
variable that hasn't already been incremented earlier in the program
to equal an integer, it works fine. What could have possibly happened to
this variable to cause that error?
--
Greg Shalette
gshalet@panix.com
------------------------------
Date: Wed, 21 Jul 1999 16:32:15 -0400
From: Bill <formula@idirect.com>
Subject: Uploading--HELP
Message-Id: <37962E4F.578A0A11@idirect.com>
Just a quick question.......
This script works in netscape 4.51 but not in Explorer5.0. It is a perl
script and I have been trying to make it go in both browsers. I will
foward the perl script to you.
Here is the deal.
ftp_launch.html is suppose to bring up a form that allows you to choose
a picture file of you harddrive. Once it has been selected it is suppose
to send it to a cgi-bin using the 'put' command and execute the perl
script file ftp.pl. Ftp.pl should execute the perl script that basicly
takes the file name that you selected and sends it to a ftp server. The
ftp.pl file automatically logs into the ftp server and automatically
sends the file you selected. If all goes well it displays a success
page if not it displays a unseccessful page. Well in Netscape it works
fine. The file gets to the ftp server and all is good. However the
problem is with IE5.0. It tries to do it but what happens is the
unsuccessful page comes back and nothing is left at the ftp server. I
think it is something with the "put" command for IE5.0 but I am not sure
what to do to the ftp.pl file to accomodate this browser. If you have a
moment could you look over the script below and see if you can come up
with anything....Muchly appreciated...
THE HTML CODE- ftp_launch.html
<form ACTION="http://www.gatewayreproductions.com/cgi-bin/ftp.pl"
METHOD="put" ENCTYPE="multipart/form-data">
<p>Filename:<br>
<input NAME="file" TYPE="file"><br>
<input TYPE="submit"> </font></p>
</form>
THE PERL CODE
#!/usr/bin/perl
# the above line must be the entire path to where perl resides on
# the WEB server.
#
# This perl script expects to be run thusly:
# % ftp.pl ftp_hostname userid password path/filename
# where ftp_hostname is the name of the ftp server to transfer to,
# userid is the username that is used to connect to the ftp server,
# password is the password for the userid on the ftp server,
# and path/filename is the entire path and filename of the file to
transfer
# import the CPAN file "FTP.pm" for use in this script
#
use Net::FTP;
use CGI;
$query = new CGI;
# Grab/set appropriate variables
$file = $query->param('file');
# chop everything out except the filename
@win_array = split (/\\/,$file);
@unix_array = split(/\//,$file);
$hostname = "ftp.easyhosting.com";
$username = "xxxxxx";
$password = "xxxxxx";
$success_page =
"http://www.gatewayreproductions.com/ftp/yoursuccesspage.html";
$failure_page =
"http://www.gatewayreproductions.com/ftp/yourfailpage.html";
# YOU SHOULD NOT NEED TO CHANGE ANYTHING BELOW THIS LINE
# ALL OF THE CONTROLLING VALUES FOR THIS SCRIPT ARE ABOVE HERE
# ----------------------------------------------------------
$rc = $ftp = Net::FTP->new("$hostname");
# attempt to login using the userid and password. ARGV[1] is the
# userid while ARGV[2] is the password
#
$rc = $ftp->login($username, $password);
# ensure that ftp uses BINARY to transfer the file
$rc = $ftp->binary();
# attemp to upload the file using the 'put' command, ARGV[3] is the
# file name
#
$save_file = $win_array[-1];
$rc = $ftp->put($file,$save_file);
if (!$rc) {
$save_file = $unix_array[-1];
$rc = $ftp->put($file,$save_file);
}
# disconnect from the ftp server to ensure a clean session
if($rc) {
print "Location: $success_page\n\n";
} else {
print "Location: $failure_page\n\n";
}
exit;
Cheers.........
Bill Stevenson
------------------------------
Date: Wed, 21 Jul 1999 20:31:01 GMT
From: "Philip H. Dye" <Philip_Dye@norstanconsult.com>
Subject: waitpid crashes perl
Message-Id: <01bed3b8$ec4460e0$918ee226@phdye-laptop>
When running within a signal handler, POSIX waitpid() causes perl to crash
deep under its perl implementation malloc() gets called while the main
thread is also executing malloc().
Has anyone run into this behavior before ? Any known work arounds ?
This has been plaguing me since I wrote this application for a client and
I'd really like to close the book on this issue. It would also result in a
large company maintaining a medium size Data Warehouse using perl.
Please to Philip_Dye@norstanconsult.com since I'm not on the list every
day.
Thanks,
Philip
------------------------------
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 216
*************************************