[11973] in Perl-Users-Digest
Perl-Users Digest, Issue: 5573 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 5 17:07:28 1999
Date: Wed, 5 May 99 14:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 5 May 1999 Volume: 8 Number: 5573
Today's topics:
capture output from another script? lamj@softhome.net
Re: capture output from another script? <t-armbruster@ti.com>
Re: capture output from another script? <tchrist@mox.perl.com>
CHDIR with SUID <rmthisyegor@andthisgrn.com>
dedicated server: where? felixsmith@my-dejanews.com
Re: dedicated server: where? <jim@*nospam*network-2001.com>
Re: Garbage Collection Problem <norman.bunn@mci.com>
Generating Mail in Perl <hartleh1@westat.com>
Re: Generating Mail in Perl <design@raincloud-studios.com>
grep to scalar instead of variable?, subroutine exists? <design@raincloud-studios.com>
Re: grep to scalar instead of variable?, subroutine exi <design@raincloud-studios.com>
Re: having problems getting this script to work... (Larry Rosler)
Re: having problems getting this script to work... <All@n.due.net>
Re: Is there a way how to turn a PERL program into ane vepxistqaosani@my-dejanews.com
Re: Newbie question <grichard@uci.edu>
Re: Newbie question <emschwar@rmi.net>
Re: OReilly bullshit.... Camel logo trademark <el@lisse.na>
Re: OReilly bullshit.... Camel logo trademark <Wm.Blasius@ks.sel.alcatel.de>
Re: Perl in the workplace birgitt@my-dejanews.com
Re: Perl on NT workstation with PWS <perlguy@technologist.com>
Re: print<<EOF (Tad McClellan)
Re: print<<EOF (Tad McClellan)
processor usage <tbsmith@viper.net>
Re: processor usage <design@raincloud-studios.com>
Re: processor usage <t-armbruster@ti.com>
Re: Q: checking defined/usable handles? <Wm.Blasius@ks.sel.alcatel.de>
Redirection <kurt@www-masters.com>
Re: Redirection <t-armbruster@ti.com>
Re: Redirection <design@raincloud-studios.com>
Re: Redirection <emschwar@rmi.net>
Re: Redirection <t-armbruster@ti.com>
Research on ncurses/curses to HTML program magnet8@my-dejanews.com
Re: SOLVED (Was: I'm new - Please help - Sorting Questi (Larry Rosler)
Re: SSI perl hit counter <design@raincloud-studios.com>
System Call/ Autoexec.bat Problem lingane@my-dejanews.com
Re: Thumbnails from JPEGs (Randal L. Schwartz)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 05 May 1999 20:22:55 GMT
From: lamj@softhome.net
Subject: capture output from another script?
Message-Id: <7gq9ao$6lr$1@nnrp1.deja.com>
I am writing two perl scripts, the first one execute the second and the
second script will output results to the screen. I know I can use
system(argument); to execute the second script but is there anyway I can
capture the results that is printed to the screen by the second scripts?
Jason Lam
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 5 May 1999 15:36:21 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: capture output from another script?
Message-Id: <812Y2.33$zh2.2250@dfw-service1.ext.raytheon.com>
lamj@softhome.net wrote in message <7gq9ao$6lr$1@nnrp1.deja.com>...
>I am writing two perl scripts, the first one execute the second and the
>second script will output results to the screen. I know I can use
>system(argument); to execute the second script but is there anyway I can
>capture the results that is printed to the screen by the second scripts?
>
You *can* do it like this:
$a = `perl test2.pl`;
print "Output from test2.pl is: $a";
But the experts might have a better way.
BTW, the things surrounding perl test2.pl are backticks.
------------------------------
Date: 5 May 1999 14:42:13 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: capture output from another script?
Message-Id: <3730ad25@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
Suffering under Mozilla/4.5 [en] (WinNT; I),
lamj@softhome.net writes:
:I am writing two perl scripts, the first one execute the second and the
:second script will output results to the screen. I know I can use
:system(argument); to execute the second script but is there anyway I can
:capture the results that is printed to the screen by the second scripts?
Sure.
man perlfaq8
...
Why can't I get the output of a command with system()?
--tom
--
Real programmers can write assembly code in any language. :-)
--Larry Wall in <8571@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: Wed, 5 May 1999 16:19:10 -0400
From: "YDS" <rmthisyegor@andthisgrn.com>
Subject: CHDIR with SUID
Message-Id: <7gq8pg$kt6@dfw-ixnews3.ix.netcom.com>
CGI perl programming question:
When executed by nobody as a SUID to user the perl script needs to write a file
in different directory but the local one.
Because of SUID "chdir" command fails. Writing file with the full path also
fails.
What can be the work around?
PS. I do not know Italian
------------------------------
Date: Wed, 05 May 1999 18:54:49 GMT
From: felixsmith@my-dejanews.com
Subject: dedicated server: where?
Message-Id: <7gq45o$1f1$1@nnrp1.deja.com>
Hi-
I'm running a website with a perl application that for each user runs 30
seconds on average (because it goes out fetching a bunch of webpages).
When there are several users coming to the site at the same time, program
executions slows down to a crawl.
What I need is a provider with a server that lets me run *many* processes at
the same time with lots of RAM, I guess.
Also, my program right now fetches pages sequentially, so if I wanted to make
it fetch the pages simultaneously for quicker execution using fork, that
would involve even more processes.
Does anybody know a provider that would meet my needs? If I do get a
dedicated server, do you have any advise what company I should go with? I'm
currently with Verio (iserver.com), but they charge $700 per month for their
smallest dedicated server package.
Thanks a lot for helping.
Felix Smith
felixsmith@NO-SPAMbigfoot.com
(please remove NO-SPAM)
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 5 May 1999 15:46:42 -0500
From: "Jim" <jim@*nospam*network-2001.com>
Subject: Re: dedicated server: where?
Message-Id: <7gqajt$pb9$1@news3.infoave.net>
well that was off topic, but check here
http://www.dedicatedservers.com/
I'm sure there's many more if you'll check the search engines and/or
http://www.hostsearch.com
--
-Jim- syt@email.com
----------------------------------
-I don't suffer from insanity, I enjoy every minute of it.
-So what if I'm paranoid? It doesn't hurt anybody
and makes life interesting for me.
----------------------------------
- Get Paid For Staying Online -
http://www.alladvantage.com/refhome.asp?refid=ANT424
<felixsmith@my-dejanews.com> wrote in message
news:7gq45o$1f1$1@nnrp1.deja.com...
| Hi-
|
| I'm running a website with a perl application that for each user runs
30
| seconds on average (because it goes out fetching a bunch of webpages).
|
| When there are several users coming to the site at the same time,
program
| executions slows down to a crawl.
|
| What I need is a provider with a server that lets me run *many*
processes at
| the same time with lots of RAM, I guess.
|
| Also, my program right now fetches pages sequentially, so if I wanted
to make
| it fetch the pages simultaneously for quicker execution using fork,
that
| would involve even more processes.
|
| Does anybody know a provider that would meet my needs? If I do get a
| dedicated server, do you have any advise what company I should go
with? I'm
| currently with Verio (iserver.com), but they charge $700 per month for
their
| smallest dedicated server package.
|
| Thanks a lot for helping.
|
| Felix Smith
| felixsmith@NO-SPAMbigfoot.com
| (please remove NO-SPAM)
|
|
| -----------== Posted via Deja News, The Discussion Network
==----------
| http://www.dejanews.com/ Search, Read, Discuss, or Start Your
Own
------------------------------
Date: Wed, 05 May 1999 19:33:13 GMT
From: "Norman Bunn" <norman.bunn@mci.com>
Subject: Re: Garbage Collection Problem
Message-Id: <Z11Y2.131$tV4.47279@PM01NEWS>
Sorry for the typo; the version is 5.004_02. I am using the standard dbm
that comes with the Perl binary for NT (not Activestate).
I have performed some further analysis and I'm even more confused.
Here are the steps the program is taking:
1) dbmopen on a file
$newRequestFile = "/nDS/wwwroot/request/db.request.$requestID";
dbmopen (%newRequestBase, $newRequestFile, 0666) || &error_handling($!,
"dbmopen on $newRequestFile", "Submit");
2) write data to file
$counter = 0;
while ( $counter < $counter4 )
{
$newRequestBase{"Profile.$counter"} = $profile[$counter];
$counter++;
}
3) dbmclose on file
dbmclose(newRequestBase);
4) open text file
$fname = "D:/nDS/wwwroot/Mail/$location/$requestID$treatment.order" ;
open(REQUEST, ">$fname") || &error_handling($!, "open on $fname",
"Submit");
5) write data (formatted) to text file
select (REQUEST);
$counter1 = 0;
while ($counter1 < $counter4)
{
($profileDesc, $profileSKU, $profileQuantity, $profilePrice ) =
split(':', $profile[$counter1]);
$lineItemTotal = $profileQuantity * $profilePrice;
$~ = "PROFILE_DETAILS";
write;
$profileTotal = $profileTotal +$lineItemTotal;
$service = "$service$profileDesc - ";
$counter1++;
}
6) close text file
close(REQUEST);
select(stdout);
Later I look in a dbm file and notice that records exist that do not show up
in the text file. The information is being written from the same variables
for both the dbm file and the text file. The aberration has only been
reported by three people out of several thousand who have run the program.
In all cases data from a dbm file previously created by this program is
being written to a subsequently created dbm file.
Several possibilities come to mind:
- old form data is being passed by the web server (5 minutes later? browser
cache? why in dbm file and not in text? doesn't seem likely)
- perl interpreter maintaining old data and passing to subsequent running of
the program (why in dbm file and not in text? doesn't seem likely either)
- dbm (seems most likely)
Thoughts?
Norman
Steve Linberg wrote in message ...
>In article <2IjX2.160$Ca.50633@PM01NEWS>, "Norman Bunn"
><norman.bunn@mci.com> wrote:
>
>> I am submitting a form to a perl program which has been running fine
until
>> recently. On rare occasions, it picks up data from a previously
submitted
>> form. I'm not sure how it is doing this since each time a new process is
>> launched. This is running under Perl 5.004_2 under NT 4.0 SP4. Any
ideas
>> on what could be causing this?
>
>Sure your version is correct?
>
>In any event, it sounds like your server is misbehaving. Be sure you use
>CGI.pm as documented and initialize your variables when the script begins,
>especially if you are running under mod_perl or something similar.
>
>Code samples might help specific diagnoses.
>
>--
>Steve Linberg, Systems Programmer &c.
>National Center on Adult Literacy, University of Pennsylvania
>email: <linberg@literacy.upenn.edu>
>WWW: <http://www.literacyonline.org>
------------------------------
Date: Wed, 05 May 1999 15:19:30 -0400
From: Henry Hartley <hartleh1@westat.com>
Subject: Generating Mail in Perl
Message-Id: <373099C2.371E6D4@westat.com>
This is not a Perl question. If anyone knows of a cc:Mail newsgroup,
I'll take this question there. I couldn't find one. I'm working in
Perl and thought someone here might be willing to help.
I've got a script that generates an E-Mail message to a list of
addresses from a database (selected employees at our company). Now I'm
told they would like part of the text to be BOLD. Since our company
standard is cc:Mail 8.2, I need to know what character(s) cc:Mail
interprets as "start bold" and "end bold". Anyone? I'm usng Blat if
that matters.
Henry Hartley
------------------------------
Date: Wed, 05 May 1999 19:33:17 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Generating Mail in Perl
Message-Id: <121Y2.1761$iu1.1590@news.rdc1.tn.home.com>
>If anyone knows of a cc:Mail newsgroup,
>I'll take this question there. I couldn't find one. I'm working in
>Perl and thought someone here might be willing to help.
you might try one of the comp.mail offshoots. misc might have something.
Picking one of the more generic ones will probably turn up someone with
knowledge of your problem. Make sure to use something like cc:Mail Bold
Text Characters? instead of this subject title so you will have a higher
chance of getting a response.
CT
------------------------------
Date: Wed, 05 May 1999 19:19:25 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: grep to scalar instead of variable?, subroutine exists?
Message-Id: <1R0Y2.1753$iu1.1647@news.rdc1.tn.home.com>
I just got this....
my $button = '';
foreach $button($query->param){
if (defined ($actions{$button})){
&{$actions{$button}};
return;
}
}
&huh;
converted to this (and I'm feelin pretty good about it)...
my @button = grep(/^btn_(.*)/, $query->param);
&{$actions{$button[0]}} ;
actions is a hash of buttons and matching subroutines. It works.. but I
know of two areas that are incorrect. I'm shooting for a two liner, and
wouldn't mind seeing if I could get it to one if I can get the grep to
evaluate to one item and error check the subroutine afterwards.
1)GREP
grep returns it's matches as an array and using $button of course only
shows the number of items in the array. Using $button[0] feels like a
hacked solution. Since there should never be more than two btn_ in the
param() (.x and .y, same name... coordinates from an image map), is
there a slicker way to just say "extract the first match to btn_ you
find and put it in this scalar instead of an array" in code?
I investigated using $query->param =~ m// instead and wondered if $&
would be useful here, until the FAQ explained that $& slows down my
program.
I've read "How can I tell whether a list or array contains a certain
element?" and the other Data:Array and Hash FAQ. Which if I got it,
explains a grep like this is slower and less efficient than my original
loop.
So now I'm just confused. There could be 25 buttons in the hash, and I'd
hate to loop through almost every one if a quick grep extraction is more
efficient.
2) FAILED SUB CALL
Since I have moved from the loop, I no longer check if $button is
defined in %actions. How might I call &huh if calling my btn_ subroutine
fails? I tried a || &huh; at the end but the system failure is captured
before my error trap.
a point to a resource explaining a solution is as welcome as an answer.
CT
------------------------------
Date: Wed, 05 May 1999 19:28:46 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: grep to scalar instead of variable?, subroutine exists?
Message-Id: <OZ0Y2.1756$iu1.1595@news.rdc1.tn.home.com>
>Since there should never be more than two btn_ in the
>param() (.x and .y, same name... coordinates from an image map), is
>there a slicker way to just say "extract the first match to btn_ you
>find and put it in this scalar instead of an array" in code?
I just realized I need to modify the grep to extract either the .x or .y
version of btn_ or the code will fail if .y is caught first. Another
alternative would be to strip the . and anything after. Then the code
could also use standard form buttons.
CT
------------------------------
Date: Wed, 5 May 1999 12:00:29 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: having problems getting this script to work...
Message-Id: <MPG.119a352195593259899d0@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7gpdt0$ua6$1@nntp8.atl.mindspring.net> on Wed, 5 May 1999
08:44:25 -0400, Allan M. Due <Allan@due.net> says...
...
> Not that it really matters but replacing that map with a foreach should be
> quicker.
I was surprised by that, because there seem to be fewer function calls
with the 'print map'. Probably just allocating the long list for
'print' takes the extra time.
But neither of them is the fastest, as Bart Lateur's approach is the
clear winner. I'll have to use it more often.
#!/usr/local/bin/perl -w
use strict;
use Benchmark;
my @data = (('x' x 50) x 50);
open OUT, '>NUL' or die "Couldn't open 'NUL'. $!";
# Pardon my misspelling of '/dev/null'. :-)
timethese(1 << (shift || 0), {
For => sub { print OUT "$_\n" for @data },
Map => sub { print OUT map "$_\n", @data },
Vars => sub { ($,, $\) = ("\n", "\n"); print OUT @data },
});
__END__
Benchmark: timing 16384 iterations of For, Map, Vars...
For: 9 wallclock secs ( 9.88 usr + 0.17 sys = 10.05 CPU)
Map: 11 wallclock secs (11.45 usr + 0.22 sys = 11.67 CPU)
Vars: 8 wallclock secs ( 7.17 usr + 0.22 sys = 7.39 CPU)
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 05 May 1999 19:49:21 GMT
From: "Allan M. Due" <All@n.due.net>
Subject: Re: having problems getting this script to work...
Message-Id: <5h1Y2.2618$612.1496@news.rdc1.ct.home.com>
Larry Rosler <lr@hpl.hp.com> wrote in message
news:MPG.119a352195593259899d0@nntp.hpl.hp.com...
: [Posted and a courtesy copy mailed.]
:
: In article <7gpdt0$ua6$1@nntp8.atl.mindspring.net> on Wed, 5 May 1999
: 08:44:25 -0400, Allan M. Due <Allan@due.net> says...
: ...
: > Not that it really matters but replacing that map with a foreach should
be
: > quicker.
:
: I was surprised by that, because there seem to be fewer function calls
: with the 'print map'. Probably just allocating the long list for
: 'print' takes the extra time.
Even a blind squirrel (meaning me) finds a nut everyonce in a while ;-)
: But neither of them is the fastest, as Bart Lateur's approach is the
: clear winner. I'll have to use it more often.
Hey that's pretty nifty. Another cool tidbit. Thanks for the illumination
Larry.
AmD
[snip of benchmark]
cc'd cause its a Larry thing
------------------------------
Date: Wed, 05 May 1999 19:32:05 GMT
From: vepxistqaosani@my-dejanews.com
Subject: Re: Is there a way how to turn a PERL program into ane EXE file?
Message-Id: <7gq6bm$3no$1@nnrp1.deja.com>
In article <3730834B.C882BA6A@mail.cor.epa.gov>,
David Cassell <cassell@mail.cor.epa.gov> wrote:
> Why do you want to do this?
In my organization, I have been assured that (a) many computers are too
small/slow to install ActivePerl (yes, they're all Redmond-impaired), (b) most
users are not computer-literate enough to be able to run Perl, and (c) the
Networks department won't support Perl.
So I port to C and distribute executables. That way I can put in all those
neat virii that will be triggered when I leave. (Just kidding ... but how do
_they_ know?)
Fred
$_="ustJay notherAay ewNay erlPay ackerHay";s/(\w+?)(\w)ay/$2$1/g;print;
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 5 May 1999 12:43:43 -0700
From: "Gabriel Richards" <grichard@uci.edu>
Subject: Re: Newbie question
Message-Id: <7gq6nv$4q@news.service.uci.edu>
<metamorphon@hotmail.com> wrote in message
news:372E4A1D.84F431DB@hotmail.com...
> Is there a good book out there for beginners where I could learn Perl or
> CGI on windows 95.
I would suggest Perl 5 for Dummies. I'm new to Perl (and programming) too
and I know all the Perl hackers are going to say that the book sucks and is
full of bad advice, but this is just their ego talking. Note that they won't
tell you what the bad advice is, presumably because they haven't read the
book.
The dummies book taught me the basics I needed to know very well and very
quickly. I then bought the Camel book for more in-depth reference and
learning. I don't really know yet how to judge the quality of my code, but
based on the knowledge gained from the dummies book I was able to program a
functional web forums/discussion script, all sorts of form processing
scripts, and a script which searches a database of scholarships based on
user inputted keywords/modifiers. This with only a few months experience. I
think the dummies book is a great place to start.
Gabe
------------------------------
Date: 05 May 1999 14:06:21 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Newbie question
Message-Id: <xkfk8unmgci.fsf@valdemar.col.hp.com>
"Gabriel Richards" <grichard@uci.edu> writes:
> <metamorphon@hotmail.com> wrote in message
> news:372E4A1D.84F431DB@hotmail.com...
> > Is there a good book out there for beginners where I could learn Perl or
> > CGI on windows 95.
>
> I would suggest Perl 5 for Dummies. I'm new to Perl (and programming) too
> and I know all the Perl hackers are going to say that the book sucks and is
> full of bad advice, but this is just their ego talking. Note that they won't
> tell you what the bad advice is, presumably because they haven't read the
> book.
Actually, all you have to do is read Tom Christiansen's review of it on
<URL:http://language.perl.com/critiques/index.html>. There's plenty of
reasons it's a bad idea, but I won't bother repeating his words here--
just check out that page. It gives reviews of a great many books on both
Perl and CGI, and is probably what the original poster wanted.
> I don't really know yet how to judge the quality of my code, but
> based on the knowledge gained from the dummies book I was able to
> program a functional web forums/discussion script, all sorts of form
> processing scripts, and a script which searches a database of
> scholarships based on user inputted keywords/modifiers. This with only
> a few months experience. I think the dummies book is a great place to
> start.
I'll let TomC handle this, if he cares to, but my personal opinion is
that it was Perl's flexibility and ease of use that made it possible for
you to do this, rather than any book (even the Camel).
-=Eric
------------------------------
Date: Wed, 5 May 1999 21:18:04 +0100
From: Dr Eberhard W Lisse <el@lisse.na>
Subject: Re: OReilly bullshit.... Camel logo trademark
Message-Id: <925935484.331093496@localhost>
Matt,
"Matt Kruse" <mkruse@rens.com> wrote:
>I received this email today, with regard to
>http://mkruse.netexpress.net/perl/
>
>It's unfortunate that O'Reilly feels the need to control the web to this
>extent.
>
>For all of you who might have a camel on your Perl page, watch out.
>Big Brother is watching...
>
>I'm extremely disappointed in O'Reilly.
Are you a laywer? If not, consult one with regards to Trade Marks, Servic=
e
Marks and enforcement thereof. You'll find that O'Reilly has a rightful
ownership of tha Trade Mark and that they *HAVE* to enforce this in order=
to
keep it.
Whining to the Net will make you feel better, but doesn't help
el
--=20
Dr. Eberhard W. Lisse\ / Swakopmund State Hospita=
l
<el@lisse.NA> * | Resident Medical Office=
r
Private Bag 5004 \ / +264 81 1246733 (c) 64 461005(h) 461004(f=
)
Swakopmund, Namibia ;____/ Domain Coordinator for NA-DOM (el108=
)
------------------------------
Date: Wed, 05 May 1999 22:14:01 +0200
From: William Blasius #42722 <Wm.Blasius@ks.sel.alcatel.de>
Subject: Re: OReilly bullshit.... Camel logo trademark
Message-Id: <3730A689.2781E494@ks.sel.alcatel.de>
Greg Bacon wrote:
>
> In article <37308062@cs.colorado.edu>,
> Tom Christiansen <tchrist@mox.perl.com> writes:
> : In comp.lang.perl.misc, <mkruse@netexpress.net> writes:
> : :I received this email today, with regard to
> : :http://mkruse.netexpress.net/perl/
> : :
> : :It's unfortunate that O'Reilly feels the need to control the web to this
> : :extent.
> :
> : That's not what's going on. If you had a Camel logo advertising
> : your home-grown cigarettes, don't you think that the tobacco
> : lords would hunt you down?
>
> Your analogy fails in that Matt isn't attempting to use O'Reilly's
> mark for books to bolster his book sales. Camel couldn't come after
> me for putting camel images on a line of crescent wrenches. It would
> be just as ludicrous for O'Reilly to do the same. Apparently, ORA is
> asserting trademark on Camel images in association with Perl
> publications (using a very generous definition of `publication') and
> waiting for someone with sufficient supplies of cojones and denero to
> challenge them on it.
I believe the preferred strategy is to find somebody with sufficient
supplies of cojones and insufficient supplies of denero to challenge
them on it. A decision in the hand is worth two on the docket.
> Legal-might-makes-right is a disgusting attitude.
>
> : They have to, or lose their rights
> : to keep their distinctive trademark. ORA put the camel on the book.
> : That association is theirs alone.
>
> What books are on Matt's page? I don't deny that The Association for
> Perl *books* is an ORA mark. No one does. ORA is, however,
> overextending the bounds of reason. Greed and tyranny never got anyone
> anywhere for long.
For particular values of "long" ;-)
I don't see any notifications on my copy of the Camel which notifies the
connection betwen Perl and the camel - is that just dromedaries or every
humping beast, I wonder - and somehow this strikes me as rather contrary
to the spirit of the Perl community. But then again, it is late and what
do I know anyway?
Wm Blasius
Stuttgart
---
...now I'm <wm.blasius@ks.sel.alcatel.de> - no matter what my mail
server says!
------------------------------
Date: Wed, 05 May 1999 19:25:30 GMT
From: birgitt@my-dejanews.com
Subject: Re: Perl in the workplace
Message-Id: <7gq5v4$39u$1@nnrp1.deja.com>
In article <7gpgou$ep3$1@nnrp1.dejanews.com>,
sstarre@my-dejanews.com wrote:
> Thanks so much for the replies. I tried to plead the case again with some of
> your suggestions, and I got my answer. I'm dismissed. They're letting me work
> through 30-June and then they said it's bon voyage to me and my non-conformist
> attitude.
>
> I'm a little distressed, but not so distressed as to capitulate and use VB
> Script or NT.
>
> Anyhow, thanks, I think you all are not only very helpful but also have the
> right ideas about Perl and why it should be allowed.
>
> On to greener pastures I hope :) I have a few weeks to find a Perl-friendly
> workplace..
Wow, I can't believe that. I wonder if one could be fired for something
like that outside the US. May be you should go oversees for a while. Perl
programmer are certainly needed there. 8-)
Though not being a (Perl) or otherwise a programmer, but someone who decided
to eventually become one, I had a similar first exposure. During my first
internship ever in an IT department of a company with 600 employees and a
network of around 500 workstations stretched over offices in eleven cities in
Germany, management claimed to want a Web presence with some customized
applications, all of which could be solved using Perl. I was allowed to visit
the software house which they wanted to choose for doing the job for them. It
was a specialized company for that industry's branch and pretty much without
competition in that field.
In an office of 20 programmer many with over twenty to thirty years of
experience, no one was (allowed to ?) using Perl, although the boss of them
admitted he knew that most of them would swear on their mother's bible
in favor of using Perl.
Pretty much the same in regards to working on a Linux platform.
Arguments: They can't afford to use both as their customers wouldn't trust
them and both Perl and Linux are too difficult to handle regarding giving
technical support to their clients.
Somehow I was glad having been in a situation where I couldn't
possibly have been considered for any of the forthcoming tasks yet
and it made my decision to go back to school MUCH easier.
Hope you find a good job soon and a boss who has an appropriate amount of
fun with Perl. 8-)
Birgitt Funk
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 05 May 1999 15:32:44 -0500
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Perl on NT workstation with PWS
Message-Id: <3730AAEC.FEBF380A@technologist.com>
Give the FAQ's at http://www.activestate.com/activeperl a chance.
They'll guide you step-by-step in getting your new system up and running
in no time! Well, actually it will take you a few minutes...
Good luck!
BRent
Jim Phillips wrote:
>
> I am developing a web site using Perl. I am running NT workstation, Personal
> Web Server and ActiveState Perl. I changed PC and have reset my project on
> my new computer. The problem I am having is ever Perl program I try to link
> to returns a HTTP error 404. I know I have probably not got something right
> in the setup because this was working on my old machine. Any ideas? Any help
> you could give me would be greatly appreciated.
>
> Jim Phillips
> jphillips@tva.campuscwix.net
------------------------------
Date: Wed, 5 May 1999 11:08:20 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: print<<EOF
Message-Id: <4tmpg7.9v5.ln@magna.metronet.com>
Liao Yen Feng (a4565992@ethome.net.tw) wrote:
: i write some code on Unix
: like this
: print <<'TEST';
: if ($a eq "test") {
: print $a;
: }
: TEST
: on unix i can see
: --
: if ($a eq "test") {
: print $a;
: }
: --
: But On windows mode..(Winperl)
: Get error "EOF in string at Document line 1"
: Some one can teach me...how to do is best way...
I cannot find that message in perldiag.pod.
So it looks like it is not a message from Perl.
Is that the exact message text?
You should FTP in ASCII mode when transferring files between
dissimilar systems.
I'll bet you are missing some CRs in there...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 5 May 1999 11:05:44 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: print<<EOF
Message-Id: <8ompg7.9v5.ln@magna.metronet.com>
Charles R. Thompson (design@raincloud-studios.com) wrote:
: > print <<'TEST';
: > if ($a eq "test") {
: > print $a;
: > }
: > TEST
: I may be wrong about this, but I think 'TEST' and TEST are two different
: things.
You are wrong :-(
The single quotes just make the here-doc "single quotish",
which he needed so that $a doesn't get interpolated.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 05 May 1999 15:04:35 -0500
From: Todd Smith <tbsmith@viper.net>
Subject: processor usage
Message-Id: <3730A453.AD4027CC@viper.net>
How can i run a perl program that does infinite loops until a certain
condition is met, without the program taking up 99% of the processor?
--
-------------------------------------
Todd Smith
- Just Another Perl Hacker
ITC^DeltaCom
tbsmith@deltacom.net
------------------------------
Date: Wed, 05 May 1999 20:08:00 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: processor usage
Message-Id: <Ay1Y2.1775$iu1.1523@news.rdc1.tn.home.com>
>How can i run a perl program that does infinite loops until a certain
>condition is met, without the program taking up 99% of the processor?
Depends on how often you check, doesn't it? Perhaps some timing delays
would help the problem?
IMO, sometimes conditions aren't met, careful what you wish for to come
true.
CT
------------------------------
Date: Wed, 5 May 1999 15:10:17 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: processor usage
Message-Id: <IE1Y2.31$zh2.2279@dfw-service1.ext.raytheon.com>
Todd Smith wrote in message <3730A453.AD4027CC@viper.net>...
>How can i run a perl program that does infinite loops until a certain
>condition is met, without the program taking up 99% of the processor?
>
Are you talking about something like this?
while(){
print 'x';
sleep(1);
}
------------------------------
Date: Wed, 05 May 1999 21:54:00 +0200
From: William Blasius #42722 <Wm.Blasius@ks.sel.alcatel.de>
To: Sebastian Frankfurt <sf@tellux.de>
Subject: Re: Q: checking defined/usable handles?
Message-Id: <3730A1D8.167EB0E7@ks.sel.alcatel.de>
[ a Cc: of this post was sent to Sebastian Frankfurt <sf@tellux.de> ]
Sebastian Frankfurt wrote:
>
> Hello,
>
> I am getting some handles via IPC::Open3 and save them in variables.
> And now I could print something out into the IN-Handle of that process.
>
> [...]
>
> IPC::Open3('READER', 'WRITER', '', "$program 2>&1\n"); # ok
> $p_in = *READER; # ok
> $p_out = *WRITER; # ok
>
> [...]
>
> print $p_out "some nice output\n"; # ok if other process is running
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> if the process I opened via IPC::Open3 has been
> terminated before this call, my 'print' is waiting
> for hours.
>
> So, there are (I think) two solutions:
>
> 1) I have to check, if the handle '$p_out' is usable
> -> 'defined($p_out)' is not working, cause it will
> look if '$p_out' is defined and not the handle it
> represents.
>
> or
>
> 2) I have to check, if the other process is still running
>
> Has anyone an idea?
>
from perldoc select:
DESCRIPTION
The IO::Select package implements an object approach to the
system select function call. It allows the user to see what
IO handles, see the IO::Handle manpage, are ready for
reading, writing or have an error condition pending.
So:
$rin = "";
vec($rin, fileno($p_out), 1) = 1 if defined fileno($p_out);
if select( $rout=$rin, undef, $eout=$rin, 0) {
$rout ? syswrite $p_out "some nice output\n" : die "some nasty
error";
};
Better error handling might ba a worthwhile option. ;-)
hth
Wm Blasius
Stuttgart
--
...now I'm <wm.blasius@ks.sel.alcatel.de> - no matter what my mail
server says!
------------------------------
Date: Wed, 05 May 1999 12:37:22 -0700
From: Kurt Schuster <kurt@www-masters.com>
Subject: Redirection
Message-Id: <37309DEE.45BF45DF@www-masters.com>
Dear Friends,
I have written a program which uses the HTTP::Request method. The
response from the server is a redirect (status code 302). I want to see
the page which is refered to by the redirection and I don't know how.
The transaction is begun by a POST of data to a server script. When the
server returns a HTML document everything works fine but when I get this
redirect I'm stuck.
Thanks in advance for your help.
Sincerely,
Kurt
PS - please respond to me at mailto:kurt@www-masters.com
------------------------------
Date: Wed, 5 May 1999 14:54:12 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: Redirection
Message-Id: <Hp1Y2.30$zh2.2263@dfw-service1.ext.raytheon.com>
Listen, this is a *PERL* newsgroup. Got that? PERL...... P....E....R....L.
What part of comp.lang.perl.misc do you not understand?
Kurt Schuster wrote in message <37309DEE.45BF45DF@www-masters.com>...
>Dear Friends,
>
>I have written a program which uses the HTTP::Request method. The
>response from the server is a redirect (status code 302). I want to see
>the page which is refered to by the redirection and I don't know how.
>
>The transaction is begun by a POST of data to a server script. When the
>server returns a HTML document everything works fine but when I get this
>
>redirect I'm stuck.
>
>Thanks in advance for your help.
>
>Sincerely,
>Kurt
>
>PS - please respond to me at mailto:kurt@www-masters.com
>
>
>
------------------------------
Date: Wed, 05 May 1999 20:04:40 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Redirection
Message-Id: <sv1Y2.1774$iu1.1428@news.rdc1.tn.home.com>
>I have written a program which uses the HTTP::Request method. The
>response from the server is a redirect (status code 302). I want to see
>the page which is refered to by the redirection and I don't know how.
>The transaction is begun by a POST of data to a server script. When the
>server returns a HTML document everything works fine but when I get
this
Using the GET method should let you see the entire query string in the
HTTP_REFERRER. Using post will result in the loss of form data in the
referrer string. We often use the GET method so we can easily log
searches to evaluate what people are looking for on a site without alot
of bru-ha-ha in code.
Is that what you are looking for?
CT
------------------------------
Date: 05 May 1999 14:38:39 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Redirection
Message-Id: <xkfhfprmeuo.fsf@valdemar.col.hp.com>
"Tim Armbruster" <t-armbruster@ti.com> writes:
> Listen, this is a *PERL* newsgroup. Got that? PERL......
> P....E....R....L. What part of comp.lang.perl.misc do you not
> understand?
Back off, eh. He's *using* Perl. He's asking a question about how to do
something *IN PERL*, using standard Perl modules. It's not CGI, it's not
HTML, it's about how to handle a standard protocol (HTTP) in the language
of this newsgroup (Perl). Don't be so quick to jump on people.
> Kurt Schuster wrote in message <37309DEE.45BF45DF@www-masters.com>...
> >The transaction is begun by a POST of data to a server script. When the
> >server returns a HTML document everything works fine but when I get this
> >redirect I'm stuck.
Have you read the LWP::UserAgent pod? In there, it explains when to
override the "redirect_ok" method, which sounds like it is exactly what
you want to do. I confess I'm not terribly conversant with HTTP, so you
might want to investigate why it behaves the way it does before you
override it blindly.
-=Eric
------------------------------
Date: Wed, 5 May 1999 15:41:50 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: Redirection
Message-Id: <h62Y2.34$zh2.2322@dfw-service1.ext.raytheon.com>
Eric The Read wrote in message ...
>"Tim Armbruster" <t-armbruster@ti.com> writes:
>> Listen, this is a *PERL* newsgroup. Got that? PERL......
>> P....E....R....L. What part of comp.lang.perl.misc do you not
>> understand?
>
>Back off, eh. He's *using* Perl. He's asking a question about how to do
>something *IN PERL*, using standard Perl modules. It's not CGI, it's not
I guess I missed the HTTP::Request part, or read it as just a plain HTTP
request. It's kind of subtle, but I apologized anyway.
------------------------------
Date: Wed, 05 May 1999 19:28:51 GMT
From: magnet8@my-dejanews.com
Subject: Research on ncurses/curses to HTML program
Message-Id: <7gq65d$3j0$1@nnrp1.deja.com>
I was wondering if anyone has any idea of how to take a ncurses/curses based
text style menu and convert the information to HTML. Essentially what i am
looking/wanting to do is make a bunch of pre-defined HTML templates that
match the existing menu configurations of our legacy software. Then read in
the info from the text menu's and load the variables in the pre-defined pages
... and back. Basically a web front end. I am a perl rookie with an appetite
for learning and would appreciate a little direction on where i can find
information on attempting something like this. Is this do-able with just
straight perl? or would a java/perl mix be easier? Are there modules already
developed that can handle some of this? Does anyone know of any code that
does something like this already? For now i will be studying ncurces, curses
and maybe termcap to get a better understanding of how they work.
Any direction or help would be greatly appreciated
Magnet8
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 5 May 1999 12:35:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: SOLVED (Was: I'm new - Please help - Sorting Question)
Message-Id: <MPG.119a3d6cec7c18d79899d1@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed. Subject changed to try to get it
back into the original thread.]
In article <373079F0.25E271C7@i-tradeonline.com> on Wed, 05 May 1999
10:04:14 -0700, Chance Houston <news@i-tradeonline.com> says...
...
> My database is a text file that looks like this . . .
> major_category|sub_category|site_url|site_title|description|feature|graphic|keywords|clickCount
>
> What is the best way to sort my search results by the last item
> (clickCount)?
>
> ------ SOLUTION -------
> # It's not pretty but it works
Well done! I'm sure you won't mind some improvements that may be
instructive.
> # Read in the database - store as an array
> open(DATA,"database.txt") || die;
The error message should include the name of the file, and $! for the
reason.
> while (<DATA>)
> {
> @database ["$i"] = $_;
This is wrong, though it happens to work here. The '-w' flag would warn
you. Also, the quotes around $i are superfluous and misleading, and
prevent you from doing the increment in the same place.
> $i++;
> }
Replace the whole loop with:
my @database = <DATA>;
> close (DATA);
>
> # Sort by the number at the end of the field
> @idx = ();
> for (@database) {
> ($item) = /\|([^|]*)$/;
> push @idx, uc($item);
> }
Numbers are the same in lower-case or upper-case. :-)
With the map function (Randal showed something like this yesterday!),
and a simpler regex:
my @idx = map /(\d*)$/, @database;
> @sorted = @database[ reverse sort { $idx[$a] <=> $idx[$b] } 0 .. $#idx
> ];
@sorted = @database[ sort { $idx[$b] <=> $idx[$a] } 0 .. $#idx ];
This 'index sort' is OK. TMTOWTDI, of course, as perlfaq4 shows.
> # print the top 10
> while ($j < 10) {
> print @sorted ["$j"];
> $j++;
> }
The above is wrong for the same reasons as the first loop.
How do you know that there are at least 10 elements? Code defensively,
if for no other reason that it makes testing easier.
Replace the whole loop with:
print @sorted[0 .. ($#idx < 9 ? $#idx : 9)];
Putting it all together (with some more style diddles):
#!/usr/local/bin/perl -w
use strict;
###open DATA, 'database.txt' or
### die "Couldn't open 'database.txt'. $!\n";
my @database = <DATA>;
close DATA;
my @idx = map /(\d*)$/, @database;
my @sorted = @database[ sort { $idx[$b] <=> $idx[$a] } 0 .. $#idx ];
print @sorted[0 .. ($#idx < 9 ? $#idx : 9)];
__END__
foo|55
bar|baz|3
zorp|99
||||0
1
A CLERK ther was of Oxenford also,
That unto logyk hadde longe ygo.
...
And gladly wolde he lerne, and gladly teche.
(Chaucer, The Canterbury Tales)
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 05 May 1999 19:25:19 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: SSI perl hit counter
Message-Id: <zW0Y2.1754$iu1.1220@news.rdc1.tn.home.com>
>open (count, 'counter.dat') || print "<font face=\"$font_face\"
>size=\"$font_size\">cant open counter file</font>";
>$new_num = <count>;
>$new_num = $new_num + 1;
>close (count);
>open (count2, '>counter.dat') || print "<font face=\"$font_face\"
>size=\"$font_size\">cant open counter file</font>";
>print count2 "$new_num";
>close (count2);
Can't this be done without opening the file twice? Open it for
read/write?
I bet your server has a stroke when it gets busy.
Check this out...
http://language.perl.com/newdocs/pod/perlfaq5.html#I_still_don_t_get_loc
king_I_jus
CT
------------------------------
Date: Wed, 05 May 1999 19:36:31 GMT
From: lingane@my-dejanews.com
Subject: System Call/ Autoexec.bat Problem
Message-Id: <7gq6jv$3t2$1@nnrp1.deja.com>
I need to do the following on any microsoft platform.
I need to get a directory listing of all files on a disk, then process
that list of names.
I have limited space so I cannot write this file to the disk.
I have been using
open(FILHAND,"dir c:\\ /a-d /o-n /s /b |");
while $line <FILHAND>
{
}
This works fine, unless my autoexec.bat file contains a path with more than an
8 character directory name. For some reason this confuses the system command
and it comes back with dir: c:\ : No such file or directory
dir: /a-d : No such file or directory
dir: /o-n:No such file or directory
dir: /s:No such file or directory
dir: /b:No such file or directory
If I just do a system command and pipe the output of the dir command to a file
it works fine. There is only a problem if I am not writing to a file.
So here are my constraints :
I need to go to the base directory of a specified drive.
Obtain a directory listing of all files excluding directory names.
I cannot write this directory listing to a file.
I cannot change the autoexec.bat file on the machine.
I'v been working on this for awhile and can't come up with a solution that
meets the requirements.
Thanks For Any Help You Can Offer
K
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 05 May 1999 13:43:33 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Thumbnails from JPEGs
Message-Id: <m1yaj38cy2.fsf@halfdome.holdit.com>
>>>>> "Martin" == Martin <martin@guest-books.com> writes:
Martin> I'm looking for a Perl module/Script that will output a smaller
Martin> thumbnail
Martin> from a full sized JPEG. I've look at CPAN and in the graphics section
Martin> at www.perl.com but can't seem to find anything.
You didn't look at my WebTechniques columns:
http://www.stonehenge.com/merlyn/WebTechniques/
But I'm not actually using the code from there any more. I'm using
this:
#!/home/merlyn/bin/perl
use strict;
use Image::Magick;
my $im = Image::Magick->new;
umask 0022;
my @names = @ARGV ? @ARGV : grep { -f and -B } <*>;
for (@names) {
if (/ /) {
my $old = $_;
tr, ,_,s;
$_ .= ".jpg" unless /\.jpg$/;
! -e and rename $old, $_ or next;
warn "renaming $old to $_\n";
}
next if /\.thumb\.jpg$/;
my $thumb = "$_.thumb.jpg";
next if -e $thumb;
undef @$im;
my $ret;
$ret = $im->Read($_)
and warn($ret), next;
$ret = $im->Scale(geometry => '100x100')
and warn($ret), next;
$ret = $im->Write($thumb)
and warn($ret), next;
warn "thumbnail made for $_\n";
}
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
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 5573
**************************************