[7952] in Perl-Users-Digest
Perl-Users Digest, Issue: 1577 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jan 4 08:08:21 1998
Date: Sun, 4 Jan 98 05:00:42 -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 Sun, 4 Jan 1998 Volume: 8 Number: 1577
Today's topics:
Re: @ARGV variabele looses its contents (Daryn Sharp)
Re: chomp ($&) to remove specific \n <joseph@5sigma.com>
Find two strings in a file boggiano@venus.it
GD for Win32 <RConover@wyellowstone.com>
h2ph <dkubilo@oxnardsd.org>
HTML Templates...Whats the best method (Martyr)
introductions... (synthe omicron)
Re: Is it possible to upload a file to another server i (Clay Irving)
Re: perl is c worsened (was: Re: word wrap routine) <joseph@5sigma.com>
Re: Perl not Y2K compliant (Michal Jaegermann)
Re: Perl Trick? <persoft@cris.com>
Perl, SQL, and Parsing <matan@kinetica.com>
Re: PERLIPC - FIFO: parent, child, stalled! (Justin Vallon)
redirection using Location <webmaster@createyourweb.com>
search script that can search logical expressions <charliewu@worldnet.att.net>
Re: sending email (Net::SMTP).. problem <spam@spam.spam>
Re: Socket ? (Daryn Sharp)
Re: time module? (Clay Irving)
Trouble with Print Location <maxim@online.sinor.ru>
Why stripper not work? Anyone Bar Tom as he seems to an <shadowweb@worsdall.demon.co.uk>
Re: Writing a "nice" server? (Justin Vallon)
Re: www.roth.net <adavid@netinfo.com.au>
Re: www.roth.net <adavid@netinfo.com.au>
Re: www.roth.net <jhi@alpha.hut.fi>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 04 Jan 1998 02:30:38 -0600
From: daryn@cambert.com (Daryn Sharp)
Subject: Re: @ARGV variabele looses its contents
Message-Id: <daryn-0401980230390001@term17.wolfram.com>
In article <34AEB14F.CEB81E5A@tip.nl>, Arno den Ridder
<a.den.ridder@tip.nl> wrote:
> After entering a sub my @ARGV variabele looses its contents.
> I start perl with "perl name.pl filename.txt"
> The result is
> test1 : filename.txt
> test2 : filename.txt
> test3 :
> lines : 99278
>
> Why is test3 empty?
Because the <> construct will iterate through each and every file on the
command line (or STDIN if @ARGV is empty). After each file is read, it is
shift-ed off @ARGV. As a result, the "for" loop in your script isn't
really doing what you think it is doing.
> =====
> #script name.pl
> sub analyse {
> print "test2 : $filename\n";
> while (<>) {
> $nr_lines++;
> }
> }
>
> for $filename (@ARGV) {
> print "test1 : $filename\n";
> analyse ();
> print "test3 : $filename\n";
> }
>
> print "lines : $nr_lines\n";
--
Daryn Sharp
(Speaking solely for myself)
------------------------------
Date: Sun, 04 Jan 1998 02:27:43 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: chomp ($&) to remove specific \n
Message-Id: <34AF559C.6FDB35E@5sigma.com>
Suppose you want to get rid of newlines when they are
preceded by "Boo!". Then:
s/(Boo!)\n+/$1/g;
-joseph
http://www.effectiveperl.com
Webmaster wrote:
>
> I would really get length of substring and rindex the beginning/end, as the
> case may be :-)
>
> But, chomp will ONLY chomp off the last \n
------------------------------
Date: Sat, 03 Jan 1998 17:04:09 GMT
From: boggiano@venus.it
Subject: Find two strings in a file
Message-Id: <34ae6f5a.2388034@news.venus.it>
Hi all,
i must write a program for matching 2 strings (AND)
in a file.
The file might have the strings on different rows,
so i can't use the statment:
if ((/$string1)&&(/$string2))
also, i can't use:
if (/$string1/)||(/$string2/)
{
$flag=1;
}
if ((/$stringa1/)||(/$stringa2/)&& flag=1)
{
print "Match!\n";
}
becuse i risk to find the same string on different rows.
Some can help me ?
I can't use s.o commands (grep,find..)
I 'd like to write a program easy to upgrade.
Reply (if possible) to : boggiano@venus.it
Thank you very much!
Alessandro
------------------------------
Date: Sat, 3 Jan 1998 22:34:49 -0700
From: "Clifford R. Conover" <RConover@wyellowstone.com>
Subject: GD for Win32
Message-Id: <68n7bu$585@bigblue.montana.net>
To all,
I am having problems obtaining the latest version of GD for Win32. When I
try to connect to ftp.roth.net I get a site not found error.
I would appreciate it if you could inform me where I could obtain a version
of the Win32::GD for build 314.
Thank you,
Rusty Conover
RConover@wyellowstone.com
------------------------------
Date: Sun, 04 Jan 1998 01:30:29 -0800
From: Dan Kubilos <dkubilo@oxnardsd.org>
Subject: h2ph
Message-Id: <34AF56B4.2F80@oxnardsd.org>
I just installed 5.04. on sparc running sunos4_1. All went well
except. . .
I was forced to install in /var/perl/ This was no problem but,
When I run h2ph as per instructed I get nowhere. I cd to /usr/include
(as root)
when I type h2ph *.h */*.h I get the following
a.out.h -> a.out.ph
Can't create a.out.ph: No such file or directory.
I suspect this is related to installing in /var/perl/ since the docs
mention that h2ph defaults to installing in /usr/bin/perl/lib (or
something close to that if my memory isn't totally fried)
Any suggestions appreciated.
Dan Kubilos
------------------------------
Date: Sun, 04 Jan 1998 10:22:03 GMT
From: martyr@bluecrow.com (Martyr)
Subject: HTML Templates...Whats the best method
Message-Id: <34af6152.50387730@news.bluecrow.com>
I am writing some scripts for a website and I want to
use HTML templates. What is the best way to go about
this? Are there any modules out there to help with this?
The way I was thinking of doing it is one of these:
a) Read the template file in line by line and doing multiple
substitutions on each line, then printing it out.
Seems very inefficient.
b) Read the entire template file into a variable and do
multiple substitutions on that. However, I would
like to add things like table rows - the number and
contents of which are only known at run time.
I am relatively new to Perl. Any help would be much
appreciated.
Thanks in advance,
Shah
------------------------------
Date: 4 Jan 98 09:01:40 GMT
From: synthe@wizvax.net (synthe omicron)
Subject: introductions...
Message-Id: <34af4ff4.0@news.wizvax.net>
Just a small post to introduce myself, as we all did back in the olden
days of USENET =)
Just recently got interested in Perl after getting disgusted with C, I
finally picked up _Learning Perl_ by Schwartz, Christiansen, and Wall.
I am *not* disappointed!
I'm currently doing some Perl beta-testing for a friend, who's developed
some rather unique Perl socket programs.
That seems to be it for now. Viva Perl! =)
--
<---------------------------------------------------------------------------->
synthe omicron <synthe@wizvax.net> http://www.wizvax.net/synthe/
RSA PGP KEY - bits/keyID: 1024/DAA3BE7 Date: 1997/11/17
Fingerprint = 35A6 DDE4 B686 CA65 E352 B4EC 9550 8A55
Slackware & Perl = the slacker-hacker's combo. Why NT when you can SLACK off ?
<---------------------------------------------------------------------------->
------------------------------
Date: 4 Jan 1998 07:45:17 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Is it possible to upload a file to another server in pearl?
Message-Id: <68o08t$qft@panix.com>
In <34AE9A15.335@netway.at> Roland Rauch <Rauch@netway.at> writes:
>Is it possible that a pearl script uploads a html file to another mirror
>server, so when this file gets updated it would be updated on the mirror
>too?
Yes.
Some folks have written programs to mirror Web servers. For example, go
to Perl Reference <http://reference.perl.com> and search on 'mirror':
w3mir
w3mir is a featurefull mirroring package that can do recursive
mirroring and copying of documents using the http protocol. (You
can also get single documents if you want, or several single
documents for that matter)
WebMirror
Recursively mirror remote WWW sites to a local directory, adjusting
links while doing so so you can browse the files locally. WebMirror
can be ordered to follow outbound links 1 level deep without saving
them, so it can be used to verify the correctness of links in a
hierarchy, too.
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Sat, 03 Jan 1998 23:54:49 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: perl is c worsened (was: Re: word wrap routine)
Message-Id: <34AF31C9.3921729D@5sigma.com>
Oh, come on, that delimiter thing is getting old now. :-)
-joseph
Eli the Bearded wrote:
> $_ = qq ' fun \n' ;
------------------------------
Date: 4 Jan 1998 05:40:01 GMT
From: michal@gortel.phys.ualberta.ca (Michal Jaegermann)
Subject: Re: Perl not Y2K compliant
Message-Id: <68n7bh$okq$1@pulp.ucs.ualberta.ca>
Michael J Gebis (gebis@albrecht.ecn.purdue.edu) wrote:
: michal@gortel.phys.ualberta.ca (Michal Jaegermann) writes:
: }$ perl -lwe 'print scalar localtime (1 << 55)'
: }Sat Jun 12 23:26:08 1141709097
:
: }Should last for a while.
:
: That's the sort of attitude that got us into this mess in the first
: place.
Oh, I would rather worry that this likely will not be "Sat Jun 12"
as a slowdown of a globe rotation will cause quite a bit of shift
by that time. Apart of that you will still have a few bits in
a 64-bit counter. It looks like that you will have to start to
trouble yourself with an amount of an available star fuel in our Sun
before you will hit that other wall. :-)
--mj
------------------------------
Date: Sun, 4 Jan 1998 04:37:06 -0600
From: "Sam Iron" <persoft@cris.com>
Subject: Re: Perl Trick?
Message-Id: <68np8e$7ce@examiner.concentric.net>
Reading between the lines, my guess is that you should be looking into
server side INCLUDES in your (s)html code.
>Besides having a java program execute a perl prog: does anyone know
>of a way of having a perl program execute as soon as a page is accessed?
------------------------------
Date: 4 Jan 1998 09:23:52 GMT
From: "Matan Amir" <matan@kinetica.com>
Subject: Perl, SQL, and Parsing
Message-Id: <01bd18f1$36f43180$11965ac2@matan.kinetica.com>
I want to make an engine similar to AltaVista's advanced search. The user
would come to a command line, enter a complex search string (including
"("'s for precedence, ands, ors, nots, can includes, etc.).
This "equation" would then be parsed by Perl (maybe in PerlScript in ASP if
possible), and the Perl program would create an SQL query with the
parameters, which would return the results.
I was wondering if anyone has created a module that would help me do this,
or have any suggestions or ideas on the best way to approach this
(hopefully someone who's tried/done this before). It would save me time.
I've got a solid idea on how to do it, but again,anyone that has tried this
could help me speed up the process.
Thanks in advance.
------------------------------
Date: Sun, 4 Jan 1998 07:28:29 -0500
From: vallon@mindspring.com (Justin Vallon)
Subject: Re: PERLIPC - FIFO: parent, child, stalled!
Message-Id: <1998010407282912183@user-38lcfdf.dialup.mindspring.com>
Jihad Battikha <jbattikha@highsynth.com> wrote:
> Tom Phoenix wrote:
...
> > > pipe(FROM_CHILD, TO_PARENT);
> > > $pid = fork;
> >
> > You should check whether the fork call succeeded, and possibly whether the
> > pipe call did as well.
>
...
> That's right. When the process forks, this condition checks to see itf
> it's the parent. Is that wrong in this case? Since the first condition
> checks for child, I'm assuming the next condition should check for
> parent, and the last condition returns an error if it's neither (or
> there wasn't any process space left for my user ID).
According to perl5, "undef == 0", so your test is not correct.
A typical fork call will look something like the following:
my $pid = fork();
if (undef $pid) {
# Error: $!
} elsif (!$pid) {
# Child.
# Do stuff.
exit 0;
}
# Parent goes on. Child pid is $pid.
# Join up with child.
my $wait_pid = wait;
die "missing child" if $wait_pid == -1;
die "unexpected child" if $wait_pid != $pid;
You should probably set '$| = 1' at the top of your script. fork can
double-flush stdout if you have buffered output.
>
> Here's the modified script that's still hanging on me...at this point I
> think I should be inserting an alarm-based "terminator" in the child
> process to avoid all those zombies I'm probably leaving on the remote
> server (yes, I'm a novice, I know... :-)
>
> Please note in this version of the script I'm using PGP in the process &
> it's meant for CGI usage.
>
> ---- start newer script ----
> #!/usr/local/bin/perl -w
>
> chdir;
> $ENV{PATH} .= ":/etc:/usr/etc:/sbin:/usr/bin";
> $FIFO = "$ENV{DOCUMENT_ROOT}/temp/cryptpipe.txt";
> $encrypted = "$ENV{DOCUMENT_ROOT}/temp/data.txt.pgp";
> $pgpcmd = '/path/to/account/pgp/pgpe -at -r user@domain.com
> --pubring=/path/to/account/pgp/pubring.pkr';
>
A word of caution: you might want to put your PID ($$ or $PID) in the
temp files that you use:
$FIFO = "$ENV{DOCUMENT_ROOT}/temp/cryptpipe.$$.txt";
That way, simultaneous executions will use different file names.
$| = 1; # When forking, don't buffer stdout.
> $pid = fork;
>
Your FIFO should exist before you fork. With 'sleep(2)', you make the
assumption that the child will run within the two seconds, and create
the FIFO. That is a bad style, especially on a machine that may be
busy, or where the file server is slow.
Rather, create the FIFO up front:
# Always unlink it. You don't want to reuse an old pipe.
unlink $FIFO;
if (system('mknod', $FIFO, 'p')) {
&error('mkfifo');
}
# Similar to system("mknod $FIFO p")
I am not on a Unix machine. Is the command 'mknod PATH p'?
my $pid = fork;
if (undef $pid) { error("fork failed: $!"); }
elsif ($pid == 0) { # child
open(OUT, ">$FIFO") || &error('open fifo');
print OUT "Text to encrypt...\n";
close(OUT) || &error('close fifo');
exit 0;
}
> if ($pid == 0) { # child
> unless (-p $FIFO) {
> unlink $FIFO;
> system('mknod', $FIFO, 'p') || &error('mkfifo');
This is not right. system() returns 0 if mknod was successful. This
would fail if mknod succeeded, and your FIFO would never be written.
That may be the problem.
> }
> # I'm thinking that this below where I'm stalling.
> # Would flushing the buffer help here? How would I
> # do this? Using $|=1;? Would I place that before
> # the blocking process? Shouldn't the parent process
> # be able to continue? I don't have access to the
> # POSIX module, so I can't use WNOHANG in the parent.
> open (FIFO, "> $FIFO") || &error('open fifo'); # to block
^^^^ ^^^^
Don't use FIFO as the name of a variable and the name of a file handle.
At best, it's hard to read. At worst, it could confuse perl.
> print FIFO "Text to encrypt...\n";
> close FIFO;
> exit(0);
> }
# Else, Parent
# It looks like you just want to run $pgpcmd. There is no need for the
# piped open.
unlink $encrypted;
system("$pgpcmd -o $encrypted $FIFO") && &error('pgp failed');
# Call error if system returns non-zero.
> elsif (defined $pid) { # parent
> sleep(2); # give child a head start in life
> unlink $encrypted;
> open(PGP,"| $pgpcmd -o $encrypted $FIFO") || &error('pgp failed');
> close(PGP);
# The child will have exited at this point.
if (wait != $pid) {
&error("unexpected pid");
}
# Tidy up.
unlink $FIFO;
> unlink $FIFO;
> print "Content-type: text/html\n\n";
> &build_header;
> print "Data encrypted via \$FIFO ($FIFO).<br>\n";
> print "Command line: $pgpcmd -o $encrypted $FIFO.<br>\n";
> &build_footer;
...
print "This\nThat\n";
print `cat $encrypted`;
print "other\n";
> exit;
> }
> else {
> print "Content-type: text/html\n\n";
> &error('no process space');
> }
>
> sub error {
> my ($error,@error_fields) = @_;
> &build_header;
> if ($error =~ /mkfifo/) {
> print "There was a MKFIFO error.<br>\n";
> } elsif ($error =~ /open fifo/) {
> print "There was a OPEN FIFO error.<br>\n";
> } elsif ($error =~ /pgp failed/) {
> print "There was a PGP FAILED error.<br>\n";
> } elsif ($error =~ /no process space/) {
> print "There was a NO PROCESS SPACE error.<br>\n";
> } else {
> print "There was an unknown error.<br>\n";
> }
> &build_footer;
> exit;
exit 1;
> }
>
> sub build_header {
> print "<html>\n";
> print "<head>\n";
> print "<title></title>\n";
> print "<body>\n";
> }
>
> sub build_footer {
> print "</body></html>\n";
> }
> __END__
> ---- end newer script ----
>
> Thank you for all the help. I'll take whatever I can get. :-))
>
> P.S. Normally, I'd use STDIN/STDOUT (IPC::Open2 or IPC::Open3) with PGP
> rather than a named pipe, but there's a bug with the 5.5 version of PGP
> (on Windows95/NT) that defaults to using 'stdin' as the decrypted file
> name. Hence, the need for a named pipe.
>
Dealing with two processes (your pipe writer and pgp) simultaneously
significantly increases the complexity of the program. For example, if
the pipe writer process fails to open the pipe (for whatever reason),
the pgp process will never get EOF on the pipe, and will block.
Typically, the above code will work, but to be safer, you could
explicitly do two forks:
sub PipeWriter {
my ($text) = @_;
open(OUT, ">$FIFO") || die "open: $!";
print OUT $text;
close(OUT) || die "close: $!";
exit 0;
}
sub ExecPGP {
exec("$pgpcmd -o $encrypted $FIFO");
die "exec failed: $!";
}
sub WaitTwoChildren {
# Could be generalized to WaitChildren, taking a list
# of children to wait for.
my ($pipe_writer, $pgp_runner) = @_;
# Wait for first child.
my $first_child = wait;
my $first_status = $?;
die "missing child" if $first_child == -1;
if ($first_child == $pipe_writer) {
# Usually the case
if ($first_status) {
# PipeWriter failed. Kill pgp.
kill 9, $pgp_runner;
wait; # For second exit.
return $first_status;
}
# Ok.
} elsif ($first_child == $pgp_runner) {
if ($first_status) {
# Failed. Kill pipe_writer.
kill 9, $pipe_writer;
wait; # For second exit.
return $first_status;
}
# Ok.
} else {
die "unexpected child";
}
# First child ok. Wait for second.
my $second_child = wait;
my $second_status = $?;
die "missing child" if $second_child == -1;
# It does not matter who the second child is, since
# we don't have to kill the other.
if ($second_status) {
# Failed.
return $second_status;
}
# Everybody exited, and exited successfully.
return 0;
}
sub ReadFile {
my ($path) = @_;
open(IN, $path) || die "open: $!";
my $body = join "", <IN>;
close(IN) || die "close: $!";
return $body;
}
sub DoPGP {
my ($txt) = @_;
my $pipe_writer = fork;
error('fork') if undef $pipe_writer;
PipeWriter($txt) if !$pipe_writer;
my $pgp_runner = fork;
error('fork') if undef $pgp_runner;
ExecPgp if !$pgp_runner;
WaitTwoChildren($pipe_writer, $pgp_runner) || error('Wait
failed');
return ReadFile($encrypted);
}
my $clear = "input";
my $crypt = DoPGP($clear);
> --
> Jihad Battikha
> jbattikha@highsynth.com
> http://www.highsynth.com
--
-Justin
vallon@mindspring.com
------------------------------
Date: Sun, 04 Jan 1998 02:26:20 -0400
From: Neil Trenholm <webmaster@createyourweb.com>
Subject: redirection using Location
Message-Id: <34AF2B8C.7ACA3399@createyourweb.com>
Hi,
I am buying web & cgi "space" on a Unix server. My Unix & perl
knowledge is basic but improving - thanks to many people.
My problem:
-----------
I am using perl to redirect users using print "location:$url\n\n" and
get a 302-Temporarily moved.
My Questions:
-------------
What is a 302 and why do I get it ?
Does this mean redirection is not allowed on my server ?
Thanks for any help,
Neil
Creative Web Design
Web Design, Creation & Site Management, Graphics, Internet Marketing
http://www.createyourweb.com
(902) 447-3779, RR2, 2695 Hansford Road, Oxford, Cumberland Co., NS,
Canada
------------------------------
Date: Sun, 04 Jan 1998 01:28:10 -0500
From: Charlie Wu <charliewu@worldnet.att.net>
Subject: search script that can search logical expressions
Message-Id: <68na9j$pt9@bgtnsc02.worldnet.att.net>
hi all:
i've looked at matt's search script but it only handles either AND or
OR. no combinations.
does anyone have a script that can search a bunch of files that contain
patterns like:
(keyword1 AND keyword2) OR (keyword3 AND keyword4)
i will check this newsgroup often but will also appreciate an email
reply.
thanks
charlie
------------------------------
Date: Sun, 04 Jan 1998 06:44:02 +0000
From: catty <spam@spam.spam>
Subject: Re: sending email (Net::SMTP).. problem
Message-Id: <34AF2FB2.4FD47CA5@spam.spam>
> I run into the same problem with the Net::FTP module -- I try to regularly
> download log files from my web ISP, but sometimes the connection can't be
> made when the job is scheduled.
>
> As others suggest, you should check the return value of $smtp to see if it
> was successful. Then, you have some alternatives:
> 1) put the program to sleep for a few minutes and let it try again -- repeat
> the process until it finally connects
> 2) give the program a list of different SMTP servers to try; if one is down,
> try another.
>
> --Georg
I prefer to aim for the recipient's server if possible,
bypassing the relay hop unless the target is unavailable.
Something like this fragment:
print STDERR "target: $user at $host\n";
$junk = "nslookup -query=MX $host |";
open( INCH, $junk) || die "piping";
my $lasttry = 0;
while (1) {
if ($input = <INCH>)
{ ; } # ok try another ...
elsif (! $lasttry) # or try my own as last resort
{ $lasttry = 1; $input = "mail exchanger \= $mysmtphost"; }
else
{ last }; # failed ... never happened yet though
if ($input =~ m!mail exchanger \= (\S+)$!i) {
my $mx = $1;
print STDERR "try: $mx\n";
tcp_connect( \*SERVER, $mx, 25) || next;
# got a connection, continue onward ...
------------------------------
Date: Sat, 03 Jan 1998 21:59:53 -0600
From: daryn@cambert.com (Daryn Sharp)
Subject: Re: Socket ?
Message-Id: <daryn-0301982159540001@term18.wolfram.com>
In article <34AD8EAB.41C67EA6@wwisp.com>, Eddie Dodwell <eddied@wwisp.com>
wrote:
> $remote_sock = pack('Sna4x8', AF_INET, 110, $remote_ip);
Your problem is probably involved with the packing... FWIW, everyone
should abolish this socket packing nonsense that is a relic from perl4.
Since you are using the Socket module, the the sock_addr function is
available. Rewrite the line as follows, and I bet your program will work:
$remote_sock = sockaddr_in(110,$remote_ip);
Hope this helps!
--
Daryn Sharp
(Speaking solely for myself)
------------------------------
Date: 4 Jan 1998 07:39:30 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: time module?
Message-Id: <68nvu2$qbp@panix.com>
In <34AE60F6.1BC06EED@nospam.erols.com> oberon <oberon@nospam.erols.com> writes:
>Is there a perl module for frobbing with units of time? i.e Functions
>to add 04:00:23 and 00:01:45, and other useful manipulations. I've
>hunted around the CPAN directory, but nothing looked hopeful.
Perl Modules are your friend.
How about something like the date_time_difference function in Date::Calc --
This function calculates the difference in days, hours, minutes
and seconds between the two given dates.
See: http://reference.perl.com/wrap.cgi?date-calc
>On a different, but related topic: I've been lurking here for some time
>now (>4 months), and have seen many persons "chastised" for asking a
>question to which a perusal of the perlfaq would have answered. So,
>I've made an effort to try to find faq's with previously published
>answers to my questions. It has helped me many times. But, finding a
>related faq is rather difficult, given that many of the topics read like
>this: "How_can_I_count_the_n.." I think most would agree that this is
>non-intuitive. :) Is there a list of complete faq topics?
You don't have to look hard to find the FAQ -- There is a link very first
page of www.perl.com -- This is the FAQ index:
http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Sun, 4 Jan 1998 15:39:03 +0600
From: "Maxim Pavlov" <maxim@online.sinor.ru>
Subject: Trouble with Print Location
Message-Id: <68nm93$jkv$1@ntlg.sibnet.ru>
Hello,
I would like to display more than one .gif file when my
perl script is invoked, i.e.:
print "Location: 1.gif\n\n";
works fine - it sends 1.gif and I can insert it into a html-file like
this:
<img src = "c.pl">
BUT: I need several files to be displayed one after another:
like 1 2 3 (assuming 1,2,3 be the .gif's)
When I try print "Location: 1.gif\n\n Location: 2.gif\n\n";
it doesn't work ;(
What is wrong?
Please email directly at maxim@online.sinor.ru
Thanks!
Maxim
------------------------------
Date: Sun, 4 Jan 1998 07:47:11 +0000
From: Mark Worsdall <shadowweb@worsdall.demon.co.uk>
Subject: Why stripper not work? Anyone Bar Tom as he seems to answer alot
Message-Id: <PVD+FIA$5zr0Ewgh@worsdall.demon.co.uk>
Why does not this strip routine not do the full monty?
#!/usr/local/bin/perl -w
#
# A routine to try to strip the string down to the
# original query words used
$referer = "http://www.altavista.digital.com/cgi-bin/query?pg=q&stq=50&w
hat=web&kl=XX&q=building+the+core+mu
scles+of+the+athalete&navig60.x=7&navig60.y=11";
@strippers = ("&what",
"=XX&q",
"cgi-bin/query?pg",
"bin/query?p",
"=XX&q",
"=web&kl",
"=q&stq=50", # How make any numbers get stripped?
"&navig60.x=7&navig60.y=11", # ditto
"="); # Any = chars left
print $referer . "\n\n";
foreach (@strippers) {
$referer =~ s/\$_//;
print $strip . "\n";
}
print $referer . "\n";
--
Mark Worsdall (Webmaster) - WEB site:- http://www.shadow.org.uk
Shadow:- webmaster@shadow.org.uk
Home :- shadowweb@worsdall.demon.co.uk
Any opinion given is my own personal belief...
------------------------------
Date: Sun, 4 Jan 1998 07:28:32 -0500
From: vallon@mindspring.com (Justin Vallon)
Subject: Re: Writing a "nice" server?
Message-Id: <1998010407283212333@user-38lcfdf.dialup.mindspring.com>
<plambert$1@plambert.org> wrote:
> Is this true? Because if it is, I'm doing something wrong. My server,
> with no clients even connected, sits in the select() call, but uses
> all the cpu it can get. I've tried 'truss' on a Solaris machine, and it
> shows me a lot of calls to something with 'poll' in the name, which
> suggests that select() isn't quiescent.
select is the way to go. It sounds like the timeout is zero. Did you
RTFM?
select RBITS,WBITS,EBITS,TIMEOUT
...
$rin = $win = $ein = '';
vec($rin,fileno(STDIN),1) = 1;
vec($win,fileno(STDOUT),1) = 1;
$ein = $rin | $win;
...
or to block until something becomes ready just do this
$nfound = select($rout=$rin, $wout=$win, $eout=$ein, undef);
select should block if you pass TIMEOUT == undef.
> --Paul Lambert
--
-Justin
vallon@mindspring.com
------------------------------
Date: Sun, 04 Jan 1998 17:13:45 +1100
From: Anthony David <adavid@netinfo.com.au>
To: Barry Hoggard <hoggardb@panix.com>
Subject: Re: www.roth.net
Message-Id: <34AF2898.E605B74C@netinfo.com.au>
Barry Hoggard wrote:
> I wanted to look at the Win32::ODBC pages, but the server is down
> every time I try. Does anyone know any other place to get more info.
> I've already been to CPAN.
>
> Barry Hoggard | my home page - http://www.panix.com/~hoggardb
> hoggardb@panix.com | National Association of Investors WebOp
> New York, New York | http://www.better-investing.org
There are CPAN everywhere. The CPAN multiplexor probably sent youto the
nearest CPAN to you which seems to be down. If you try this -
http://www.perl.com/CPAN/SITES.html it will send you to your down site.
I assume panix.com is in the US, take youir pick of some sites that may be
up
North America
California ftp://ftp.cdrom.com
ftp://ftp.digital.com
Calisota ftp://ftp.perl.org
Colorado ftp://ftp.cs.colorado.edu
Florida ftp://ftp.cis.ufl.edu
Illinois ftp://uiarchive.uiuc.edu
Manitoba ftp://theory.uwinnipeg.ca
Massachusetts ftp://ftp.ccs.neu.edu
ftp://ftp.iguide.com
New York ftp://ftp.rge.com
North Carolina ftp://ftp.duke.edu
Oklahoma ftp://ftp.ou.edu
Ontario ftp://enterprise.ic.gc.ca
ftp://ftp.utilis.com
Oregon ftp://ftp.orst.edu
Pennsylvania ftp://ftp.epix.net
Texas ftp://ftp.metronet.com
ftp://ftp.sedl.org
ftp://ftp.sterling.com
Washington ftp://ftp.spu.edu
--
Anthony David | Opinions expressed ARE
Anthony David & Associates | those of my employer
------------------------------
Date: Sun, 04 Jan 1998 17:09:23 +1100
From: Anthony David <adavid@netinfo.com.au>
To: Barry Hoggard <hoggardb@panix.com>
Subject: Re: www.roth.net
Message-Id: <34AF2793.DC87F65C@netinfo.com.au>
Barry Hoggard wrote:
> I wanted to look at the Win32::ODBC pages, but the server is down
> every time I try. Does anyone know any other place to get more info.
> I've already been to CPAN.
>
> Barry Hoggard | my home page - http://www.panix.com/~hoggardb
> hoggardb@panix.com | National Association of Investors WebOp
> New York, New York | http://www.better-investing.org
There are CPAN everywhere. The CPAN multiplexor probably sent youto the
nearest CPAN to you which seems to be down. Try this -
http://www.perl.com/CPAN/SITES.html
and choose one that takes your fancy.
--
Anthony David | Opinions expressed ARE
Anthony David & Associates | those of my employer
------------------------------
Date: 04 Jan 1998 12:09:11 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: www.roth.net
Message-Id: <oee67o0czzs.fsf@alpha.hut.fi>
Anthony David <adavid@netinfo.com.au> writes:
> There are CPAN everywhere. The CPAN multiplexor probably sent youto the
> nearest CPAN to you which seems to be down. Try this -
> http://www.perl.com/CPAN/SITES.html
>
> and choose one that takes your fancy.
Well, actually a nicer interface is:
http://www.perl.com/CPAN
Notice NO final slash.
--
$jhi++; # http://www.iki.fi/~jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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 V8 Issue 1577
**************************************