[13254] in Perl-Users-Digest
Perl-Users Digest, Issue: 664 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 27 17:07:33 1999
Date: Fri, 27 Aug 1999 14:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 27 Aug 1999 Volume: 9 Number: 664
Today's topics:
automatically printing a web page using embedded perl <isspecial@fast.net>
Re: bizarre PERL/CGI behavior question <arunas@an!m.org>
Re: bizarre PERL/CGI behavior question rancid@best.com
Re: Can anyone lend a hand please? (Larry Rosler)
Re: Converting strings to arrays question <aqumsieh@matrox.com>
Drop-down menu problem deuce25@hotmail.com
Re: eperl v. embperl which would you suggest? <wpflum@my-deja.com>
file size testing bshook@csrlink.net
Re: file size testing <cs004@wg.waii.com>
Re: file size testing (Anno Siegel)
Re: FormMail problem recognizing <form name> attribute <smp9@*home.com>
Graphs and Charts <paulm@dirigo.com>
Hashed sets <srooij@wins.uva.nl>
Re: http download <kin@0011.com>
Re: Images (Anno Siegel)
Re: Images (Larry Rosler)
Looking for SQL beautifier/formatter/pretty printer wri <theglauber@my-deja.com>
Re: Perl a Black Sheep? rlw_ctx@my-deja.com
Re: Perl a Black Sheep? rlw_ctx@my-deja.com
perl don't understand semicolon in passed form variable <chip@mail.eclipse.net>
Re: Perl Y2K Bugs on the Internet <jbc@shell2.la.best.com>
Permanent Connection <wells@cedarnet.org>
random number (Glenn Paulsen)
Re: random number <kin@0011.com>
random (Glenn Paulsen)
Re: semaphore manipulation <james.p.williams@usahq.unitedspacealliance.com>
Re: Spawn a Web process <good@drinking.eng.sun.com>
Thumbnails <michael@forward.demon.co.uk>
Re: Thumbnails <kin@0011.com>
Re: Timeing out "new Net::FTP" (Anno Siegel)
Re: URL-Encoded Format with LWP? <makkulka@cisco.com>
Re: Using stream 2 ways (Alan Curry)
Re: Why use Perl when we've got Python?! <banderson@boi.hp.com>
Win32::EventLog Issue <tom_lichti@interactivemedia.com>
Re: Win32::EventLog Issue <carvdawg@patriot.net>
Re: Win32::EventLog Issue <tom_lichti@interactivemedia.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 27 Aug 1999 17:53:45 GMT
From: Bill <isspecial@fast.net>
Subject: automatically printing a web page using embedded perl
Message-Id: <7q6jb5$sud$1@nnrp1.deja.com>
I may or may not be in the correct group so fell free to tell me to go
away(At least direct me where to go while your at it though:) ). I've
got a web based report page that I'd like to be able to print out. Its
written in perl an works very well, allowing the user to select the
month and year and the generating a web page report from a mysql
database. My problem is that I want to provide a button or hyperlink
to print out the page instead of requiring the user to use the print
function of the browser(read this as idiot proof printing for
management) I can get this to work using javascripts window.print() but
for a couple of problems. First I don't want the printout to have the
links on the bottom that I have there for the web display, including
the print link or button, second I'd like to stop the printout from
printing the page url at the bottom of the page(This may be a browser
setup only solution but I thought I'd ask). One way I thought to do
this was to add another option to the url variables I use to generate
the page already, maybe a printonly option that would not print the
links for a printer friendly page. This works ok and I can get it to do
it and I can even get it to jump right to the print menu but what I
cannot do is make the browser automatically return to the page that
called it, so the links at the bottom are back, after the user prints
or aborts the print. I can get it to automatically go back to the page
with query->redirect but if I drop that in after the autoprint script
the page is never displayed and the print menu never comes up. Probably
switches back too fast for the system to handle it. So here are the
pertinant questions: Is there a way to pause in perl that will sit
there until a outside system window is closed or is there another way
other than query->redirect to return to the last window that would
allow the system to printout the page first. I thought about just using
a loop or some kind of pause function but I cannot trust that the spped
of the network will remain constant so if I pause for too short of a
time I get no printout and if I pause too long i'll get complaints for
users. And finally is there a way in straight perl to cause the browser
to print instead of using a javascript. Alot of info but this is my
first attempt at such a project and I've had to try learn perl, html
and cgi all at once and sometimes its a little overwhelming.
Thanks in advance and feel free to bash away I can take it;)
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 27 Aug 1999 13:27:40 -0600
From: "Arunas Salkauskas" <arunas@an!m.org>
Subject: Re: bizarre PERL/CGI behavior question
Message-Id: <37c6e6b9@news.cadvision.com>
I gather you found the problem, since Audible Deafenings was there, and the
link was fine.
--
- Arunas Salkauskas
High Point Designs
www.highpointdesigns.com
rancid@best.com wrote in message <37c6cd93.138209076@nntp.best.com>...
>
>I have flat-file "database" containing record labels and the URL of
>their web page that consists of 3 fields delimited by the pipe
>character (|). The first field is for alphabetization purposes, the
>second field is the name of the label, and the third field is the URL.
>To speed lookup (users can retrieve labels by the first letter),
>there's another file that contains the byte location of where each
>chunk of the alphabet begins and for how many lines that chunk
>continues.
<SNIP>
>You can see the lack of output in action at
>http://www.arancidamoeba.com/lettersearch.cgi?a
>Scroll down the page to where the label Audible Deafenings ought to be
>located.
>
>Thanks for any help you can provide! This has me scratching my head
>verging on pulling hair out.
>
>chanel
>rancid@best.com
------------------------------
Date: Fri, 27 Aug 1999 19:51:20 GMT
From: rancid@best.com
Subject: Re: bizarre PERL/CGI behavior question
Message-Id: <37c6eb0f.145757984@nntp.best.com>
On Fri, 27 Aug 1999 13:27:40 -0600, "Arunas Salkauskas"
<arunas@an!m.org> wrote:
>I gather you found the problem, since Audible Deafenings was there, and the
>link was fine.
>
Hmm, that's interesting. It isn't showing up for me (still), but it is
for you. That's weird.
chanel
>
>rancid@best.com wrote in message <37c6cd93.138209076@nntp.best.com>...
>>
>>I have flat-file "database" containing record labels and the URL of
>>their web page that consists of 3 fields delimited by the pipe
>>character (|). The first field is for alphabetization purposes, the
>>second field is the name of the label, and the third field is the URL.
>>To speed lookup (users can retrieve labels by the first letter),
>>there's another file that contains the byte location of where each
>>chunk of the alphabet begins and for how many lines that chunk
>>continues.
><SNIP>
>>You can see the lack of output in action at
>>http://www.arancidamoeba.com/lettersearch.cgi?a
>>Scroll down the page to where the label Audible Deafenings ought to be
>>located.
>>
>>Thanks for any help you can provide! This has me scratching my head
>>verging on pulling hair out.
>>
>>chanel
>>rancid@best.com
>
>
------------------------------
Date: Fri, 27 Aug 1999 12:48:02 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Can anyone lend a hand please?
Message-Id: <MPG.12308b4f88d6d5da989ebc@nntp.hpl.hp.com>
In article <37C6DB6E.CC39C737@home.com> on Fri, 27 Aug 1999 18:37:52
GMT, Ralph Christopher Furmaniak <ralphcf@home.com> says...
> Richard wrote:
>
> > But where I really need help is being able to 'register' a
> > user. For example, visitor fills out a form that has Username, Password and
> > Full Name as fields. This stuff is stuck in one large user database which is
> > used to validate users when they try to 'log in'.
>
> You can just open a file for appending and write the form data to it, just as
> you checked it in that line you wrote.
>
> open(FILE,">>SomeFile");
It is considered very bad form here to show someone (especially a
beginner) code that opens a file without checking for the success of the
operation.
open(FILE, ">>SomeFile") or die "Couldn't open 'Somefile'. $!\n";
> print FILE $in{'action'}; # And so on
"And so on" might well include a newline, to make the contents of the
file usable later.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 27 Aug 1999 14:13:33 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Converting strings to arrays question
Message-Id: <x3yn1vdw0qa.fsf@tigre.matrox.com>
Ilya <ilya@speakeasy.org> writes:
> Nope.... I don't want to take the values of %input_params. They merely
> represent something. i.e. if $input_params{$key} eq 1 I want to take @value,
> not $value and do something with it.
What do you mean?
What is @value? What do you suspect it should contain?
The following
for my $value (values %input_params) {
....
}
iterates through the values of your hash, ONE by ONE. $value will
point to each value in each iteration. There is no @value.
> > Or do you mean you want to stick some value into the end of an array?
>
> > push (@values, $value);
>
> $value is 1 or 0.
>
> Whenever I see $value, I want to turn it into @value.
What do you mean turn $value to @value? $value is a scalar. @value is
an array.
Re-think your strategy, and ask again.
--Ala
------------------------------
Date: Fri, 27 Aug 1999 20:04:43 GMT
From: deuce25@hotmail.com
Subject: Drop-down menu problem
Message-Id: <37c8ef4b.28339696@news.rivernet.net>
I'm trying to get the selection from a drop down box to show up in my
shopping cart when you click on "Add to Order" but to no avail. I'm
not sure if the problem is with the script or just the html page. It
would probably be easiest if you just took a look at
http://www.empirewireless.com/phone_acc/batteries/audiovox/401_700m.htm
to see what I mean. If you look at the source code, I need the model
# to show up on the line
...value="|orders@empirewireless.com,1,27.95,Audiovox Battery-Nimh
700mah model ?,|"> after model.
Is this a problem in the html or the cgi script? Am I overlooking
something totally obvious or am I just brain-dead?
Derek
-----------== 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: Fri, 27 Aug 1999 18:47:01 GMT
From: Bill <wpflum@my-deja.com>
Subject: Re: eperl v. embperl which would you suggest?
Message-Id: <7q6mf2$vcb$1@nnrp1.deja.com>
I've been using eperl with Apache and MySql to develope a intranet
website for my company and have had a very good experience with all
three products. A previous poster indicated that eperl does just
exactly what it says it will do and he is right. At the moment I've
got a working prototype of a web based report which allows a user to
select the month and year they want to see a report for then builds a
web page from a MySql database to display and/or print. This had to
match a previously used report format and I must say I've come pretty
close to duplicating the report when its printed out from the web page.
Hope this helps you decide.
In article <7q3bt5$ju7$1@nnrp1.deja.com>,
emarkert@pace.edu wrote:
> First, I'm not looking to start a holy war over which product is best,
> so my apologies if that is what happens...
>
> I am looking for are solid recommendations for either product. I
have a
> project that I need to have parsed HTML. I've already taken a look at
> PHP but ditched it because of the extensive perl object libraries
that I
> have to use and from what I've seen PHP cannot take advantage of these
> perl objects.
>
> What I need is to be able to use my perl objects, be able to connect
to
> MySQL databases, and be able to coexist on Apache.
>
> TIA.
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 27 Aug 1999 19:23:55 GMT
From: bshook@csrlink.net
Subject: file size testing
Message-Id: <7q6ok1$ph$1@nnrp1.deja.com>
I'm writing a script that tests the size of a file to make sure it is
not empty before I parsed its content and update a database. The
problem is when I test the size and the file is 0 bytes the sytem hangs.
This is running on unix. I was wondering if any one could offer me an
explanation as to why this is happening and how I can fix it. Thank you.
Even this small snippet won't work.
$inputFile = "feature2";
$inode = stat($inputFile);
$size = $inode->size;
if ($size == 0) {
print "booyah";
}
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 27 Aug 1999 15:47:21 -0500
From: Art Haas <cs004@wg.waii.com>
Subject: Re: file size testing
Message-Id: <37C6F959.949557F0@wg.waii.com>
bshook@csrlink.net wrote:
>
> $inputFile = "feature2";
> $inode = stat($inputFile);
> $size = $inode->size;
>
> if ($size == 0) {
> print "booyah";
> }
>
Don't bother with the 'stat' call - use the '-s' file
test operator ....
my $file = '/your/file/here';
if (-s $file) {
... do neat things ...
} else {
warn "Empty file '$file'!\n"
}
Your stat call above should have been like ...
my $file = '/your/file/here';
my $size = (stat($file))[7];
Read the docs on stat and the file tests, and don't forget
to 'use strict;'.
--
###############################
# Art Haas
# (713) 689-2417
###############################
------------------------------
Date: 27 Aug 1999 21:03:56 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: file size testing
Message-Id: <7q6ufs$kpt$1@lublin.zrz.tu-berlin.de>
<bshook@csrlink.net> wrote in comp.lang.perl.misc:
>I'm writing a script that tests the size of a file to make sure it is
>not empty before I parsed its content and update a database. The
>problem is when I test the size and the file is 0 bytes the sytem hangs.
Not my system. It crashes.
>This is running on unix. I was wondering if any one could offer me an
>explanation as to why this is happening and how I can fix it. Thank you.
>Even this small snippet won't work.
>
> $inputFile = "feature2";
> $inode = stat($inputFile);
$inode? stat, in scalar context, returns success or failure. Broadly
speaking, it returns true when the file exists.
> $size = $inode->size;
Here is where it crashes. Why do you think $inode has a method named
size?
Anno
--
$,=$"; $\=$/; print map { m/(?<=")(\w*)(?=")/g } map { eval; $@ }
'another->Just', 'Hacker->Perl';
------------------------------
Date: Fri, 27 Aug 1999 19:28:52 GMT
From: Shawn Powell <smp9@*home.com>
Subject: Re: FormMail problem recognizing <form name> attribute
Message-Id: <UFBx3.9591$y03.1990@news.rdc1.ct.home.com>
David Cassell wrote:
> One more bit of advice: if that's Matt Wright's FormMail
> script, get a better formmail program ASAP.
Yeah, that's the one I'm using, because that's the one my web site host supports (and
provided server-specific documentation for) and is the only one I'm familiar with.
What is wrong with it, and what would you recommend instead? I was also planning to
use the modification called SimpleSecure, for PGP encryption purposes.
===================================================
Shawn Powell
smp9@*home.com
To e-mail me, remove the asterisk from my address.
===================================================
Do not meddle in the affairs of dragons, for you are crunchy and taste good with
ketchup.
------------------------------
Date: Fri, 27 Aug 1999 18:52:36 GMT
From: Stone Cold <paulm@dirigo.com>
Subject: Graphs and Charts
Message-Id: <7q6mpg$vfo$1@nnrp1.deja.com>
How does Perl handle graphics? I'd like to create some code that will
1. connect to a database via DBI module 2. grab data from database and
3. Output the data via web interface into a graph/chart using CGI.
Can this be done? Is there a module already created that I could
call?
Thanks!
--
Paul R. Mesker
System Engineer
Dirigo Inc.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 27 Aug 1999 22:47:20 +0200
From: Steven de Rooij <srooij@wins.uva.nl>
Subject: Hashed sets
Message-Id: <37C6F958.D40E613E@wins.uva.nl>
Hello everyone,
Hashes in Perl are obviously brilliant.
But often, I don't really need an actual value in a hash;
I just want to know if the key is there.
For example, you have an array @arr, and you want to know if the string
`strangelove' is in it.
This is how I would write this:
1)
while (@arr) {
next unless /^strangelove$/;
freak_out;
}
reasonably OK, but what I'd like to say is:
2)
keys(my %hash)=@arr;
if ($hash{'strangelove'}) {
chill;
}
Now perhaps you feel the first method is much better than the second,
and I shouldn't complain, but there are many circumstances when I
feel that it would be nice to hashify an array.
Is there an alternative way to quickly store a (large) array in a hash?
Has there been any discussion as to this language feature?
(I'm absolutely new to this forum, so please don't get upset if everyone
was just talking about this three minutes ago).
Bye,
Steven
------------------------------
Date: Fri, 27 Aug 1999 13:28:24 -0700
From: Kin Lum <kin@0011.com>
Subject: Re: http download
Message-Id: <37C6F4E8.90ABC7E0@0011.com>
Beth Amorosi wrote:
>
> Could some tell me which module to use to donwload a file from http to
> unix? The one liners in the module list aren't helping me any.
you can also use LWP::UserAgent
the module lets you save into a file. it can
also let you save the file gradually, printing
out download status every, say, 4096 bytes.
require LWP::UserAgent;
$ua = new LWP::UserAgent;
$request = new HTTP::Request('GET',
'http://www.yahoo.com');
$response = $ua->request($request); # or
$response = $ua->request($request, '/tmp/sss'); # or
$response = $ua->request($request, \&callback, 4096);
sub callback { my($data, $response, $protocol) = @_;
.... }
Perl in a Nutshell provides good reference on various
Perl modules. More info at
http://www.0011.com/books/perl/
------------------------------
Date: 27 Aug 1999 19:30:18 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Images
Message-Id: <7q6p0a$kih$1@lublin.zrz.tu-berlin.de>
Jimmy Humphrey <jimmy@blackhole-designs.com> wrote in comp.lang.perl.misc:
[in reply to Martien's request not to post mime]
>Hey, I just hit the reply button on Netscape 4.6 and hit send.
Then learn to use your software. Or get software that does it right.
And don't post jeopardy.
Anno
--
$,=$"; $\=$/; print map { m/(?<=")(\w*)(?=")/g } map { eval; $@ }
'another->Just', 'Hacker->Perl';
------------------------------
Date: Fri, 27 Aug 1999 12:38:11 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Images
Message-Id: <MPG.123088fc9dba0772989ebb@nntp.hpl.hp.com>
In article <37C6D12F.B35E063D@blackhole-designs.com> on Fri, 27 Aug 1999
17:56:15 GMT, Jimmy Humphrey <jimmy@blackhole-designs.com> says...
> Hey, I just hit the reply button on Netscape 4.6 and hit send.
Which means that you are ignoring netiquette, which will make you less
likely to get useful answers here in the future. Please read
'news.announce.newusers' if you haven't done so already.
In your browser, go to Edit:Preferences:Mail & Groups:Messages. Uncheck
the box that reads 'By default, send HTML messages', and check the next
box 'Automatically quote message when replying', and set the wrap to 72
characters.
Now when you reply, insert your responses *after* what you are replying
to, and clip what you are not replying to.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 27 Aug 1999 19:39:35 GMT
From: The Glauber <theglauber@my-deja.com>
Subject: Looking for SQL beautifier/formatter/pretty printer written in Perl
Message-Id: <7q6phl$1hk$1@nnrp1.deja.com>
Does anyone know if there is a Perl program to reformat SQL statements?
Thanks for any pointers. Please reply by email; i'll summarize if there
is interest.
--
Glauber Ribeiro
theglauber@my-deja.com
(Opinions stated are my own and not representative of Experian)
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 27 Aug 1999 19:23:35 GMT
From: rlw_ctx@my-deja.com
Subject: Re: Perl a Black Sheep?
Message-Id: <7q6ojd$pb$1@nnrp1.deja.com>
In article <37C3CC53.41AA7C0B@Mark.Com>,
Mark <Mark@Mark.Com> wrote:
> It's simple really. Your training director is a complete gobsh**te.
> I guess if I was trying to flog worthless Microsoft certifications,
> I would rubbish the opposition too.
Unfortunately, a lot of companies are willing to pay
more money to people who have Microsoft certification
than those who don't.
About 1 year ago, my now former employer hired some
MCSE types to expand our supported systems to include
NT. They proved to be, at best, coders - and poor ones
at that. They lacked real engineering ablity. The really
sad thing is that the reason one of them got fired was
not because of his poor performance, but that he bragged
about his salary. One of my former associates, who has a
PHD in computer science (and loves Perl), inadvertently
admitted that his own salary was less than "that juvie-
delinquent".
I know many people think an MCSE cert is equiv to a
Master's Degree, but it's really just a trade school
degree - there's nothing academnic about it - and
definately no research project involved.
--
Ron Wilson
Connectex, LLC
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 27 Aug 1999 19:51:48 GMT
From: rlw_ctx@my-deja.com
Subject: Re: Perl a Black Sheep?
Message-Id: <7q6q8g$213$1@nnrp1.deja.com>
In article <slrn7s88pp.3sj.elflord@panix3.panix.com>,
elflord@panix.com (Donovan Rebbechi) wrote:
> he walked into an MS indoctrination camp oops I mean
> training center
It is an indoctrination camp. A year ago, my now former
employer sent me toa couple of NT admin classes. There
was nothing in the classes I couldn't have figured out
on my own. Mostly the instructor extolled the virtures
of Microsoft while the attendees worked on the "hands
on" exercizes in the books.
The "Blue Screen of Death" appeared frequently at most
of the "student workstations", so a lot of time was
spent rebooting. When a system wouldn't reboot, the
instructor simply had us reinstall NT and restore from
our last backup - we got a lot of practice doing backups,
installs and restores.
--
Ron Wilson
Connectex, LLC
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 27 Aug 1999 16:38:59 -0400
From: JD Harlan <chip@mail.eclipse.net>
Subject: perl don't understand semicolon in passed form variable?
Message-Id: <Pine.BSI.4.05L.9908271630230.17847-100000@mail.eclipse.net>
hey everyone, first time caller, long time listener
I've got a script that is taking a template passed to it via a form
(POST) and writing it to a directory. The problem is, the form variable
has a bunch of semicolons in it, and it seems that either perl or cgi.pm
is treating the semicolon as an escape character. Mean to say:
use CGI;
$cgiobject = new CGI;
$custom_template = $cgiobject->param("custom_template");
I.e., if the custom_template passed from the previous page is
"10 - 4 ; good buddy"
then
$custom_template == "10 - 4 "
is this a cgi.pm issue? perhaps I should be doing this another way?
(cgi.pm v2.46, if that matters).
Reply either here or chip@eclipse.net, if you like.
Thanks a mil,
jd
------------------------------
Date: 27 Aug 1999 20:27:21 GMT
From: John Callender <jbc@shell2.la.best.com>
Subject: Re: Perl Y2K Bugs on the Internet
Message-Id: <37c6f4a9$0$223@nntp1.ba.best.com>
In comp.lang.perl.misc Eric Bohlman <ebohlman@netcom.com> wrote:
> Larry's stated goals in creating Perl
> are incompatible with a sandbox language for non-programmers.
Which stated goals of Larry are you referring to? Clearly, he never
intended Perl to be a sandbox language, but I don't believe it
necessarily follows that he didn't intend for it to be used by
non-programmers (or, more precisely, by programmers who are at such an
early stage of their development that they would be unable to do useful
work with a language less sophisticated than Perl).
My own impression is that Larry intended only that Perl be maximally
useful to the largest possible group of people. While he may
occasionally have voiced regrets at the uses some people conjure up (at
the recent TPC 3.0, for example, he lamented the use of Perl by those
who send email spam), I think he's been pretty clear that babytalkers
have a place at the table.
Some Larry quotes that I consider at least somewhat relevant to this
issue follow. Competing interpretations welcomed...
[from the keynote at the first Perl Conference]
Moving right along, I believe that learnability is a laudable goal, but
frequently misplaced. The purpose of a language is not to help you
learn the language, but to help you learn other things by using the
language. We don't water down English to make it easy to learn. We
prefer English to remain a rich language, quirky, sloppy, and full of
redundancy. Same for Perl.
A corollary to that is, while we don't water down the language itself,
we do allow people to speak subsets of the language. We don't expect a
five-year-old to speak with the same diction as a fifty-year-old. We
don't expect a native German speaker to use the same subset of English
as a native Mandarin speaker. Similarly, we don't look down on people
for using subsets of Perl. There are certainly enough of them. You can
write Perl programs that resemble sed, or awk, or C, or Lisp, or
Python. This is Officially Okay in Perl culture. By way of contrast,
try writing in the C subset of C++ and they'll make a laughingstock of
you. [laugh]
[from the keynote at the 2nd Perl Conference]
Now the thing about the onion is that it teaches me something about my
own importance. Or lack thereof. Namely, that while I may have started
all this, I'm still a little bit of the onion. Most of the mass is in
the outer layers. (That's why I like to see grassroots movements like
the Perl Mongers springing up.) But here I sit in the middle. I get a
bit of honor for my historical significance, and you sit here patiently
listening to me talk about the oddest things, but in actual fact, most
people see the outside of the onion, not the inside. Unless they make
onion rings. But even then, the bigger rings have more to them than the
smaller rings. Let that be a lesson to those of you who wish to be
"inner ringers". That's not where the real power is. Not in this
movement, anyway. I've tried to model the Perl movement on another
movement I'm a member of, and the founder of that movement said, "He
who wishes to be greatest among you must become the servant of all." Of
his twelve inner ringers, one betrayed him, and 10 of the other 11 went
on to suffer a martyr's death. Not that I'm asking any of my friends to
throw themselves to the lions just yet.
[from the LinuxWorld talk]
How does Perl put the focus onto the creativity of the programmer? Very
simple. Perl is humble. It doesn't try to tell the programmer how to
program. It lets the programmer decide what rules today, and what
sucks. It doesn't have any theoretical axes to grind. And where it has
theoretical axes, it doesn't grind them. Perl doesn't have any agenda
at all, other than to be maximally useful to the maximal number of
people. To be the duct tape of the Internet, and of everything else.
You've heard the joke, I'm sure. How is duct tape like the Force? It
has a light side, and a dark side, and it holds the universe together.
Later in this talk, I intend to define the universe and give three
examples.
I have to be honest here. I'm with Linus--I personally want to take
over the world. I want to take over the world because I'm an egomaniac.
A nice sort of egomaniac, an egomaniac moderated by belief in the value
of humility, but an egomaniac nonetheless.
Fortunately, I am not Perl. Perl was my servant before it was anyone
else's, so I taught Perl to be a better servant than I could ever teach
myself to be. Perl is like the perfect butler. Whatever you ask Perl to
do, it says `Very good, sir,'' or `Very good, madam.'' Only
occasionally does Perl give you a stiff upper lip, or say `Tsk, tsk.''
But if you ask Perl its opinion, it will advise you on matters of
taste. `I'm sorry sir, but bareword 'foo' is not allowed while 'strict
subs' is in use.''
[end of Larryisms]
Because of my identification with/sympathy for the accidental
programmer part of the Perl community, I suspect I've gone too far
sometimes in reading newbie-friendliness into Larry's comments. When I
try to look at it as objectively as possible, it seems that he's
actually been silent on that point, for the most part. Realistically, I
think he just created Perl to be as useful as possible for people like
himself. The fact that it turns out to be incredibly useful in the
hands of former non-programmers doing Web stuff may well be accidental.
I'm not sure what difference that makes, though.
--
John Callender
jbc@west.net
http://www.west.net/~jbc/
------------------------------
Date: Fri, 27 Aug 1999 19:23:03 +0000
From: Steve Wells <wells@cedarnet.org>
Subject: Permanent Connection
Message-Id: <37C6E597.C3FB83F0@cedarnet.org>
I have a client that needs to permanently connect to a server
in order to gather "live" information from it. The server
sends a heartbeat code every 5 mins to let my client know it
is alive.
So here's how I want to implement it but thought I would ask
if there is anything I'm missing or if someone has found a
better technique.
The program starts up and sets the alarm signal handler for
6 mins. Then connects to the server waiting for information.
Each time the heartbeat is sent, the alarm is reset for 6 mins.
If the alarm is called it then it restarts the program in the
same manner as if you called a -HUP signal.
Is there something that I'm missing? A better idea perhaps?
TIA,
STEVE
----------
Stephen D. Wells
http://expert.cc.purdue.edu/~bgannon/booksearch
------------------------------
Date: Fri, 27 Aug 1999 20:12:33 GMT
From: glepa@yahoo.com (Glenn Paulsen)
Subject: random number
Message-Id: <37c6f12f.7785338@news.online.no>
Hi, i need help realy bad here, can anyone make a simle script that insert a
random number into some html code. The code is below.
I need a random number where there is the number 1 now, im going to use this as
a server side include at the bottom of the page.
Best regards
Glenn
<IFRAME src="http://leader.linkexchange.com/1/X775150/showiframe?"
width="468" height="60" marginwidth="0" marginheight="0" hspace="0"
vspace="0" frameborder="0" scrolling="no
<a href="http://leader.linkexchange.com/1/X775150/clickle"
target="_top">
<p align="center"><img width="468" height="60" border="0" ismap alt
src="http://leader.linkexchange.com/1/X775150/showle?"></IFRAME>
<br>
<a href="http://leader.linkexchange.com/1/X775150/clicklogo"
target="_top"><img
src="http://leader.linkexchange.com/1/X775150/showlogo?" width="468"
height="16" border="0" ismap alt></a><br>
------------------------------
Date: Fri, 27 Aug 1999 13:40:50 -0700
From: Kin Lum <kin@0011.com>
Subject: Re: random number
Message-Id: <37C6F7D2.33848685@0011.com>
Glenn Paulsen wrote:
>
> Hi, i need help realy bad here, can anyone make a simle script that insert a
> random number into some html code. The code is below.
> I need a random number where there is the number 1 now, im going to use this as
> a server side include at the bottom of the page.
use
$n = int rand 10;
the number is from 0 to 9.
try
for($i = 0; $i < 20; $i++) {
print int rand 10, "\n";
}
note that the random number seed is different
every time. (using time())
to get a good introduction to Perl, get
Learning Perl. more info at http://www.0011.com/books/perl
------------------------------
Date: Fri, 27 Aug 1999 20:12:29 GMT
From: glepa@yahoo.com (Glenn Paulsen)
Subject: random
Message-Id: <37c6f121.7771665@news.online.no>
Hi, i need some help here, im a novice in perl programming and i realy need this
fast.
Can anyone write a script that generate a random number in the html i have
listet below, the random number should be inserted where there is a 1 now.
im going to use this as a server side include.
Thanks.
<IFRAME src="http://leader.linkexchange.com/1/X775150/showiframe?"
width="468" height="60" marginwidth="0" marginheight="0" hspace="0"
vspace="0" frameborder="0" scrolling="no
<a href="http://leader.linkexchange.com/1/X775150/clickle"
target="_top">
<p align="center"><img width="468" height="60" border="0" ismap alt
src="http://leader.linkexchange.com/1/X775150/showle?"></IFRAME>
<br>
<a href="http://leader.linkexchange.com/1/X775150/clicklogo"
target="_top"><img
src="http://leader.linkexchange.com/1/X775150/showlogo?" width="468"
height="16" border="0" ismap alt></a><br>
------------------------------
Date: Fri, 27 Aug 1999 17:09:48 GMT
From: Jim Williams <james.p.williams@usahq.unitedspacealliance.com>
Subject: Re: semaphore manipulation
Message-Id: <7q6gok$r3l$1@nnrp1.deja.com>
In article <7q4jqv$g6u$1@nnrp1.deja.com>,
Otis Gospodnetic <otis@my-deja.com> wrote:
> In article <7q1pbo$h02$1@nnrp1.deja.com>,
> Jim Williams <james.p.williams@usahq.unitedspacealliance.com> wrote:
> > In article <7q1ef1$8dr$1@nnrp1.deja.com>,
> > Otis Gospodnetic <otis@my-deja.com> wrote:
> > > I'm looking for a perl script or module for handling semaphores...
> > > So far I found IPC::Semaphore via www.cpan.org search interface,
> > > but that module does not let me manipulate semaphores that other
> > > applications have created, which is what I really need.
> >
> > While I've never used IPC::Semaphore, a quick glance at it shows
> > that it is just a wrapper around semget(), et al. As such, you
> > should be able to use it to create them anew or use existing ones
> > created by other processes.
>
> Maybe I am missing something about IPC::Semaphore.
> I see no way to get other semaphores (those that I see when I do
> 'ipcs') and manipulate (remove) them.
You're right that IPC::Semaphore provides no way to see what semaphores
are on the system. ipcs is the only way I know of to do that.
IPC::Semaphore is meant for the more typical use of semaphores: IPC.
It assumes you know the keys of the semaphores you want to manipulate.
> Application X (not perl, just something completely different) creates
> some semaphores visible with 'ipcs' and I want to write a script that
> periodically checks semaphores in the system and removes some of them
> (because they lock a certain thing, a database, which makes other
> things using that Db hang)
This sounds like the more typical use of semaphores. Apparently, you
somehow know which semaphores output by ipcs are used with the
database. If you know them by their IPC key, IPC::Semaphore should
allow you to remove them. Just create one, giving it the right key,
and call the remove() method on it. I imagine that's all ipcrm does,
although in C of course.
On the other hand, is there no way the cooperating processes can
cleanup after themselves instead of writing such a script that yanks
the semaphores out from under them?
> First I was going to write a script that would parse the output of
> 'ipcs' and do 'ipcrm -s <sem. ID>' but then I found IPC::Semaphore
> and thought that using that would be more eleegant, however I can't
> see how to remove existing semaphores, only how to create new ones
> and manipulate those that I created myself (not what I want)
The cooperating processes sharing the semaphore must agree ahead of
time on the IPC key they'll use for the rendevous. They both use this
key to access the semaphore. With this key, any process with
appropriate permissions can create, remove, and set the semaphore. ftok
() provides one way to obtain IPC keys. Your semaphore removal script,
for example would do something like this (untested).
#!/usr/local/bin/perl -w
use strict;
use IPC::SysV qw(S_IRWXU ftok);
use IPC::Semaphore;
my($key)=ftok('/my/rendevous/path',0); #or whatever
my($numSems)=1; #number of semaphores in the set
my($sem);
die "Unable to get semaphore key: $!.\n"
unless defined $key;
die "Unable to get semaphore, $key: $!.\n"
unless $sem=new IPC::Semaphore($key,$numSems,S_IRWXU);
die "Unable to remove semaphore, $key: $!.\n"
unless $sem->remove();
Does this help?
Jim Williams
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 27 Aug 1999 13:31:58 -0700
From: "David T. Cannon" <good@drinking.eng.sun.com>
Subject: Re: Spawn a Web process
Message-Id: <37C6F5BE.5B0F18C4@drinking.eng.sun.com>
Lauren,
Thanks for the reply. I think my question was clear as stated. But let
me clarify it with more text.
I have a cgi form. I complete some fields on the form that will be read
from my cgi(Perl) script "script1" that will then launch another Perl
"script2". The reason I need to launch Perl script 2 is that it takes hours
to complete, and I need the browser to come back and acknowledge that the
process has been started.
I have tried the system() command, but the browser waits for the system
call to end before continuing:
system("/opt/apache/htdocs/aw/aw-report -o /home/good/b1 -r
1999080200-1999080300 &");
Did I clear it up a bit?
Dave.
------------------------------
Date: Fri, 27 Aug 1999 20:31:41 +0100
From: Michael Crowley <michael@forward.demon.co.uk>
Subject: Thumbnails
Message-Id: <1KpNCHAdeux3EwLg@forward.demon.co.uk>
I wish to create thumbnails of JPG files on the fly. Does anyone know of
a simple script to which I can pass the file name of a JPG and it will
create a thumbnail on the fly.
--
Michael Crowley
------------------------------
Date: Fri, 27 Aug 1999 12:43:50 -0700
From: Kin Lum <kin@0011.com>
Subject: Re: Thumbnails
Message-Id: <37C6EA76.8BB66446@0011.com>
Michael Crowley wrote:
>
> I wish to create thumbnails of JPG files on the fly. Does anyone know of
> a simple script to which I can pass the file name of a JPG and it will
> create a thumbnail on the fly.
ImageMagick will do the job:
http://www.wizards.dupont.com/cristy/ImageMagick.html
PerlMagick
http://www.wizards.dupont.com/cristy/www/perl.html
the Oreilly's book is called
Web Graphics with Perl & GNU Software
more info at:
http://www.0011.com/books/perl
------------------------------
Date: 27 Aug 1999 20:00:38 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Timeing out "new Net::FTP"
Message-Id: <7q6qp6$kll$1@lublin.zrz.tu-berlin.de>
Donovan Rebbechi <elflord@panix.com> wrote in comp.lang.perl.misc:
>On Fri, 27 Aug 1999 14:09:02 -0400, Clayton Scott wrote:
>>Donovan Rebbechi wrote:
>
>>What's wrong with the Timeout option?
>
>It doesn't time out DNS lookups. ( I already use the timeout option ... )
>It only times out ftp operations that stand
>still for too long ( such as datastream connections, and ftp commands )
>
>I am starting to think that anything that uses a hostname lookup can't be
>done asynchronously unless I use an implicit fork ( eg $foo=`nslookup $bar` )
You can always use gethostbyname() and time that out yourself.
Anno
--
$,=$"; $\=$/; print map { m/(?<=")(\w*)(?=")/g } map { eval; $@ }
'another->Just', 'Hacker->Perl';
------------------------------
Date: Fri, 27 Aug 1999 13:20:30 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: URL-Encoded Format with LWP?
Message-Id: <37C6F30E.54C46911@cisco.com>
[ Linux GNUBEE wrote:
> ... but I can't seem to find any references to that format when using
> LWP::UserAgent.
Refer to : perldoc URI::URL for some references
--
------------------------------
Date: Fri, 27 Aug 1999 18:43:01 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: Using stream 2 ways
Message-Id: <V_Ax3.1956$914.81533@typ11.nn.bcandid.com>
In article <DfAx3.1395$2k1.3365@client>,
Julio Kuplinsky <jkuplins@rcc.com> wrote:
>Consider this code fragment
Consider it considered.
> @files = <STDIN>;
> .......
> chomp ($ans = <STDIN>);
>
>If I invoke this as
>
> grep -l foo * | <myprogram>
>
>then @files does get the filenames, but execution does *not* stop to
>read the user response into $ans. No, saying
Why do you expect a 'user response' to be coming into STDIN, when your STDIN
was a pipe and you already used it up?
Perhaps you are looking for open(STDIN, '/dev/tty')
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: Fri, 27 Aug 1999 13:17:10 -0600
From: Bill Anderson <banderson@boi.hp.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37C6E436.CC3338D9@boi.hp.com>
Factory wrote:
>
> In article <7putsq$3ql$1@lycaeus.calstatela.edu>, ramune@bigfoot.com
> says...
> > In article <slrn7s2lb3.k6b.abigail@alexandra.delanet.com>,
> > Abigail <abigail@delanet.com> wrote:
> > [snip amusing rant]
> > >Yeah, those math texts from the 16th and 17th century, they are sooooo easy
> > >to read, because they lack all the symbols. Not to mention the original
> > >Euclid and those other Greeks, who had no symbols at all!
> >
> > <GRIN>
> > Oh, but they're written with only symbols! All those confusing greek symbols
> > that mathematicians use are the basic building blocks for the language! Why
> > didn't they just use English?
> > </GRIN>
>
> Hmm that might be a bit off, the anchient Greeks had no concept of
> variables, thus you would never see f(x)= 2y in any old greek
> mathematics. IIRC variables were discovered(?) by Al-Jabar sometime
> after.
Correct by my memory (whence came Algebra).
> Thus the Greeks certainly did not use symbols, and it held back
> mathematics. Not that this applies to python vs. perl.
Which of course has no real relation to c.l.python ;-)
--
Bill Anderson Linux/Unix Administrator, Security Analyst
ESBU (ARC) banderson@boi.hp.com
My opinions are just that; _my_ opinions.
------------------------------
Date: Fri, 27 Aug 1999 15:05:27 -0400
From: "Tom Lichti" <tom_lichti@interactivemedia.com>
Subject: Win32::EventLog Issue
Message-Id: <7q6nib$cbh$1@goblin.uunet.ca>
I am using this module to remotely access/monitor a number of NT Server
event logs, and it seems to work fine except for one thing: the actual event
message is not always returned, and I get an "Use of uninitialized value at
V:\DOCS\DEV\Eventmon.pl line 55" error for every event that does not return
a message. If I access the log through the REAL event viewer (either locally
or remotely) all events and their messages are present.
Does anyone have any experience with this module, and more specifically this
problem? Please reply direct as well as to this group.
Thanks in advance.
Tom Lichti
------------------------------
Date: Fri, 27 Aug 1999 16:30:43 -0400
From: "Harlan Carvey, CISSP" <carvdawg@patriot.net>
Subject: Re: Win32::EventLog Issue
Message-Id: <37C6F573.4F512023@patriot.net>
Tom,
It would help tremendously if you'd post your code. There is really no
way of telling what the problem might be without looking at the code...
Carv
Tom Lichti wrote:
> I am using this module to remotely access/monitor a number of NT Server
> event logs, and it seems to work fine except for one thing: the actual event
> message is not always returned, and I get an "Use of uninitialized value at
> V:\DOCS\DEV\Eventmon.pl line 55" error for every event that does not return
> a message. If I access the log through the REAL event viewer (either locally
> or remotely) all events and their messages are present.
>
> Does anyone have any experience with this module, and more specifically this
> problem? Please reply direct as well as to this group.
>
> Thanks in advance.
> Tom Lichti
------------------------------
Date: Fri, 27 Aug 1999 16:33:05 -0400
From: "Tom Lichti" <tom_lichti@interactivemedia.com>
Subject: Re: Win32::EventLog Issue
Message-Id: <7q6smj$daf$1@goblin.uunet.ca>
As requested, here is the problem code. I have also searched some of the
newsgroup archives, and there seems to be a problem with events that have an
identical date/time stamp. Could this be the problem?
Again, thanks for the help
Tom Lichti
===================================================
#!/perl/bin/perl -w
use Win32::EventLog;
my ($cfgfile,$tag1,$tag2,$tag3,$host,$logfile);
my (%target);
my (@lines);
$cfgfile="c:/etc/eventmon.conf";
unlink 'eventmon.log';
open(CONF, "< $cfgfile")
or die "Cannot open configuration file\n";
@lines=<CONF>;
close(CONF);
foreach (@lines) {
chomp();
if ($_ =~ /^server:/) {
($tag1, $tag2, $tag3) = split(":", $_);
$target{$tag2}=$tag3;
}
}
while (($host, $logfile) = each(%target)) {
$x=0;
$hashRef="";
$handle=Win32::EventLog->new("$logfile", $host)
or die "Can't open Application EventLog for $server\n";
$handle->GetNumber($recs)
or die "Can't get number of EventLog record for $server\n";
$handle->GetOldest($base)
or die "Can't get number of oldest EventLog record for $server\n";
print (STDOUT "Server:$host LogFile:$logfile #Records:$recs
OldestRec:$base\n");
open(LOG, ">> eventmon.log");
select (LOG);
while ($x < $recs) {
$handle->Read(EVENTLOG_FORWARDS_READ|EVENTLOG_SEEK_READ,
$base+$x,
$hashRef)
or die "Can't read EventLog entry #$x\n";
Win32::EventLog::GetMessageText($hashRef);
$timegen=localtime($hashRef->{TimeGenerated});
print
"$host|$logfile|$timegen|$hashRef->{Source}|$hashRef->{EventID}|$hashRef->{M
essage}\n";
$x++;
}
close(LOG);
}
------------------------------
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 664
*************************************