[11185] in Perl-Users-Digest
Perl-Users Digest, Issue: 4785 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 30 13:07:21 1999
Date: Sat, 30 Jan 99 10:00:20 -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 Sat, 30 Jan 1999 Volume: 8 Number: 4785
Today's topics:
Re: activeperl ppm help <stefaan.onderbeke@alcatel.be>
Re: advertising script problem <abey@hill.ucr.edu>
Apache module to do Authentication/Authorization agains <stefaan.onderbeke@alcatel.be>
Re: Deleting dupes with Perl (Larry Rosler)
Re: Detecting string containing no printing chars ? marcia.vigar@reed.co.uk
Re: Excel and perl, by the way (Steve .)
Excel and perl (Steve .)
Re: Excel and perl (Steve .)
Re: Gosh, s// faster than m// (was Re: Counting charact (Ilya Zakharevich)
IO::Socket and peerhost() usage <carvdawg@patriot.net>
Re: Multi Line Print <allan@due.net>
Re: Multi Line Print (Tad McClellan)
Newbie question <gasmiley@nospam.mediaone.net>
NEWBIE: Premature end of script header <rblench@clover.net>
NPH script and 403 Forbidden header (Bob MacBob)
NPH script and 403 Forbidden header (Bob MacBob)
Perl 'zine <carvdawg@patriot.net>
perl cgi script for win95 <nlymbo@mindspring.com>
Re: perl cgi script for win95 <mpriatel@activesystems.ca>
Re: Problem with dbm hash - Thank You!!! (Steve)
Re: Problem with dbm hash (Steve)
Re: Remove all non a-z characters? (Larry Rosler)
Search script in cgi (Bababozorg)
Re: Search script in cgi <allan@due.net>
Re: Sending email <jdf@pobox.com>
Re: Simple Perl Function Question for ya <eugene@snailgem.org>
Re: system function, Pros and Cons?? <jdf@pobox.com>
test (Bob MacBob)
Using perl to open a socket! ( sending data across ) harpreet3@hotmail.com
Re: Using perl to open a socket! ( sending data across <carvdawg@patriot.net>
Yahoo, proxys and perl <msquire@ktb.net>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 30 Jan 1999 14:22:19 +0100
From: Stefaan Onderbeke <stefaan.onderbeke@alcatel.be>
Subject: Re: activeperl ppm help
Message-Id: <36B3078B.2EDB1395@alcatel.be>
Edward Perry wrote:
> I just downloaded and install activeperl 509,
> connect to net, run ppm.bat, enter search, and
> get nothing. Is it just me or is ppm hosed?
> Any other recommends for installing Tk module?
If you are behind a firewall, you have te set some environment
variables. Check the documentation which comes with ppm for details !
Regards,
Stefaan
>
> Thanks
>
> EdVenture
------------------------------
Date: Sat, 30 Jan 1999 04:01:13 -0800
From: Abraham Grief <abey@hill.ucr.edu>
To: "myname@mydomain.com" <elst.fels@nospam.ping.be>
Subject: Re: advertising script problem
Message-Id: <Pine.LNX.4.05.9901300347010.28600-100000@hill.ucr.edu>
On Sat, 30 Jan 1999, myname@mydomain.com wrote:
> Can anyone give me an idea how to make a script that:
>
> - displays one bannerimage for instance 50% of the time
> and other banners at an other percentage of time.
> - it is not the idea to show the same banner time and time over till the 50%
> is done
> it must come between the other banners otherwise the advertising is not
> balanced over time.
>
> Anyone got a way to handle such a script ?
>
> Thank you,
>
> Peter
This script splits time equally between two images. Look up anything you
don't understand in the manual.
#!/usr/bin/perl -w
use strict;
srand;
my $img = rand(2) < 1 ? 'img1.gif' : 'img2.gif';
print "<img src=\"$img\">\n";
------------------------------
Date: Sat, 30 Jan 1999 14:18:19 +0100
From: Stefaan Onderbeke <stefaan.onderbeke@alcatel.be>
Subject: Apache module to do Authentication/Authorization against the NAB (Name and Address Book) of Lotus Notes/Domino.
Message-Id: <36B3069B.5DBBBAC@alcatel.be>
Hi,
I searched the WEB but I could not fined an answer on the following
question :
Does somebody know if following module is available :
Apache module to do Authentication/Authorization against the NAB (Name
and Address Book) of Lotus Notes/Domino.
Or if this is possible and how this can be done ?
Thanks in advance,
Stefaan Onderbeke
------------------------------
Date: Sat, 30 Jan 1999 09:16:40 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Deleting dupes with Perl
Message-Id: <MPG.111cde4b2f26a1089899e6@nntp.hpl.hp.com>
In article <36b28d78.0@news.cgocable.net> on Fri, 29 Jan 1999 23:43:37 -
0500, Bik Dhaliwal <bik@benton.com> says...
> If you are not adverse to sending the data to a file and then
> performing the following on it:.
>
> sort filename|uniq
>
> Works nicely and is very quick.
sort -u
works nicer and is even quicker. The use of
system 'sort ...'
should be considered whenever there is a great deal of data to be
sorted, because the system sort command is likely to be highly-tuned,
robust, and implemented using multiple sort-merge temporary files that
are a pain to manage using Perl. It is also portable across POSIX-
compliant toolkits. (See the just-concluded thread on the appropriate
uses of 'system' -- this is one of the best, though perhaps underused by
Perl programmers.)
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 30 Jan 1999 12:18:27 GMT
From: marcia.vigar@reed.co.uk
Subject: Re: Detecting string containing no printing chars ?
Message-Id: <78utag$j92$1@nnrp1.dejanews.com>
In article <78qisu$tcp$1@nnrp1.dejanews.com>,
ajmas@bigfoot.com wrote:
> Hi,
>
> I have a perl script that returns the records from a file that contains
> a certain string. Now any fields that do not contain any printing characters
> or are of zero length should be replaced with ' '.
>
> So I am looking to do something as follows:
>
> if (string contains printing chars) {
> Do this
> } else {
> print " ";
> }
>
> Thanks
>
> AJ
>
> --
> http://www.bigfoot.com/~ajmas/
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
if($string =~ /[\w?!.,'+&\-()\/@;:#\_*~ ]/ ){do this;}
or add any other characters you fancy
Marcia
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 30 Jan 1999 14:52:32 GMT
From: syarbrou@nospam.enteract.com (Steve .)
Subject: Re: Excel and perl, by the way
Message-Id: <36b31c84.1314070@news.enteract.com>
By the way, my working environment is Linux and Solaris.
Steve
------------------------------
Date: Sat, 30 Jan 1999 14:50:13 GMT
From: syarbrou@nospam.enteract.com (Steve .)
Subject: Excel and perl
Message-Id: <36b41c06.1187916@news.enteract.com>
I have an excel spreadsheet that I want to extract the data from for
manipulation. Is there a way in perl to read an excel spreadsheet?
Thanks.
Steve
------------------------------
Date: Sat, 30 Jan 1999 16:06:27 GMT
From: syarbrou@nospam.enteract.com (Steve .)
Subject: Re: Excel and perl
Message-Id: <36b32df6.5780359@news.enteract.com>
By the way, I'm working on Linux and Solaris.
Steve
On Sat, 30 Jan 1999 14:50:13 GMT, syarbrou@nospam.enteract.com (Steve
.) wrote:
>I have an excel spreadsheet that I want to extract the data from for
>manipulation. Is there a way in perl to read an excel spreadsheet?
>Thanks.
>
>Steve
------------------------------
Date: 30 Jan 1999 01:32:08 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Gosh, s// faster than m// (was Re: Counting characters with tr/// (in perl))
Message-Id: <78tneo$48$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Russ Allbery
<rra@stanford.edu>],
who wrote in article <ylognh6bqy.fsf@windlord.stanford.edu>:
> Ilya Zakharevich <ilya@math.ohio-state.edu> writes:
>
> > I do not know any system where the core malloc is less wasteful than
> > Perl's one. Some are pretty close, but still on the wrong side. The
> > only significant reason why hints contain mymalloc=n is inertia.
>
> That's presenting the problem in terms of memory usage, isn't it, or are
> you including speed in "less wasteful" as well? I can easily believe that
> Perl's malloc, due to its bucket strategy, is likely to use up less memory
> than pretty much any system malloc that isn't tuned for Perl, but I can
> believe that system malloc may still be faster since it's simpler.
> I thought I remembered from previous discussion that there was a speed vs.
> memory usage tradeoff here.
There was, a couple of years ago. Now I do know one malloc() which is
less wasteful (with *simulated* "typical" Perl usage) - it is the
*very* slow DosSubAllocMem), and I do know one malloc() which is
speedier (in *simulation*) than Perl's current malloc() - it is the
older Perl's malloc(). ;-)
Note that with real-life Perl applications I do not know *any*
malloc() which is *either* less wasteful *or* speedier than the
current Perl's malloc - I did not try hooking DosSubAllocMem into
Perl, and the older Perl malloc() behave worse in real life than in
simulation.
Ilya
P.S. Well, of course I did not check *many* malloc()s. I personally
checked old-EMX, new-EMX, DosSubAllocMem, Solaris one, and other
people checked Linux one. Judging by source of BSD malloc(), it
should be way behind.
Other malloc()s may have *other* advantages - Linux one and BSD
one may return memory to the system, which the current Perl
malloc() will not. But this is hardly relevant to Perl because
it free()s thing rare enough to make this less important.
And Perl's malloc has many *additional* advantages, like
debugging support, memory usage stats, better report of bad
requests, an ability to reserve memory for recovery in
tight-memory situation (to name a few).
------------------------------
Date: Sat, 30 Jan 1999 09:13:40 +0000
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: IO::Socket and peerhost() usage
Message-Id: <36B2CD44.681A683@patriot.net>
Does anyone have an example of code that
is used to determine the IP address of someone
connecting to a server in Perl? I am using IO::Socket,
"Perl in a Nutshell", The PRK for Win32, and AS build 509.
Thanks...
use IO::Socket;
$sock = new IO::Socket::INET (LocalPort => $port,
Proto => 'tcp',
Listen => 5,
Reuse => 1);
die "Socket error: $!\n" unless $sock;
print "Listening on port $port...\n";
while (($new_sock,$ip) = $sock->accept() ) {
< What do I need to do here to determine the IP of connecting
station???>
}
------------------------------
Date: Sat, 30 Jan 1999 08:09:56 -0500
From: "Allan M. Due" <allan@due.net>
Subject: Re: Multi Line Print
Message-Id: <VwDs2.170$L1.3223@nntp1.nac.net>
rsarcomo@my-dejanews.com wrote in message <78u0h0$sis$1@nnrp1.dejanews.com>...
:On my Linux box, this works fine:
:print <<ENDING;
:Hello
:World
:ENDING
:On my NT box running ActiveState Perl, it fails with an error of "Can't find
:string terminator "ENDING" anywhere before EOF at test.pl line 1."
:Any ideas?
Are you sure that there is a new line after the final ENDING? The lack of
same is the most common reason I see for that error message. On occasion I
have suggested to folks to finish the statement with an extra ; just to make
sure that the newline is present. So the code would look like:
print <<ENDING;
Hello
World
ENDING
;
HTH
AmD
------------------------------
Date: Sat, 30 Jan 1999 08:57:42 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Multi Line Print
Message-Id: <6l6v87.pi.ln@magna.metronet.com>
Abraham Grief (abey@hill.ucr.edu) wrote:
: On Sat, 30 Jan 1999 rsarcomo@my-dejanews.com wrote:
: > On my Linux box, this works fine:
[snip here-doc]
: > On my NT box running ActiveState Perl, it fails with an error of "Can't find
: > string terminator "ENDING" anywhere before EOF at test.pl line 1."
: >
: > Any ideas?
: You might have extra spaces or other characters after the last ENDING,
That is almost certainly the problem.
: possibly because you typed the file in Unix and windows isn't reading
: newlines properly.
It is not that windows isnt' reading newlines properly.
It is that the end of lines are represented differently on
the two platforms.
Windows is doing the Right Thing, but it is being fed garbage.
GIGO in action.
: Maybe try retyping it in a windows text editor.
Ack!
Retyping?
No way!
If you transfer the files using FTP's ASCII (or "text") mode,
it will convert line endings to match the convention used by
the receiving system.
Or write a perl one-liner to convert the line endings.
perl -p -i -e 's/\r//g' files... # DOS to Unix
perl -p -i -e 's/\n/\r\n/g' files... # Unix to DOS
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 30 Jan 1999 10:15:26 -0500
From: Gary Smiley <gasmiley@nospam.mediaone.net>
Subject: Newbie question
Message-Id: <36B3220E.2FA4DB3A@nospam.mediaone.net>
Sorry, I have inherited this problem (we run only 1 perl program on our
site and we have no perl programmers). How do I append records to a file
on a shared network drive? The program currently writes to a local file
in the cgi-bin directory, but I have been told that in order to write
to a shared network drive, the file name has to be in the form
\\computername\shareddrivename\directoryname\filename but this doesn't
work no matter what I try. I have been told by our network guy that the
permissions have been set to allow me to do this. If anybody could
either help me or steer me towards a source of info it would be
appreciated. - Thanks in advance- Gary
--
To reply, please remove the anti-spam portion of the return address.
------------------------------
Date: Sat, 30 Jan 1999 15:08:09 GMT
From: William B. <rblench@clover.net>
Subject: NEWBIE: Premature end of script header
Message-Id: <78v78k$qoc$1@nnrp1.dejanews.com>
I'm attempting to setup perlshop and am receiving the above error. Can anyone
tell me what it means and how to solve the problem?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 30 Jan 1999 14:04:27 GMT
From: b_macbob@NOSPAM.hotmail.com (Bob MacBob)
Subject: NPH script and 403 Forbidden header
Message-Id: <36b5115a.184199598@news.dircon.co.uk>
Happy day all! :)
I have a script which collects and displays links to sites relevant to
our site. The links are submitted by individuals as they see fit.
However, one of the 'We will submit your site to thousands of search
engines' sites has added us to their database and accesses the cgi
directly. We are getting a submission roughly every minute.
Anyway, to get to the point, although I've filtered their submissions
out I would like to return a 403 Forbidden header to them rather than
nothing. How can I do that?
At present I do:
# Check for automated submissions
if ($ENV{'HTTP_USER_AGENT'} =~ /libwww/ ||
$hostname =~ /part.of.their.domain.name/) {
print "Location: http://mydomain/cgi-bin/nph-403.cgi\n\n";
&write_log;
exit;
}
Which sends them to this NPH script:
#!/usr/bin/perl
print "$ENV{'SERVER_PROTOCOL'} 403 Forbidden\n";
print "Server: $ENV{'SERVER_SOFTWARE'}\n";
print "Content-type: text/html\n\n";
print "<HTML><HEAD>\n";
print "<TITLE>403 Forbidden</TITLE>\n";
print "</HEAD><BODY>\n";
print "<H1>Forbidden</H1>\n";
print "</BODY></HTML>\n";
Is this correct or is their a better way of doing it? I really want it
to appear as if my link script is forbidden and not the nph script.
TVMIA,
MacBob.
------------------------------
Date: Sat, 30 Jan 1999 15:13:48 GMT
From: b_macbob@NOSPAM.hotmail.com (Bob MacBob)
Subject: NPH script and 403 Forbidden header
Message-Id: <36ba2189.188343229@news.dircon.co.uk>
Happy day all! :)
I have a script which collects and displays links to sites relevant to
our site. The links are submitted by individuals as they see fit.
However, one of the 'We will submit your site to thousands of search
engines' sites has added us to their database and accesses the cgi
directly. We are getting a submission roughly every minute.
Anyway, to get to the point, although I've filtered their submissions
out I would like to return a 403 Forbidden header to them rather than
nothing. How can I do that?
At present I do:
# Check for automated submissions
if ($ENV{'HTTP_USER_AGENT'} =~ /libwww/ ||
$hostname =~ /part.of.their.domain.name/) {
print "Location: http://mydomain/cgi-bin/nph-403.cgi\n\n";
&write_log;
exit;
}
Which sends them to this NPH script:
#!/usr/bin/perl
print "$ENV{'SERVER_PROTOCOL'} 403 Forbidden\n";
print "Server: $ENV{'SERVER_SOFTWARE'}\n";
print "Content-type: text/html\n\n";
print "<HTML><HEAD>\n";
print "<TITLE>403 Forbidden</TITLE>\n";
print "</HEAD><BODY>\n";
print "<H1>Forbidden</H1>\n";
print "</BODY></HTML>\n";
Is this correct or is their a better way of doing it? I really want it
to appear as if my link script is forbidden and not the nph script.
TVMIA,
MacBob.
------------------------------
Date: Sat, 30 Jan 1999 08:28:59 +0000
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Perl 'zine
Message-Id: <36B2C2CB.8F269B8F@patriot.net>
Just throwing this out to everyone...
I really enjoy TPJ...when it comes out. I get digests from
the ActiveState listservers, and I read the groups.
Is there any desire for a monthly 'zine along the lines of TPJ?
I was thinking that it could start out online, and then possibly
go to soft-cover in the future. I would be glad to not only
subscribe to such a thing, but also contribute...
I am asking this b/c I have added a 'Perl Corner' to an e-letter
that I edit, and it's been a real hit with newbies and more experienced
Perl programmers, as well...
Carv
------------------------------
Date: Sat, 30 Jan 1999 11:55:32 -0500
From: steven farris <nlymbo@mindspring.com>
Subject: perl cgi script for win95
Message-Id: <36B33984.8C362C48@mindspring.com>
Hello, Can someone tell me how to set up a perl cgi script on a win95
machine. I want to write a cgi to be used in offline mode (local file)
but the browser (nestscape) won't recognize the output of the script.
The specific problem is that the output goes to a dos window spawned by
the
browser. Thanks, Steve Farris
------------------------------
Date: Fri, 29 Jan 1999 23:26:47 -0500
From: "Mark Priatel" <mpriatel@activesystems.ca>
Subject: Re: perl cgi script for win95
Message-Id: <ayHs2.2019$134.17310@tor-nn1.netcom.ca>
Although I'm not sure of what environment you're running, here a few things
to keep in mind when developing CGI 'at home'.
1. You need a web server (Xitami works great for me)
2. You need a batch file to call the script (which I'm assuming you're doing
if you're getting dos output.)
______________
Mark Priatel
ActiveSystems Inc.
SGML Integration
steven farris <nlymbo@mindspring.com> wrote in message
news:36B33984.8C362C48@mindspring.com...
>Hello, Can someone tell me how to set up a perl cgi script on a win95
>machine. I want to write a cgi to be used in offline mode (local file)
>but the browser (nestscape) won't recognize the output of the script.
>The specific problem is that the output goes to a dos window spawned by
>the
>browser. Thanks, Steve Farris
------------------------------
Date: Sat, 30 Jan 1999 17:35:46 GMT
From: root@coredcs.com (Steve)
Subject: Re: Problem with dbm hash - Thank You!!!
Message-Id: <36b342d9.1512539913@news.coredcs.com>
Thanks to all who helped!
On Sun, 24 Jan 1999 13:58:59 -0500, rjk@linguist.dartmouth.edu (Ronald
J Kimball) wrote:
>Steve <root@coredcs.com> wrote:
>
>> I'm having a problem with a hash database file. I need to store
>> multiple values in one key and thus I'm using an array(per the Perl
>> Cookbook). My problem is in syntax for viewing the data once
entered.
>
>In general, multilevel hashes and dbm files don't mix. Fortunately,
the
>module MLDBM was created to fill this gap. There are three versions
>available right now:
>
><http://www.perl.com/CPAN-local//authors/id/GSAR/>
>
>--
> _ / ' _ / - aka - rjk@linguist.dartmouth.edu
>( /)//)//)(//)/( Ronald J Kimball
chipmunk@m-net.arbornet.org
> / http://www.ziplink.net/~rjk/
> "It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sat, 30 Jan 1999 17:35:14 GMT
From: root@coredcs.com (Steve)
Subject: Re: Problem with dbm hash
Message-Id: <36b34286.1512457328@news.coredcs.com>
Actually I'm not programming as root. I'm posting as root simply
because the root account already gets a ton of spam since it aliases
for other accounts that are listed on webpages. Rather than
cluttering my personal account up with more spam, I posted as root
which gets to me anyway.
Thanks for the concern though. :)
Steve
On Tue, 26 Jan 1999 13:54:29 GMT, droby@copyright.com wrote:
>In article <36abd8ac.1026846043@news.coredcs.com>,
> root@coredcs.com (Steve) wrote:
>
>Seeing people programming and posting as root scares me. Have mercy.
Create
>a user account for yourself.
>
>> Hello,
>>
>> I d/l'ed MLDBM and installed it. Seems that it won't do it. What
I
>> mean by that is that it's too slow. Also creates a waste of time
and
>> code. Yuck.
>>
>> There should be a way to do this in Perl without adding on slow
>> packages.
>>
>
>MLDBM and Data::Dumper go through some contortions to handle many
different
>complex data structures, and to make the conversions that have to
happen to
>store and retrieve them as DBM transparent, so that it feels like
your complex
>data structure is really just living in the DBM.
>
>You can roll your own logic to handle a hash of lists specifically,
as that's
>what you need (I did this once in Perl4, but it's not code I want to
show off
>;-)). But you'll have to do something similar to what happens in
MLDBM
>(actually Data::Dumper I think) for a hash of lists, which will
amount to
>doing a join on each list before storing to the DBM and a split on
retrieval
>from the DBM. If you don't try to make these conversions transparent
it may
>save some time, and will definitely save some brain-scrambling.
>
>--
>Don Roby
>
>-----------== Posted via Deja News, The Discussion Network
==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your
Own
------------------------------
Date: Sat, 30 Jan 1999 09:06:03 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Remove all non a-z characters?
Message-Id: <MPG.111cdbcfccd5e2df9899e5@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <36b5c9bc.18360561@newshost.pcug.org.au> on Sat, 30 Jan 1999
09:10:57 GMT, Owen Cook <rcook@pcug.org.au> says...
> On Mon, 25 Jan 1999 21:26:57 -0800, lr@hpl.hp.com (Larry Rosler) wrote:
...
> timethese(1 << (shift || 0), {
> Cntrl => sub { my $string = $y },
> Tr => sub { (my $string = $y) =~ tr/a-z//cd },
> Regex => sub { (my $string = $y) =~ s/[^a-z]//g },
> });
> ------------------------------------------------------------------------
> I tried this with build 509 of ActiveState perl and had to increase the
> "1" in timethese(1 << (shift || 0), to 100000 before I could elimimate
> an warning message which read;
> (warning: too few iterations for a reliable count)
>
> I then increased it to 262144 and obtained "similiar" results to what was
> posted.
>
> How come "1" is used and 262144 iterations are made, yet I have to use
> 262144, or is there something I should be reading?
This is just a little device I picked up in this newsgroup, which makes
it convenient to vary the number of iterations of the benchmark without
editing the program source each time. The 'shift' grabs the first
argument after the filename on the command line (if there is such an
argument), and uses it to control the number of iterations.
Thus, to get 262144 iterations of the benchmark, you invoke the program
as:
C:> perl my_benchmark_file.txt 16
If there is no argument, the 'shift' returns FALSE (undef) and the
iteration runs (1 << 0) times, or just once, as you have discovered.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 30 Jan 1999 12:48:57 GMT
From: bababozorg@aol.com (Bababozorg)
Subject: Search script in cgi
Message-Id: <19990130074857.17470.00001675@ng33.aol.com>
hi
i have writen a search script in perl/cgi but i want to limit my results of the
search in a specific number.
just like what yahoo has done you only can see 20 search results in each page
and to see next 20 you have to next 20 and ...
please tell me how to do this and what method do i have to use
thanks
hamed
------------------------------
Date: Sat, 30 Jan 1999 09:28:25 -0500
From: "Allan M. Due" <allan@due.net>
Subject: Re: Search script in cgi
Message-Id: <tGEs2.176$L1.3218@nntp1.nac.net>
Bababozorg wrote in message <19990130074857.17470.00001675@ng33.aol.com>...
:hi
:i have writen a search script in perl/cgi but i want to limit my results of
the
:search in a specific number.
:just like what yahoo has done you only can see 20 search results in each page
:and to see next 20 you have to next 20 and ...
:please tell me how to do this and what method do i have to use
In order to implement such a strategy you need to maintain state across
subsequent requests and the problem is that HTTP is a stateless protocol. If
the database is small, and the search is conducted quickly you can pass how
many hits have been displayed along with the search requirements as a hidden
field in the script. So you would include an increment hidden field
instructing the script start with hit number X and display through hit X+19
and so on.
Otherwise you will need to use sessions. See Randal L. Schwartz's
excellent description of this issue in his Web Techniques column.
http://www.stonehenge.com/merlyn/WebTechniques/col02.html
HTH
AmD
------------------------------
Date: 30 Jan 1999 15:07:12 +0100
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Sending email
Message-Id: <m3u2x8zwfj.fsf@joshua.panix.com>
info@gadnet.com writes:
> &footer;
This does not mean what you think it does. Read perlsub for a
discussion of the difference between footer() and &footer.
> print "<HTML><HEAD><TITLE>$title - @_[0]</TITLE></HEAD>\n";
Why are you using an array slice?
> open(MHEAD,"$memberhead");
*sigh*
If you come here saying "help me" and several people say to you "The
first thing you must do is check for system call failures or else
there's little point in checking further," and you say "No, but please
debug my code for me anyway," then I say *plonk*.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Sat, 30 Jan 1999 09:35:10 -0500
From: Eugene Sotirescu <eugene@snailgem.org>
To: KC <collinkr@ucsu.colorado.edu>
Subject: Re: Simple Perl Function Question for ya
Message-Id: <36B3189E.3794DA5D@snailgem.org>
KC wrote:
>
> I want to call the ping command from inside
> my perl script, then capture ONLY the return value, and
> use it. I dont want ping to output anything - just
> return the exit value into $value. This will be used for
> a web page showing multiple machines' status after
> being pinged.
>
use Net::Ping
$iping = Net::Ping->new();
$host = "your.host.moc";
$value = $iping->ping($host);
$iping->close();
Of course this is of limited value: now you know that you can reach the
machine, but services might still be down or non-existent
;-------------/
--
Eugene
"Light is the all-exacting good,
That dry, forever virile stream
That wipes each thing to what it is,
The whole, collage and stone, cleansed
To its proper pastoral."
Alvin Feinman
------------------------------
Date: 30 Jan 1999 15:08:15 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: tadmc@metronet.com (Tad McClellan)
Subject: Re: system function, Pros and Cons??
Message-Id: <m3socszwds.fsf@joshua.panix.com>
tadmc@metronet.com (Tad McClellan) writes:
> Running Mathematica to do a complex statistical anlaysis
> is an example of where shelling out probably makes sense.
There is always PDL...
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Sat, 30 Jan 1999 15:10:43 GMT
From: b_macbob@NOSPAM.hotmail.com (Bob MacBob)
Subject: test
Message-Id: <36b620e9.188183362@news.dircon.co.uk>
------------------------------
Date: Sat, 30 Jan 1999 12:21:47 GMT
From: harpreet3@hotmail.com
Subject: Using perl to open a socket! ( sending data across )
Message-Id: <78utgn$jj4$1@nnrp1.dejanews.com>
Hi,
I have tried to use perl to open a socket and it is working except that
when I send a line across using print SOCK "line\n"; it doesn't send anything
back! This could be because the line is not getting sent or some other reason.
Anyway the socket gets dead-locked!!! I've tried everything without success.
Please help if you know what the prob is, I'm already at my wit's end. Thanks
in advance.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 30 Jan 1999 08:25:43 +0000
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Re: Using perl to open a socket! ( sending data across )
Message-Id: <36B2C207.65301C84@patriot.net>
> I have tried to use perl to open a socket and it is working except that
> when I send a line across using print SOCK "line\n"; it doesn't send anything
> back! This could be because the line is not getting sent or some other reason.
> Anyway the socket gets dead-locked!!! I've tried everything without success.
> Please help if you know what the prob is, I'm already at my wit's end. Thanks
> in advance.
>
It would really help to know what port you are opening the socket to....that would
probably go a long way toward helping someone diagnose your
troubles...
How about posting some code here so we can see what it is that you're
trying to do....
------------------------------
Date: Sat, 30 Jan 1999 10:21:06 -0800
From: me <msquire@ktb.net>
Subject: Yahoo, proxys and perl
Message-Id: <36B34D91.F7EF9E8B@ktb.net>
Hi All,
I really hope this is not off topic, but I have had this situation
nagging me for a while now. I wrote proxy server. It works fine, and
I have had very few problems. I noticed though, that when I try to
access yahoo through the proxy, yahoo somehow completely circumvents the
proxy and sends html and data directly to my machine instead of to the
proxy first.
I know this because I forced the proxy to create a log of all the data
that passes through it (temporarily). There was absolutely NO data from
Yahoo that went to the proxy first. It is like Yahoo knew that I was
using a proxy and circumvented it somehow. Does anyone please have an
explanation?
~Prime
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4785
**************************************