[12928] in Perl-Users-Digest
Perl-Users Digest, Issue: 338 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 2 17:18:02 1999
Date: Mon, 2 Aug 1999 14:10:16 -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 Mon, 2 Aug 1999 Volume: 9 Number: 338
Today's topics:
Re: Question dealing with inlined my <sariq@texas.net>
Re: Question dealing with inlined my (Neko)
Re: Question dealing with inlined my <ltl@rgsun5.viasystems.com>
Re: Question dealing with inlined my <stampes@xilinx.com>
Search (Jimtaylor5)
Stopping output <richj@home.com>
using __PACKAGE__ jschueler@tqis.com
Re: using __PACKAGE__ <tchrist@mox.perl.com>
Re: why are you so harsh to this guy ? <cassell@mail.cor.epa.gov>
Win32 Perl won't display HTML <willyp@mossbay.com>
Re: Win32::OLE or something else ??? (Jan Dubois)
Working Telnet Script Needed <ssanbeg@home.com>
Re: working with = sign in a directory name - please he <sariq@texas.net>
Re: working with = sign in a directory name - please he <cassell@mail.cor.epa.gov>
Re: working with = sign in a directory name - please he (Larry Rosler)
Re: working with = sign in a directory name - please he (I R A Darth Aggie)
Re: working with = sign in a directory name - please he (I R A Darth Aggie)
Re: Y2K in Washington (Was: Re: print "Location: http:/ (Larry Rosler)
Re: Y2K in Washington (Was: Re: print "Location: http:/ <sariq@texas.net>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 02 Aug 1999 14:32:35 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Question dealing with inlined my
Message-Id: <37A5F253.8F19CB5C@texas.net>
Jete Software Inc. wrote:
> Using the following code:
> my($stat)
> $stat = `ps -ef | grep search`;
<snip of scalar context>
> While this code using an inlined my:
> my($stat) = `ps -ef | grep search`;
<and then list context>
> Why is there a difference between the two outputs??
perldoc perlsub
- Tom
------------------------------
Date: 2 Aug 1999 19:44:04 GMT
From: tgy@chocobo.org (Neko)
Subject: Re: Question dealing with inlined my
Message-Id: <7o4se4$38q$0@216.39.141.200>
On 2 Aug 1999 14:57:14 -0400, jete@dgs.dgsys.com (Jete Software Inc.) wrote:
> my($stat)
> $stat = `ps -ef | grep search`;
Scalar context.
> my($stat) = `ps -ef | grep search`;
List context.
>Why is there a difference between the two outputs?? I want to be sure that my code
>isn't now laced with bugs.
my $stat = `ps -ef | grep search`; # Scalar context.
--
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=
------------------------------
Date: 2 Aug 1999 20:16:32 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: Question dealing with inlined my
Message-Id: <7o4ub0$9d2$1@rguxd.viasystems.com>
Jete Software Inc. <jete@dgs.dgsys.com> wrote:
:>Using the following code:
:> my($stat)
:> $stat = `ps -ef | grep search`;
:>produces this:
:>DB<1> p $stat
:> ituser 25802 1404 0 Jul 30 ? 1:07 /PublishingXpert/2.2/bin/psadmin/searchsrv
:> ituser 10405 10404 0 14:52:33 pts/9 0:00 sh -c ps -ef | grep search
:> ituser 10406 10405 0 14:52:33 pts/9 0:00 grep search
Backticks evaluated in scalar context. Returns one long string.
:>While this code using an inlined my:
:> my($stat) = `ps -ef | grep search`;
:>only produces this:
:> DB<1> p $stat
:> ituser 25802 1404 0 Jul 30 ? 1:07 /share/trea_www/PubX/be/PublishingXpert/2.2/bin/psadmin/searchsrv
Backticks evaluated in array context returns list of values,
one for each line. You threw away the rest of the lines.
:>Why is there a difference between the two outputs?? I want to be sure that my code
:>isn't now laced with bugs.
Admirable goal. Keep learning. The odds improve.
"perldoc perlop" will be helpful.
--
// Lee.Lindley /// Programmer shortage? What programmer shortage?
// @bigfoot.com /// Only *cheap* programmers are in short supply.
//////////////////// 50 cent beers are in short supply too.
------------------------------
Date: 2 Aug 1999 19:17:37 GMT
From: Jeff Stampes <stampes@xilinx.com>
Subject: Re: Question dealing with inlined my
Message-Id: <7o4qsh$p7t2@courier.xilinx.com>
Jete Software Inc. <jete@dgs.dgsys.com> wrote:
: Using the following code:
: my($stat)
: $stat = `ps -ef | grep search`;
: While this code using an inlined my:
: my($stat) = `ps -ef | grep search`;
: Why is there a difference between the two outputs??
Because you've asked it for different things.
In the first example, you're calling the output from the system call
in a scalar context. In the second, you're calling it in a list
context. A world of difference.
--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com
------------------------------
Date: 02 Aug 1999 20:05:13 GMT
From: jimtaylor5@aol.com (Jimtaylor5)
Subject: Search
Message-Id: <19990802160513.18169.00004192@ng-fn1.aol.com>
foreach $searchword (@the_list) {
if ($searchline =~ /\b$searchword/i) {
$matchit = 1;
}
Problem is, if I search "book" this matches bookcase,
bookends, Booker T. Washington, etc. Or if I search "Cook Book"
it doesn't pick up book. How would I make this example match
for cook book and for simply book?
------------------------------
Date: Mon, 02 Aug 1999 19:19:22 GMT
From: Joan Richards <richj@home.com>
Subject: Stopping output
Message-Id: <37A57F3A.434ADCF7@home.com>
In my script I have a routine called "show". Here's that routine:
sub show
{
print shift;
}
In my script, I may have many "show" statements in consecutive order.
so, let's say I have ten consecutive "show" statements in my script.
How can I force my script to only "show" 5 until the user hits "n" (next
or whatever) and then show the other five etc. etc. etc.
I guess this is like a "more" command, but it will always be turned on
or off.
Thanks,
-J
------------------------------
Date: Mon, 02 Aug 1999 18:58:45 GMT
From: jschueler@tqis.com
Subject: using __PACKAGE__
Message-Id: <7o4pov$1qv$1@nnrp1.deja.com>
The string string __PACKAGE__ failed for the www.perl.com documentation.
And when I searched USENET, I get many false results due to poster's
sigs. There's some quote, maybe biblical, about teaching a man to
fish... Can anyone advise where I ought to have looked for this answer?
Here's a short script:
#! /usr/bin/perl
use strict ;
package foobar ;
use vars qw( $hello ) ;
$hello = 'world' ;
print $__PACKAGE__::hello, "\n" ;
I would prefer that this script print "world" instead of a blank line.
Is there some idiom I need to use?
Thanks,
Jim Schueler
Total Quality InfoSystems
http://www.tqis.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 2 Aug 1999 13:18:57 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: using __PACKAGE__
Message-Id: <37a5ef21@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
jschueler@tqis.com writes:
:The string string __PACKAGE__ failed for the www.perl.com documentation.
:And when I searched USENET, I get many false results due to poster's
:sigs. There's some quote, maybe biblical, about teaching a man to
:fish... Can anyone advise where I ought to have looked for this answer?
% cd /usr/src/perl5.005_59/pod/
% grep __PACKAGE__ *.pod
perl5004delta.pod:=item __PACKAGE__
perl5004delta.pod:C<__FILE__> and C<__LINE__>, C<__PACKAGE__> does I<not> interpolate
perldata.pod:The special literals __FILE__, __LINE__, and __PACKAGE__
perldata.pod:(due to an empty C<package;> directive), __PACKAGE__ is the undefined value.
perlfaq7.pod: my $packname = __PACKAGE__;
perlmod.pod:The special symbol C<__PACKAGE__> contains the current package, but cannot
perlmod.pod: print "in ", __PACKAGE__, ": \$name is '$name'\n";
perlobj.pod: $self->{ __PACKAGE__ . ".count"}++;
perltootc.pod: __PACKAGE__ -> {CData2} = shift if @_;
perltootc.pod: return __PACKAGE__ -> {CData2};
perltootc.pod:In the second accessor method, the __PACKAGE__ notation was used for
perltootc.pod:always put the __PACKAGE__ in a variable first.
perltootc.pod: my $class = __PACKAGE__;
perltootc.pod: my $obclass = shift || __PACKAGE__;
perltootc.pod: __PACKAGE__ -> bigbang();
perltootc.pod: for my $datum (keys %{ +__PACKAGE__ }) {
perltootc.pod:should probably be C<$self-E<gt>{ __PACKAGE__ . "_ObData1" }>, but that
--
I'll say it again for the logic impaired. --Larry Wall
------------------------------
Date: Mon, 02 Aug 1999 13:42:45 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: why are you so harsh to this guy ?
Message-Id: <37A602C5.269B2AE8@mail.cor.epa.gov>
Jeff Kerrigan wrote:
>
> Get a life. If you were half as great as you thought you were, Tad, you wouldn't have time
> to give 25,000 word responses to every "newbie" who writes to this NG.
Pretty sad, when Jeff doesn't know:
[1] Usenet posting guidelines;
[2] Usenet quoting guidelines;
[3] a cut-and-paste from deja.com when he sees it;
[4] the difference between Tad McLellan and Ryan Ngi;
[5] how to count to 25,000.
I'm suddenly reminded of the guy who [a few months ago] blasted
TomC's succinct response, rudely asking "Who do you think you
are, some sort of Perl God who spends all his time producing
Perl programs to give away for free?" .. and [as I found out
through private e-mail] then looked down at his desk at his
copies of the Camel and the Ram, and realized whom he had just
flamed. In Usenet, no one can hear you scream "Oops!"
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Mon, 2 Aug 1999 12:37:11 -0700
From: "Willy Paine" <willyp@mossbay.com>
Subject: Win32 Perl won't display HTML
Message-Id: <rqbspbmmg3mcq6@corp.supernews.com>
I have tried two NT machines: one is NT 4.0 service pack 3 with IIS 4.0
(Option Pack) and Windows 2000 beta 3. I installed both machines with
ActivePerl version build 518.
I have tried several procedure on setting up environment included
http://support.microsoft.com/support/kb/articles/Q150/6/29.asp but this is
probably out of date.
Well, it works fine with command level but it won't display HTML output on
web browser.
I feel very frustrated with Win32 Perl. Can you help me how to make HTML
display from running perl.
Thanks,
willy
------------------------------
Date: Mon, 02 Aug 1999 22:36:01 +0200
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: Win32::OLE or something else ???
Message-Id: <37a8fcb1.4181923@news3.ibm.net>
[mailed & posted]
Willibald Woerlinger <w-woerlinger@ti.com> wrote:
>I'm writing a program that allows me to let's say 'remote control'
>a web browser (I used InternetExplorer 50) with a macro-editor
>created procedure.
>
>To be able to continue accessing the browser, I need to know when
>the browser has finished loading the current page or applet.
>But so far I haven't found any way of how to get this information
>automatically:
>
>I tried
> a) Win32::OLE, but this only gives back ProgramName,program-path,
> window-size, window-position,...
>
> But it doesn't return infos on LocationURL,LocationName,Busy, ..
Please take a look at my article in http://www.PerlMonth.com
It show example of remote-controling Internet Exploder using Win32::OLE.
You should be able to access all methods and properties of the IE object.
Send me sample code if it doesn't work for you.
-Jan
------------------------------
Date: Mon, 02 Aug 1999 20:40:38 GMT
From: "Scott Sanbeg" <ssanbeg@home.com>
Subject: Working Telnet Script Needed
Message-Id: <annp3.25264$dP4.5302@news.rdc1.wa.home.com>
Hello All,
Does anyone have a pointer, or code, for the following? What I need is any
*working* Perl script that simply works from a NT command prompt, logs into
a variety of UNIX servers (one at a time or multiple boxes), issues commands
(e.g. 'uname -a'), captures that data to a local disk, and logs off.
Thanks,
Scott
----
Scott Sanbeg, UNIX/Networking SA/Developer/Engineer
Email: ssanbeg@home.com
Home Office: 206.764.9935
------------------------------
Date: Mon, 02 Aug 1999 14:15:45 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: working with = sign in a directory name - please help!
Message-Id: <37A5EE61.6082E2AE@texas.net>
Timothy J Flynn wrote:
>
> $filein="somefilename";
> ok, so my previous attempts were used with something like this..
>
> $filedest="/usr/local/something/=history/file";
> as well as...
> $filedest="/usr/local/something/\=history/file";
> and..
> $filedest="/usr/local/something/" . "=history" . "/file";
> and..
> $filedest="/usr/local/something/" . "=" . "history/file";
>
> etc... with a hopeful result of ..
>
> rename($filein, $filedest);
First, responses go *after* the quoted text.
Second,
-----
#!/usr/bin/perl -w
use strict;
my $filein="./somefilename";
my $filedest="./=history/file";
rename $filein,$filedest or die "Can't rename: $!";
-----
works just fine for me, assuming that the directory =history exists (I'd
use single quotes around the filenames, but I wanted to match *your*
test).
You are checking the success of the rename, right?
- Tom
------------------------------
Date: Mon, 02 Aug 1999 12:57:05 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: working with = sign in a directory name - please help!
Message-Id: <37A5F811.3BD6D8F3@mail.cor.epa.gov>
I R A Darth Aggie wrote:
>
> On Mon, 2 Aug 1999 08:01:38 -0500, Timothy J Flynn <tflynn@iastate.edu>, in
> <7o44rp$ji1$1@news.iastate.edu> wrote:
>
> + I have tried just about every way of escaping for this with little
> + success.
>
> Code snippet, please? just enough to demonstrate the problem you're
> having. Sorry, I don't have the 'use ESP;' module installed.
That's the PSI:ESP module. But I can tell that you knew
that already. Next time, don't let your boss distract you
while you're typing. :-)
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Mon, 2 Aug 1999 13:27:12 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: working with = sign in a directory name - please help!
Message-Id: <MPG.120f9efc58ef04c3989d9e@nntp.hpl.hp.com>
In article <37A5F811.3BD6D8F3@mail.cor.epa.gov> on Mon, 02 Aug 1999
12:57:05 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
...
> That's the PSI:ESP module. But I can tell that you knew
> that already. Next time, don't let your boss distract you
> while you're typing. :-)
PSI::ESP ???
Next time, don't let your boss distract you while you're typing. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 2 Aug 1999 20:40:58 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: working with = sign in a directory name - please help!
Message-Id: <slrn7qc0n0.r06.fl_aggie@thepentagon.com>
On Mon, 2 Aug 1999 13:27:12 -0700, Larry Rosler <lr@hpl.hp.com>, in
<MPG.120f9efc58ef04c3989d9e@nntp.hpl.hp.com> wrote:
+ In article <37A5F811.3BD6D8F3@mail.cor.epa.gov> on Mon, 02 Aug 1999
+ 12:57:05 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
+ ...
+ > That's the PSI:ESP module. But I can tell that you knew
+ > that already. Next time, don't let your boss distract you
+ > while you're typing. :-)
+
+ PSI::ESP ???
+
+ Next time, don't let your boss distract you while you're typing. :-)
*ow* D*mn Pointy-haired fool poking his pointy-hair in my eye...
James
------------------------------
Date: 2 Aug 1999 20:46:54 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: working with = sign in a directory name - please help!
Message-Id: <slrn7qc123.r06.fl_aggie@thepentagon.com>
On Mon, 2 Aug 1999 13:49:47 -0500, Timothy J Flynn <tflynn@iastate.edu>, in
<7o4p8d$jar$1@news.iastate.edu> wrote:
+ $filein="somefilename";
+ $filedest="/usr/local/something/=history/file";
+ $filedest="/usr/local/something/\=history/file";
+ $filedest="/usr/local/something/" . "=history" . "/file";
+ $filedest="/usr/local/something/" . "=" . "history/file";
What's with the "'s? you aren't perfoming any variable interpolation,
so ' and its allies are Good Enough.
$filein='dir1';
$filedest=q|=dir1|; # alternate quoting
rename $filein,$filedest or warn "renaming: $!";
worked for me, once I'd created 'dir1'. When it didn't, I got:
renaming: No such file or directory at - line 3.
Fancy that... ;)
James
------------------------------
Date: Mon, 2 Aug 1999 12:22:25 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Y2K in Washington (Was: Re: print "Location: http://..." avec =?iso-8859-1?Q?param=E8tres=29?=
Message-Id: <MPG.120f8fcde6824b01989d9b@nntp.hpl.hp.com>
In article <slrn7qbogt.q33.fl_aggie@thepentagon.com> on 2 Aug 1999
18:21:12 GMT, I R A Darth Aggie <fl_aggie@thepentagon.com> says...
> On Mon, 2 Aug 1999 08:17:49 -0700, Larry Rosler <lr@hpl.hp.com>, in
> <MPG.120f5669fab8d567989d95@nntp.hpl.hp.com> wrote:
>
> + Quoted in this morning's San Francisco Chronicle:
>
> + The Washington Post quotes Senate Banking Committee Chairman Phil Gramm,
> + R-Texas, at a hearing last week: "Well, it seems to me we ought to be
> + encouraged that in the year 1000, they had to add a new digit, and yet
> + no evidence of economic disruption. And then a millennium before, we
> + had dates going down, and then they started going up, and yet no evidnce
> + of disruption of chaos in the economy. So if they could do it then,
> + surely we can deal with it now, it seems to me."
>
> Dumn aggee.
>
> James - Phil, not Larry...
http://www.senate.gov/~gramm/bio.html
PHIL GRAMM, of College Station, Texas, is 56 years old. He holds a Ph.D.
in economics, the subject he taught at Texas A&M University for 12
years. He has published numerous articles and books on subjects ranging
from monetary theory and policy to private property to the economics of
mineral extraction, and currently serves as chairman of the Senate
Banking Committee.
...
He doesn't realize that DCCCCLXXXXVIIII + I = M doesn't add a new digit
(even if one uses all of the contractions, such as CMXCIX); that there
is evidence of significant economic disruption because of millennial
apocalyptic prognostications; and that the Romans would have had
considerable difficulty in counting down to a future date. I didn't
check on where his degrees were bought, but TAMU doesn't seem to have
high standards for its professors, does it?
ObPerl: I was too lazy to load the http://www.perl.com/CPAN/modules/by-
module/Roman module referred to in the FAQ, to see how it deals with
these notation conveniences. I don't know when they were introduced,
either.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 02 Aug 1999 13:57:56 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Y2K in Washington (Was: Re: print "Location: http://..." avec paramètres)
Message-Id: <37A5EA34.3D837226@texas.net>
Larry Rosler wrote:
>
> The Washington Post quotes Senate Banking Committee Chairman Phil Gramm,
> R-Texas, at a hearing last week: "Well, it seems to me we ought to be
> encouraged that in the year 1000, they had to add a new digit, and yet
> no evidence of economic disruption. And then a millennium before, we
> had dates going down, and then they started going up, and yet no evidnce
> of disruption of chaos in the economy. So if they could do it then,
> surely we can deal with it now, it seems to me."
No one can write a better Aggie joke than good ol' Phil.
- Tom (A Texan who *absolutely did not* vote for Phil)
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 338
*************************************