[17278] in Perl-Users-Digest
Perl-Users Digest, Issue: 4700 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 23 18:05:56 2000
Date: Mon, 23 Oct 2000 15:05:24 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <972338724-v9-i4700@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 23 Oct 2000 Volume: 9 Number: 4700
Today's topics:
Re: Alphanumeric sorting of hashes <ra_jones@my-deja.com>
Re: Beyond useless <gellyfish@gellyfish.com>
Can someone help s_punk@my-deja.com
Re: Can someone help <jihad.battikha@sharewire.com>
Re: Can someone help s_punk@my-deja.com
Re: challenging problem <jihad.battikha@sharewire.com>
detecting client disconnect kenny@barmeister.com
Re: Don't use -w in CGI? <flavell@mail.cern.ch>
Re: Don't use -w in CGI? (Craig Berry)
Re: Don't use -w in CGI? <jgoldst@my-deja.com>
Re: Don't use -w in CGI? <gellyfish@gellyfish.com>
Re: Dynamic Regex building? <abe@ztreet.demon.nl>
File test -d does not work under Win98 ? <avw@quickonline.nl>
Re: God, this is like hard work... <gellyfish@gellyfish.com>
Re: Help with array concatenation <russ_jones@rac.ray.com>
Re: help with system () - a new twist (redirecting stdo <ren.maddox@tivoli.com>
Here-is excute command <van.Ginhoven@Telia.com>
Re: hoe to alter @INC? <jihad.battikha@sharewire.com>
how do I run <cool@pullen81.demon.co.uk>
Re: how do I run (Tad McClellan)
how to get process id <ddijk@hetnet.nl>
Re: how to get process id <dsimonis@fiderus.com>
Re: how to get process id <bcaligari@my-deja.com>
Re: how to get process id (Craig Berry)
Re: Keyboard Hook? <jihad.battikha@sharewire.com>
Re: Keyboard Hook? <jeff@vpservices.com>
Re: Keyboard Hook? <jihad.battikha@sharewire.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 23 Oct 2000 19:02:01 GMT
From: ra jones <ra_jones@my-deja.com>
Subject: Re: Alphanumeric sorting of hashes
Message-Id: <8t21v3$em6$1@nnrp1.deja.com>
Tad,
Thanks, that did it. In fact the hash is generated automatically from a
much larger script - I just took a 'snapshot' of it by making it write
to a file so I could extract it for use in this article. I don't think
the size of the array is going to be an issue, but I will bear it in
mind.
And thanks to the others who replied.
In article <slrn8v8kpd.3ur.tadmc@magna.metronet.com>,
tadmc@metronet.com (Tad McClellan) wrote:
> On Mon, 23 Oct 2000 12:43:44 GMT, ra jones <ra_jones@my-deja.com>
wrote:
> >The scenario:
> >
> >A hash consisting of pairs of entries (standard stuff) as follows:
> >
> >%hash = (
> >'CD3','0',
> >'CD25','33',
> >'CD8','21',
> >'CD66','1'
> >);
>
> You seem to have an unhealthy affinity for punctuation characters...
>
> >I need to sort it by alphanumeric rather than ASCII order (ie CD3,
CD8,
>
> No you don't.
>
> You need to sort it numerically, ignoring the first 2 characters.
>
> >Have I made a fundamental mistake here? Using Perl 5.005.
>
> Yes.
>
> You want to sort based on _part_ of the $a/$b values, but you
> don't do anything to ignore the part that you want to ignore,
> so it is not being ignored.
>
> ------------------------
> #!/usr/bin/perl -w
> use strict;
>
> my %hash = (
> CD3 => 0,
> CD25 => 33,
> CD8 => 21,
> CD66 => 1
> );
>
> print "Key: $_; value: $hash{$_}\n"
> foreach (sort { substr($a, 2) <=> substr($b, 2) } keys %hash);
> ------------------------
>
> An ST would be better if %hash gets beyond a "trivial" size...
>
> --
> Tad McClellan SGML consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
>
--
ra jones (posted via deja.com)
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 23 Oct 2000 19:28:35 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Beyond useless
Message-Id: <8t200j$5ac$1@orpheus.gellyfish.com>
On 19 Oct 2000 01:04:22 GMT Mark Badolato wrote:
> Reviewing some code on Hotscripts for a script that has good reviews,
> and seems popular, I find this jem in the source code. I think this
> may take the cake in terms of all time useless...
>
> sub wknd {
> my $died = shift;
> my $used = shift;
> if ($died) {
> return;
> }
> else {
> return;
> }
> return;
> }
>
>
> Just thought I would share a laugh.
>
This would probably only rate ~~ in the CiP[1] rating scheme. Although
I would have to confess to plenty of similar code where I have devised
some module with various methods some of which only ever get partially
implemented (as above :). Anyhow I'll forward it to the CiP rating
panel[2] to see what they think
[1] Crack Influenced Perl, devised by a usually well respected member
of London.pm .
[2] The London.pm mailing-list.
/J\
--
Jonathan Stowe |
<http://www.gellyfish.com> | This space for rent
|
------------------------------
Date: Mon, 23 Oct 2000 20:21:19 GMT
From: s_punk@my-deja.com
Subject: Can someone help
Message-Id: <8t26jl$j5e$1@nnrp1.deja.com>
Im new to perl and I am trying to parse a particular web site. If I
just print one of the lines it will work. As soon as try to add the
other lines it will not compile right. Is there something Im not
seeing?
#!/app/eol/perl/bin/perl
# This is designed to download the status of the differ weblogic servers
use LWP::UserAgent;
use File::Copy;
$ua = LWP::UserAgent->new;
$req = HTTP::Request->new(GET => 'http://somewebsite');
$nrt = $ua->request($req)->as_string;
$nrt =~ /version<\/*./;
($ver, $launched, $uptime) =
($nrt =~ m@version<.*>(\d[^<]*) # version
.*Launched<.*>([^<]*) # Launched
.*Uptime<.*>(\d[^<]*) # uptime
@x);
print "$ver, $launched, $uptime\n";
#if I print one of the $ above it works, add another and it won't print.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 23 Oct 2000 16:45:35 -0400
From: Jihad Battikha <jihad.battikha@sharewire.com>
Subject: Re: Can someone help
Message-Id: <39F4A36F.C9FD7DBC@sharewire.com>
s_punk@my-deja.com wrote:
> use LWP::UserAgent;
> use File::Copy;
>
> $ua = LWP::UserAgent->new;
> $req = HTTP::Request->new(GET => 'http://somewebsite');
>
> $nrt = $ua->request($req)->as_string;
>
> $nrt =~ /version<\/*./;
>
> ($ver, $launched, $uptime) =
> ($nrt =~ m@version<.*>(\d[^<]*) # version
> .*Launched<.*>([^<]*) # Launched
> .*Uptime<.*>(\d[^<]*) # uptime
> @x);
> print "$ver, $launched, $uptime\n";
> #if I print one of the $ above it works, add another and it won't print.
What do you mean "won't print?" Do you get an error or does nothing
print? Are you running this script as a CGI? If so, you should be
printing a proper content header before the rest of the data. Are you
sure your regexp is working? What does your original (expected) data
look like?
--
Jihad Battikha <jihad.battikha@sharewire.com>
Sharewire, Inc. --- http://www.sharewire.com/
- Free forms, programs, and content for web sites.
- No assembly required.
Disclaimer:
Before sending me commercial e-mail, the sender must first agree
to my LEGAL NOTICE located at: http://www.highsynth.com/sig.html
------------------------------
Date: Mon, 23 Oct 2000 21:31:58 GMT
From: s_punk@my-deja.com
Subject: Re: Can someone help
Message-Id: <8t2aof$mtm$1@nnrp1.deja.com>
I am basically trying to take a portion of a html source code and parse
bits of information fronm that. What I mean by it will not print is
when I print to the screen the return result is
,,Uptime I can not figure out what I am missing. Below is the code
I am trying to parse.
version</FONT></B></TD><TD ALIGN=left><FONT FACE="Helvetica">4.5.1
10/04/1999 13:37:30 #53733 - 128 bit domestic version</FONT></TD></TR>
<TR><TD VALIGN=top><B><FONT
FACE="Helvetica">Launched</FONT></B></TD><TD ALIGN=left><FONT
FACE="Helvetica">Fri Oct 13 18:45:09 CDT 2000</FONT></TD></TR>
<TR><TD VALIGN=top><B><FONT FACE="Helvetica">Uptime</FONT></B></TD><TD
ALIGN=left><FONT FACE="Helvetica">9d 21:44:34</FONT></TD></TR>
In article <39F4A36F.C9FD7DBC@sharewire.com>,
jihad.battikha@sharewire.com wrote:
> s_punk@my-deja.com wrote:
>
> > use LWP::UserAgent;
> > use File::Copy;
> >
> > $ua = LWP::UserAgent->new;
> > $req = HTTP::Request->new(GET => 'http://somewebsite');
> >
> > $nrt = $ua->request($req)->as_string;
> >
> > $nrt =~ /version<\/*./;
> >
> > ($ver, $launched, $uptime) =
> > ($nrt =~ m@version<.*>(\d[^<]*) # version
> > .*Launched<.*>([^<]*) # Launched
> > .*Uptime<.*>(\d[^<]*) # uptime
> > @x);
> > print "$ver, $launched, $uptime\n";
> > #if I print one of the $ above it works, add another and it won't
print.
>
> What do you mean "won't print?" Do you get an error or does nothing
> print? Are you running this script as a CGI? If so, you should be
> printing a proper content header before the rest of the data. Are you
> sure your regexp is working? What does your original (expected) data
> look like?
>
> --
> Jihad Battikha <jihad.battikha@sharewire.com>
> Sharewire, Inc. --- http://www.sharewire.com/
> - Free forms, programs, and content for web sites.
> - No assembly required.
>
> Disclaimer:
> Before sending me commercial e-mail, the sender must first agree
> to my LEGAL NOTICE located at: http://www.highsynth.com/sig.html
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 23 Oct 2000 16:28:29 -0400
From: Jihad Battikha <jihad.battikha@sharewire.com>
Subject: Re: challenging problem
Message-Id: <39F49F6D.8AD1B8A8@sharewire.com>
paceman97@aol.com wrote:
> I'm using LWP to connect to a link that looks like this
> ....script.pl?linkid=5
> and it connects me to some url that is specified in that script
> but how can i find out which url i connected to.
I't redirecting you to another URL. If what you mean to say is:
"How can I figure out the URL which I'm being redirected to without
fetching the whole page?"
Then your answer will be reading the docs for LWP, specifically the
is_redirect() function which checks the return value of a request
object. Doing this, however, still requires your program to fetch
*something* from the remote server. Keep in mind, though, that if the
remote CGI which is returning the redirect is set up to randomize the
URL, there is no way for you to make 2 separate requests and expect the
same URL to get returned. You have to figure out what to do the
resulting URL within a single, self-contained request.
If you want a better answer, you'll need to describe exactly what you're
trying to do. However, I don;t think your question is really related to
Perl and a more appropriate newsgroup would be:
comp.infosystems.www.authoring.cgi
--
Jihad Battikha <jihad.battikha@sharewire.com>
Sharewire, Inc. --- http://www.sharewire.com/
- Free forms, programs, and content for web sites.
- No assembly required.
Disclaimer:
Before sending me commercial e-mail, the sender must first agree
to my LEGAL NOTICE located at: http://www.highsynth.com/sig.html
------------------------------
Date: Mon, 23 Oct 2000 20:46:08 GMT
From: kenny@barmeister.com
Subject: detecting client disconnect
Message-Id: <8t282e$kjg$1@nnrp1.deja.com>
I was wondering if there was a way to detect whether a client had lost
their connection while executing a cgi request to a perl script. I am
printing a download to STDOUT and when that is done I set a flag that
says the download completed successfully. The problem is that some
users are losing their Internet connection during this process but the
script continues to run and updates the flag to say that they
successfully got the file. Anyway any help with this problem would be
greatly appreciated. Thanks........
-Kenny
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 23 Oct 2000 19:58:29 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Don't use -w in CGI?
Message-Id: <Pine.GHP.4.21.0010231953140.3095-100000@hpplus03.cern.ch>
On Mon, 23 Oct 2000, JL Goldstein wrote:
> I seem to remember reading somewhere that, once one's Perl CGI script is
> debugged, the script should not be on the Web server with the -w switch.
I seem to recall this was thrashed out on the more-relevant CGI group
less than a fortnight ago.
> Thoughts?
...that usenet is increasingly becoming a write-only medium, in spite
of the availability of better research tools.
> Suggestions?
~s How to start your Perl CGI script
would be one targetted search term at www.deja.com/usenet
------------------------------
Date: Mon, 23 Oct 2000 18:37:40 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Don't use -w in CGI?
Message-Id: <sv91bk1g6mgl61@corp.supernews.com>
JL Goldstein (jgoldst@my-deja.com) wrote:
: I seem to remember reading somewhere that, once one's Perl CGI script is
: debugged, the script should not be on the Web server with the -w switch.
: The reasoning, as I recall, was that error messages printed to the
: browser window could give the user system information that could
: facilitate hacking.
:
: Thoughts? Suggestions?
Any script which is intended to resist hacking should be strict, -w, and
-T clean as a matter of course. Running it with -w enabled or not should
make no difference in its output.
However, for that added measure of security, just use CGI::Carp to
redirect error and warning messages into the server log. That way the
data will still be there to help you spot problems. Oh, and enabling
fatalsToBrowser during development is the best thing since sliced bread.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Quidquid latine dictum sit, altum viditur."
|
------------------------------
Date: Mon, 23 Oct 2000 19:13:36 GMT
From: JL Goldstein <jgoldst@my-deja.com>
Subject: Re: Don't use -w in CGI?
Message-Id: <8t22ko$f9h$1@nnrp1.deja.com>
In article <sv91bk1g6mgl61@corp.supernews.com>,
cberry@cinenet.net (Craig Berry) wrote:
> Any script which is intended to resist hacking should be strict, -w,
and
> -T clean as a matter of course. Running it with -w enabled or not
should
> make no difference in its output.
Yes, I've been using -T, and I always use -w in development (not to
mention 'use strict', which has saved me from many a boneheaded error).
> However, for that added measure of security, just use CGI::Carp to
> redirect error and warning messages into the server log. That way the
> data will still be there to help you spot problems. Oh, and enabling
> fatalsToBrowser during development is the best thing since sliced
bread.
So I'm learning. Thank you for your flame-free, helpful reply.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 23 Oct 2000 21:40:30 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Don't use -w in CGI?
Message-Id: <8t27nu$6d9$1@orpheus.gellyfish.com>
On Mon, 23 Oct 2000 16:52:18 GMT JL Goldstein wrote:
> I seem to remember reading somewhere that, once one's Perl CGI script is
> debugged, the script should not be on the Web server with the -w switch.
> The reasoning, as I recall, was that error messages printed to the
> browser window could give the user system information that could
> facilitate hacking.
>
Unless you have deliberately caused it be otherwise the warnings that might
be occasioned by the use of the -w switch will go to STDERR and unless
you have tinkered with your webserver then STDERR will be redirected to the
server error log if one exists.
In an ideal world all programs should run without warning with the -w
switch however it does provide a useful indication when you might be dealing
with dodgy data.
There is no security issue surrounding the use of the '-w' switch - it would
be usefull if you could remember where you had read this piecce of
misinformation so an adequate rebuttal could be made.
/J\
--
Jonathan Stowe |
<http://www.gellyfish.com> | This space for rent
|
------------------------------
Date: Mon, 23 Oct 2000 22:30:35 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Dynamic Regex building?
Message-Id: <uq59vs43sdgh3fpoop8a32modjigcciou5@4ax.com>
On 20 Oct 2000 22:23:40 GMT, Michael Hoffman <mrh@panix.com> wrote:
>
> Hi,
> I'm a longtime programmer, but brand-new to Perl, so any pointers
> to relevant info would be appreciated. I've scoured the docs and this
> newsgroup, but couldn;t find an answer.
>
> PROBLEM SYNOPSIS: I need to build a Replace regex based on given criteria.
You think you do. That is your solution for the problem you have at
hand. No need for s/// in this case. If it's a database table, treat it
as such.
...
> --------------------------------------------------------------
>
> Lets say I want to add 3 new fields between the 2nd and 3rd field.
> $orig = ^([^\|]*)\|([^\|]*)\|([^\|]*)\|$
> $repl = $1|$2||||$3|
>
> Given Data like: Hi|Hello|Howdy|
> I am returned: $1|$2||||$3|
I suppose you actually want
Hi|Hello|||Howdy|
returned for that line?
OK, try this another way. The only assumption I make is that field names
are unique in a single layout.
@oldst is a list of field names from the old layout.
@newst is a list of field names from the new layout.
You have managed to get those two, so no problems there, I just fixed
them for your example.
I read the data from the special DATA handle and write them to STDOUT,
since you manage to read from and write to the data files there's no
problem there either.
I use a hash (%data) and hash slices to rearrange the fields from the
old to the new layout.
See:
perldoc perldata
section "Slices" for more information on them.
#!/usr/bin/perl -w
use strict;
my @oldst = qw(fld1 fld2 fld3); # (old) schema file
my @newst = qw(fld1 fld2 fld4 fld5 fld3); # (new) table layout
while ( <DATA> ) {
chomp;
my %data;
@data{ @oldst } = split /\|/;
my $nwline = join '|', map { defined $_?$_:'' } @data{ @newst };
print "$nwline|\n";
}
__DATA__
Hi|Hello|Howdy|
1|2|3|
4|5|6|
--
Good luck,
Abe
##
perl -Mstrict -wle 'sub Just{&$_}sub another{&$_}sub Perl{&$_}sub hacker{&$_}$_=sub{(split /::/,(caller $^W)[3])[-$^W].$"};print@{[Just,another,Perl,hacker]}'
------------------------------
Date: Mon, 23 Oct 2000 21:37:28 +0200
From: "arie van wingerden" <avw@quickonline.nl>
Subject: File test -d does not work under Win98 ?
Message-Id: <8t23sn$pgj$1@porthos.nl.uu.net>
Hi,
I'm using'the O'Reilly Perl Resource Kit for Windows, installed under Win98
(first edtion).
If I am using the following code:
opendir(DIR, $dir) or die $!;
@dirs = grep(-d, readdir(DIR));
closedir(DIR) or die $!;
where $dir is a correct full directory path, which contains several subdirs.
If I print @dirs only the . and .. directories show up - the others are
ignored.
Does someone recognize this?
Thanx so far
Arie van Wingerden
------------------------------
Date: 23 Oct 2000 20:08:02 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: God, this is like hard work...
Message-Id: <8t22ai$5eq$1@orpheus.gellyfish.com>
On Fri, 20 Oct 2000 09:13:30 +0100 The Moriman wrote:
> Why did they make Perl so difficult to learn?
They didnt.
Next.
/J\
--
Jonathan Stowe |
<http://www.gellyfish.com> | This space for rent
|
------------------------------
Date: Mon, 23 Oct 2000 15:21:18 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: Help with array concatenation
Message-Id: <39F49DBE.40585D71@rac.ray.com>
Jody Fedor wrote:
>
> This I know, once again, I'll be dead in 2100 so I won't have to worry
> about it!
>
Since I was the original guy that decided to store the "year" portion
of a date in only two bytes, I can tell you from experience that this
attitude just ain't right and it will bite you (or your heirs and
assigns) in the ass some day.
Buddhists would warn that something like this could seriously hose
your karma and your next turn of the wheel will involve your coming
back as the towel boy for Leavenworth Federal Penitentiary Greco-Roman
wrestling team. Or, as a wise old Jesuit once told me, "You'll smoke a
turd in hell for that one, sonny boy!"
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Quae narravi, nullo modo negabo. - Catullus
------------------------------
Date: 23 Oct 2000 12:52:38 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: help with system () - a new twist (redirecting stdout)
Message-Id: <m3lmvf8mxl.fsf@dhcp11-177.support.tivoli.com>
Paul Price <paul_price@hp.com> writes:
> What I'd like to do is run a program, with a path that has embedded spaces,
> passing in some filename (with spaces) AND pipe stdout to a file. To add to
> the example our test example:
>
> Here is the command line I want to run:
> "d:\\my folder\\myprogram.exe" "d:\\some folder\\input file" > "d:\\my
> folder\\myprogram.out"
>
> @args=("d:\\my folder\\myprogram.exe","d:\\some folder\\input file",">
> d:\\my folder\\myprogram.out");
> system(@args);
This doesn't work because you cannot do file redirection when calling
system with more than one argument. File redirection is handled by
the shell, and calling system with multiple arguments bypasses the
shell.
> Before the advent of embedded spaces (don't get me started on this one), I
> could just do:
>
> system("d:/folder/program.exe input.file > d:/folder/program.out");
Note that you could also do:
system 'd:/folder/program.exe input.file > d:/folder/program.out';
since you aren't interpolating any Perl variables. Which leads
naturally to the kernel of a solution:
system '"d:\\my folder\\myprogram.exe" "d:\\some folder\\input file"
> "d:\\my folder\\myprogram.out"';
Of course, you probably do need to interpolate some Perl variables, in
which case the single-quote solution isn't enough. Still, it points
you in the right direction which is simply that you need to have those
double-quotes passed to the shell.
Luckily, it is really easy to fix. Simply change the single-quotes to
qq()...
system qq("d:\\my folder\\myprogram.exe" "d:\\some folder\\input file"
> "d:\\my folder\\myprogram.out");
An alternate solution is to do the file redirection internally in
Perl, and then there is no need to use the single argument form of
system. Then, your @args version will probably work just fine --
after removing the last (redirection) argument, of course.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Mon, 23 Oct 2000 20:37:52 GMT
From: "danfan" <van.Ginhoven@Telia.com>
Subject: Here-is excute command
Message-Id: <Ak1J5.2085$jv2.287246@newsc.telia.net>
Hi!
I want to use shell here-is syntax in a Perl-script,
to access an application from the CLI where the application
prompts for userid and password
In a shell script I would write:
#!/bin/ksh
mq001 -v <<EOCMD
myuserid
mypassword
get job_status
get schema_status
end
EOCMD
exit 0;
I have tried several varietis of
(@response)=print mq001 -v<<`EOCMD`;
myuserid
mypassword
get job_status
get schema_status
end
EOCMD
1. Only the first lines works ( no login)
2. Secondly how do I get hold of the output
This works:
(@response)=print ksh -x <<`EOCMD`;
mq001 -v <<EOC
myuserid
mypassword
get job_status
get schema_status
end
EOC
EOCMD
but I still canīt grab the output of the command
I could of course solve this by creating a temporary shell-script,
but Iīm stubborn and if documentation says I can use:
print <<`EOC`; # execute commands
echo hi there
echo lo there
EOC
I want it to work!
/dg
------------------------------
Date: Mon, 23 Oct 2000 16:17:10 -0400
From: Jihad Battikha <jihad.battikha@sharewire.com>
Subject: Re: hoe to alter @INC?
Message-Id: <39F49CC6.BF610E74@sharewire.com>
Jim Mauldin wrote:
> > That is not true, IIRC, you can unshift the directory onto @INC
> > in a BEGIN {} block to achieve the same effect.
> >
> Your statement is probably better written as "true unless you
> unshift the directory into a BEGIN block". But use lib has other
> advantages as well, including simplicity.
Changing the @INC array directly within a BEGIN block, however, does
offer some advantages not available with a straight "use lib" statement.
For example, one could dynamically manipulate library paths based on the
environmant at execution time.
--
Jihad Battikha <jihad.battikha@sharewire.com>
Sharewire, Inc. --- http://www.sharewire.com/
- Free forms, programs, and content for web sites.
- No assembly required.
Disclaimer:
Before sending me commercial e-mail, the sender must first agree
to my LEGAL NOTICE located at: http://www.highsynth.com/sig.html
------------------------------
Date: Mon, 23 Oct 2000 21:45:04 +0100
From: "Cool" <cool@pullen81.demon.co.uk>
Subject: how do I run
Message-Id: <972334093.992.3.nnrp-08.c1ed4c2f@news.demon.co.uk>
Hi
How can I Test a CGI & Perl script on my own PC ?
if there a way what do I need ?
and if any body knows wear I can get the program to do that be go too?
thanks
cool
------------------------------
Date: Mon, 23 Oct 2000 16:06:18 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: how do I run
Message-Id: <slrn8v96hq.57f.tadmc@magna.metronet.com>
On Mon, 23 Oct 2000 21:45:04 +0100, Cool <cool@pullen81.demon.co.uk> wrote:
> Subject: Re: how do I run
Put one foot in front of the other, similar to walking, only faster.
>How can I Test a CGI & Perl script on my own PC ?
Install and configure a web server.
Write and install a CGI program.
Make an HTML page containing a <form> that invokes your CGI program.
Click on "Submit".
>if there a way what do I need ?
Yes.
>and if any body knows wear I can get the program to do that be go too?
www.perl.com
www.apache.com
After you get perl installed, type:
perldoc -q CGI
Ask Perl questions here.
Ask CGI questions in a newsgroup that has some connection to CGI stuff,
such as:
comp.infosystems.www.authoring.cgi
Good luck!
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 23 Oct 2000 20:39:03 +0200
From: "dick dijk" <ddijk@hetnet.nl>
Subject: how to get process id
Message-Id: <Oze7#DSPAHA.346@net003s>
Does anyone know how you can get the process id of a perlscript (on Unix)
inside the script while executing. I can only find a "getppid" in the Camel.
I can only think of something like a "read" from a "ps", but there has to be
a better way (this won't work if you have the same script running in twice
parallel, because then you get 2 hits from the "ps".
Dick
------------------------------
Date: Mon, 23 Oct 2000 14:55:48 -0400
From: Drew Simonis <dsimonis@fiderus.com>
Subject: Re: how to get process id
Message-Id: <39F489B4.D649A732@fiderus.com>
dick dijk wrote:
>
> Does anyone know how you can get the process id of a perlscript (on Unix)
> inside the script while executing. I can only find a "getppid" in the Camel.
> I can only think of something like a "read" from a "ps", but there has to be
> a better way (this won't work if you have the same script running in twice
> parallel, because then you get 2 hits from the "ps".
>
> Dick
$$ ($PROCESS_ID or $PID with use English;) will contain the PID of the
process running the script.
------------------------------
Date: Mon, 23 Oct 2000 19:18:54 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
Subject: Re: how to get process id
Message-Id: <8t22ul$flr$1@nnrp1.deja.com>
In article <Oze7#DSPAHA.346@net003s>,
"dick dijk" <ddijk@hetnet.nl> wrote:
> Does anyone know how you can get the process id of a perlscript (on
Unix)
> inside the script while executing. I can only find a "getppid" in the
Camel.
> I can only think of something like a "read" from a "ps", but there
has to be
> a better way (this won't work if you have the same script running in
twice
> parallel, because then you get 2 hits from the "ps".
>
> Dick
>
There/s a global variable, $$
Brendon
+++
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 23 Oct 2000 20:19:45 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: how to get process id
Message-Id: <sv97b1jm0thla5@corp.supernews.com>
dick dijk (ddijk@hetnet.nl) wrote:
: Does anyone know how you can get the process id of a perlscript (on Unix)
: inside the script while executing. I can only find a "getppid" in the Camel.
: I can only think of something like a "read" from a "ps", but there has to be
: a better way (this won't work if you have the same script running in twice
: parallel, because then you get 2 hits from the "ps".
perldoc perlvar
See the '$$' variable.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Quidquid latine dictum sit, altum viditur."
|
------------------------------
Date: Mon, 23 Oct 2000 15:18:45 -0400
From: Jihad Battikha <jihad.battikha@sharewire.com>
Subject: Re: Keyboard Hook?
Message-Id: <39F48F15.CB5A515D@sharewire.com>
Gwyn Judd wrote:
> > Anyone know how to create a keyboard hook in Win32 with perl?...
>
> How about a non-perl solution:
>
> cat file_containing_commands.txt | perl my_script.pl
His question indicated he's on a Win32 platform. "cat" doesn't exist on
Win32.
--
Jihad Battikha <jihad.battikha@sharewire.com>
Sharewire, Inc. --- http://www.sharewire.com/
- Free forms, programs, and content for web sites.
- No assembly required.
Disclaimer:
Before sending me commercial e-mail, the sender must first agree
to my LEGAL NOTICE located at: http://www.highsynth.com/sig.html
------------------------------
Date: Mon, 23 Oct 2000 12:21:37 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Keyboard Hook?
Message-Id: <39F48FC1.AC3DD68F@vpservices.com>
Jihad Battikha wrote:
>
>
> His question indicated he's on a Win32 platform. "cat" doesn't exist on
> Win32.
You must mean "cat" doesn't come pre-installed on Win32. It certainly
exists for Win32 (see cygwin site) and works fine when called from a
script or the command line regardless if one is running in cygwin bash
or plain DOS.
--
Jeff
------------------------------
Date: Mon, 23 Oct 2000 16:37:43 -0400
From: Jihad Battikha <jihad.battikha@sharewire.com>
Subject: Re: Keyboard Hook?
Message-Id: <39F4A197.48B14B18@sharewire.com>
Jeff Zucker wrote:
> > His question indicated he's on a Win32 platform. "cat" doesn't
> > exist on Win32.
>
> You must mean "cat" doesn't come pre-installed on Win32. It certainly
> exists for Win32 (see cygwin site) and works fine when called from a
> script or the command line regardless if one is running in cygwin bash
I didn't say "cat" doesn't exist "for" Win32, only that it doesn't exist
on it by default. My point being that a lot of canned responses to
questions around here tend to assume Unix without taking into account
that Perl does run on other platforms which may or may not have certain
tools available by default. Most newbies aren't aware of the options
available from the cygwin archive.
--
Jihad Battikha <jihad.battikha@sharewire.com>
Sharewire, Inc. --- http://www.sharewire.com/
- Free forms, programs, and content for web sites.
- No assembly required.
Disclaimer:
Before sending me commercial e-mail, the sender must first agree
to my LEGAL NOTICE located at: http://www.highsynth.com/sig.html
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 4700
**************************************