[18743] in Perl-Users-Digest
Perl-Users Digest, Issue: 911 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 16 06:05:42 2001
Date: Wed, 16 May 2001 03:05:11 -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: <990007511-v10-i911@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 16 May 2001 Volume: 10 Number: 911
Today's topics:
Re: Bits and bytes (Dave Bailey)
Re: Can you build GUI's with perl? <time4tea@monmouth.com>
Re: EmbPerl Problem <randy@theory.uwinnipeg.ca>
Re: environment <ronald.fischer@deadspam.com>
Re: HELP: loading a hash of anon subs from file... (Bruno Boettcher)
HELP: modifying a referenced array from a library subro (Bruno Boettcher)
Re: HELP: modifying a referenced array from a library s (Anno Siegel)
Re: Http REFFERER -> IP ADDR <time4tea@monmouth.com>
Re: if ($x in @a) equivalent in perl? <aqumsieh@hyperchip.com>
Re: if ($x in @a) equivalent in perl? <joe+usenet@sunstarsys.com>
Re: Locking acces to files <karol@imm.org.pl>
Make 'HTTP_REFERER' capture search engine referer <nosabi@snospamabi.com>
Re: Make 'HTTP_REFERER' capture search engine referer <xris@dont.send.spam>
Re: Make 'HTTP_REFERER' capture search engine referer (Rafael Garcia-Suarez)
Measuring the time <karol@imm.org.pl>
Re: Measuring the time (Anno Siegel)
Re: Measuring the time nobull@mail.com
Re: Measuring the time <ack@ivu.de>
Re: Measuring the time <godzilla@stomp.stomp.tokyo>
Re: Pattern match headache (Bernard El-Hagin)
Perl Modules <yungp@netvigator.com>
Re: Please help with signals <rebelvideo@hotmail.com>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Steven Smolinski)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Bernard El-Hagin)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Bernard El-Hagin)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <godzilla@stomp.stomp.tokyo>
Re: South Florida Job (David H. Adler)
Re: static values in a subroutine (Logan Shaw)
Where can I find The Perl Journal? (James Kufrovich)
Re: XS and varargs agnes@talarian.com.nospam
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 May 2001 04:58:31 GMT
From: dave@sydney.daveb.net (Dave Bailey)
Subject: Re: Bits and bytes
Message-Id: <slrn9g3nvu.t72.dave@sydney.daveb.net>
On Tue, 15 May 2001 23:11:53 GMT, James Weisberg <chadbour@wwa.com> wrote:
>Below is a simple program which creates a 32bit vector for long integer
>storage:
>
>#! /usr/local/bin/perl -w
>
>my $vector= 0; vec($vector, 0, 32) = $ARGV[0];
>my $value = decode($vector);
>
>print "integer value is: $value\n";
>
>sub decode {
> my @s = reverse split //, unpack("B32", shift); # portable? fast?
> $" = ""; print "[$#s] bitstr: (@s)\n";
>
> my($i, $j, $v, $p);
> for( $i = $j = $v = 0, $p = 1; $j < $#s; $j++, $p <<= 1 ) {
> $v|= $p if($s[$i++]); # fiddle 2^p
> }
>
> return $v;
>}
You don't need this function. Replace it with vec($vector,0,32) in
your example.
>Also, a vector will be dozens of bytes wide, and will contain instructions
>on how subsequent values are coded. For instance, somewhere in the vector
>I might have an instruction to read the next 8 bits and turn them into
>an integer value. Another instruction might require reading the next
>16 bits for a value.
This sort of thing always works much easier if you settle on a fixed
element width and accept the (probably slight) size penalty. You can
mix and match if you want, but you have to interpret the bitstring in
terms of the *smallest* element size you intend to store in it. Suppose
that size is 8 bits. Then 16 and 32 bit values may be stored at offsets
in the string which are not multiples of 16 and 32 bits, respectively,
because of the existence of 8-bit elements. Thus, you will need to
write some code to handle storage and retrieval of 16 and 32 bit values
at offsets which are an arbitrary multiple of 8 bits. Depending on the
needs of your program, this may exact a performance penalty. In any
case, try something like below:
#!/usr/bin/perl -w
my $vector = '';
vec_store(\$vector,0,8,123);
vec_store(\$vector,8,16,12345);
vec_store(\$vector,24,32,1234567);
print vec_fetch($vector,0,8), "\n";
print vec_fetch($vector,8,16), "\n";
print vec_fetch($vector,24,32), "\n";
# $v is a *reference* to the bit vector.
# $o is the offset in *bits* (must be a multiple of 8).
# $b is the width in *bits* of the value being stored.
# $x is the number being stored.
sub vec_store {
my ($v,$o,$b,$x) = @_;
map{vec($$v,($o>>3)+$_,8)=($x>>($_<<3))}(0..($b>>3)-1);
}
# $v is the bit vector.
# $o is the offset in *bits* (must be a multiple of 8).
# $b is the width in *bits* of the value being fetched.
sub vec_fetch {
my ($v,$o,$b) = @_;
my $x;map{$x|=(vec($v,($o>>3)+$_,8))<<($_<<3)}(0..($b>>3)-1);$x;
}
__END__
--
Dave Bailey
davidb54@yahoo.com
------------------------------
Date: Tue, 15 May 2001 23:24:57 -0400
From: "James Richardson" <time4tea@monmouth.com>
Subject: Re: Can you build GUI's with perl?
Message-Id: <9dss2v$ehd$1@slb5.atl.mindspring.net>
"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:3nk1gtkhtqv0srjho7hrjoflllrtjkh46j@4ax.com...
> Tk. There even is a dedicated newsgroup for it:
Everybody seems to want to use Tk. I can also recommend Qt, which tied in
with Event, makes a superbly useful event driven GUI thingy possible.
Cheers
James
------------------------------
Date: Tue, 15 May 2001 20:19:04 -0500
From: "Randy Kobes" <randy@theory.uwinnipeg.ca>
Subject: Re: EmbPerl Problem
Message-Id: <9dsl10$8u6$1@canopus.cc.umanitoba.ca>
"Dave" <djm@spamfree.mcoe.k12.ca.us> wrote in
message news:HAcM6.144$Jk3.7113@typhoon.sonic.net...
> I went to the homesite of EmbPerl http://perl.apache.org/embperl/
> Trying to discover how I can put perl code into my HTML documents.
>
> After clicking on the link to "full documentation", the runtime modes MAKE
> NO MENTION OF HOW
> to run perl in HTML DOCUMENTS. (an html document is filename.html or
> filename.shtml)
> The listed "runtime" modes include the mod_perl mode, which gives an
example
> of how to run
> a given document as a CGI script.. WIth its own custom directory. Far be
it
> from me to be critical, but this is nothing more then a far fetched and
> alternative CGI method!
>
> You can put PHP in standard documents, you dont "run" these docuemnts,
> mod_php just reads each
> document and runs the php code it finds. This is what I want for Perl,
> except either the documentation of EmbPerl doesnt make this clear, or it
> just simply is impossible to do right now with EmbPerl.
A little further exploration would have brought you to
http://perl.apache.org/embperl/Examples.html.
Is this more along the lines of what you want?
> Is there anyone out there in the world who is already doing what I'm
trying
> to do with Perl? Are you able to have your .html files processed without
> renaming them to .epl and tossing them into their own custom directory?
You don't have to do both - you could do one or the other.
best regards,
randy kobes
------------------------------
Date: 16 May 2001 09:28:08 +0200
From: Ronald Fischer <ronald.fischer@deadspam.com>
Subject: Re: environment
Message-Id: <7qfbsotiwhj.fsf@demchh2msx.icn.siemens.de>
"Condor" <juju_y_jaja@deaqui.com> writes:
> We imagine that I have a cgi that is "view_cart" (it shows the cart of a
> client) and other one is "porceed_to_order" (it manages the processing of
> the order(request))
>
> And it happens to pass to me the IdClient of form coded to another cgi but,
> is there someone another form? Some variable of environment with which it
> could flirt(mapping) go to this variable and not have to pass(spend) it of a
> cgi to other one.
If I understand you right, you are looking for a way to pass information
from view_cart to proceed_to_order, and think about using environment
variables (i.e. setting the environment variable in view_cart and
reading it in proceed_to_order). Right?
This would be only possible if proceed_to_order would be executed in the
same process, or as a child process of view_cart, and as far I
understand your problem, this is not the case.
Of course you could use, for example, one of the DBM-modules to pass
data between the processes, but you need at least a key (such as a
transaction number) to retrieve the relevant data item, which can't be
passed that way.
Ronald
--
Do NOT reply to the address given in the From: header. If you want to
reply by mail, use the following address (after deleting the XXX):
Ronald Otto Valentin Fischer <rovfXXX@thekeyboard.com>
(Tired of getting spam after posting a message? http://www.deadspam.com)
------------------------------
Date: 16 May 2001 09:14:55 GMT
From: bboett@erm6.u-strasbg.fr (Bruno Boettcher)
Subject: Re: HELP: loading a hash of anon subs from file...
Message-Id: <9dtgef$q4b$1@news.u-strasbg.fr>
In article <u91ypstirb.fsf@wcl-l.bham.ac.uk>, <nobull@mail.com> wrote:
>bboett@erm6.u-strasbg.fr (Bruno Boettcher) writes:
>Why? Why not simply leave the file in original Perl syntax and just
>do() it?
heh :D because i never used 'do' that way since now :D
>Looks like you forgot to compile the subroutines. To convert the
>string 'sub { 1 }' into a coderef you must pass it through the eval()
>function.
i tryed to eval them, but i didn't got a reference back....
anyways, thanks a lot! the thing is now working!
--
bboett at erm1 dot u-strasbg dot fr
http://erm6.u-strasbg.fr/~bboett
==============================================================
Unsolicited commercial email is NOT welcome at this email address
------------------------------
Date: 16 May 2001 09:28:14 GMT
From: bboett@erm6.u-strasbg.fr (Bruno Boettcher)
Subject: HELP: modifying a referenced array from a library subroutine...
Message-Id: <9dth7e$q7u$1@news.u-strasbg.fr>
hello!
again i have some trouble....
from the readings i thought that by passing vaules by reference it
allowed me to modify the real values in subroutines, but seems as if i
understood it badly another time :D
suppose i have a main script where i defined an array:
my @operators = ();
the ref to the array is put inside a hash:
$sysressource{"operators"} = \@operators;
this thing is now passed to an anon sub defined in a separately compiled
lib file (linked with 'do') and which has thus no global ref on
@operators... :
&{$owneractions->{$commandtag}}( \%sysressource,$sLine,$restofline );
in the sub i retrieve a pointer to the array:
my @operators = @{$sysressource ->{"operators"}};
then i modify this array, e.g.:
push @operators,$newuser;
now searching in the local @operators array of the sub shows that the
new entry was added, but in the main::scope it wasn't...
as if a local version of the array was created.... and i was't using a
reference....
so where did i do my error?
--
bboett at erm1 dot u-strasbg dot fr
http://erm6.u-strasbg.fr/~bboett
==============================================================
Unsolicited commercial email is NOT welcome at this email address
------------------------------
Date: 16 May 2001 08:56:04 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: HELP: modifying a referenced array from a library subroutine...
Message-Id: <9dtfb4$9v$1@mamenchi.zrz.TU-Berlin.DE>
According to Bruno Boettcher <bboett@erm1.u-strasbg.fr>:
> hello!
>
> again i have some trouble....
> from the readings i thought that by passing vaules by reference it
> allowed me to modify the real values in subroutines, but seems as if i
> understood it badly another time :D
>
> suppose i have a main script where i defined an array:
>
> my @operators = ();
>
> the ref to the array is put inside a hash:
> $sysressource{"operators"} = \@operators;
>
> this thing is now passed to an anon sub defined in a separately compiled
> lib file (linked with 'do') and which has thus no global ref on
> @operators... :
>
> &{$owneractions->{$commandtag}}( \%sysressource,$sLine,$restofline );
>
>
> in the sub i retrieve a pointer to the array:
> my @operators = @{$sysressource ->{"operators"}};
Here is where it happens. This statement places a copy of the array
referenced by $sysressource ->{operators} in @operators.
> then i modify this array, e.g.:
> push @operators,$newuser;
This pushes $newuser on the copy, not the original array, which
is unchanged. Do
push @{$sysressource ->{operators}}, $newuser;
and you will find $newuser where you expect to find it.
[...]
Anno
------------------------------
Date: Tue, 15 May 2001 23:30:06 -0400
From: "James Richardson" <time4tea@monmouth.com>
Subject: Re: Http REFFERER -> IP ADDR
Message-Id: <9dssc5$83r$1@nntp9.atl.mindspring.net>
"Alan Barclay" <gorilla@elaine.furryape.com> wrote in message
news:989876262.401940@elaine.furryape.com...
> >> the user follows the link from a private intranet, then
> >> the name could only be resolvable by systems on that
> >> private intranet.
> >
> >Wouldn't you get the proxy/NAT address in that case?
>
> The proxy address would be in REMOTE_ADDR. The HTTP_REFERER contains
> the URL of the previous page, and isn't translated.
>
If I have followed a link from my internal web site, IP address 198.192.0.10
to any external website, the value for HTTP_REFERER will be my own web site,
which is not a valid external IP address.... The value for REMOTE_ADDR will
also (i think) be that of the NAT machine, rather than the real machine the
request came from.
HTH
James
------------------------------
Date: Wed, 16 May 2001 02:52:29 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: if ($x in @a) equivalent in perl?
Message-Id: <m3itj2huno.fsf@alquds.qumsieh.homeip.net>
Joe Schaefer wrote:
> Ren Maddox <ren@tivoli.com> writes:
>
> > On 13 May 2001, joe+usenet@sunstarsys.com wrote:
> > > % ./try.pl a
> > > for: 46097.80/s (n=230950)
> > > grep: 1855.29/s (n=9295)
> > > hash: 7554.69/s (n=37849)
> > >
> > > % ./try.pl i
> > > for: 7419.16/s (n=37170)
> > > grep: 1833.67/s (n=9205)
> > > hash: 7509.70/s (n=37924)
> > >
> > > % ./try.pl z
> > > for: 2652.80/s (n=13264)
> > > grep: 1836.33/s (n=9200)
> > > hash: 7531.60/s (n=37658)
> >
> > What version of Perl was this? With:
>
> Damn good question. They were run yesterday
> with 5.005_03 on Linux 2.4.3, but I can't reproduce
> them today :-\
>
> As they are rediculously slow compared to today's
> figgers, I can only guess that some resource was
> exhausted somewhere. They now appear to be worthless
> results, as a recheck now shows my results agree
> completely with yours (your speeds are double mine
> running 5.00503 on a 225MHz Linux box).
At least the original results showed the same ratios between the
different methods. This basically confirms that foreach() is indeed
faster than grep() even in the case where both have to traverse the
entire array. I am not sure where the difference is, but it's probably
that grep() constructs a copy of the list it is passed before actually
'grepping', while the foreach using pointers that simply starts at the
beginning of the array, and moves down.
Again, this is Perl, and memory consumption shouldn't be of primary
concern. So, the smart thing would be to use a hash.
--Ala
------------------------------
Date: 15 May 2001 23:29:59 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: if ($x in @a) equivalent in perl?
Message-Id: <m33da60y4o.fsf@mumonkan.sunstarsys.com>
Ala Qumsieh <aqumsieh@hyperchip.com> writes:
> Joe Schaefer wrote:
[...my bogus results snipped...]
> At least the original results showed the same ratios between the
> different methods.
In case I didn't make this clear- those numbers are worthless unless
other people get similar results. *I* can't reproduce them, so it
would be better to discuss Ren's results.
> This basically confirms that foreach() is indeed faster than grep()
> even in the case where both have to traverse the entire array.
Ren's results don't bear this out, so I wouldn't try searching
for a perl-related reason unless there is corroborating evidence.
--
Joe Schaefer "Only presidents, editors and people with tapeworm have the
right to use the editorial 'we'."
-- Mark Twain
------------------------------
Date: Wed, 16 May 2001 09:21:33 +0200
From: "Karol Nowakowski" <karol@imm.org.pl>
Subject: Re: Locking acces to files
Message-Id: <3b0229f4$1@news.home.net.pl>
Thank you very much for Your help.
Best Regards,
Charles
------------------------------
Date: Tue, 15 May 2001 23:02:27 -0400
From: "nosabi" <nosabi@snospamabi.com>
Subject: Make 'HTTP_REFERER' capture search engine referer
Message-Id: <9dsqk3$k6v$1@sshuraaa-i-1.production.compuserve.com>
Hi,
How do I set it up so that the 'HTTP_REFERER'
is saved as soon as someone visits my top level DomainName.
I want to be able to save the user info and what search engine
sent my best customers together. However 'HTTP_REFERER'
is lost as soon as they click on something.
Do I need to have my index.html replaced with a INDEX.CGI ?
What is everyone else doing ?
thanks for all your sugestions
the kid.
------------------------------
Date: Wed, 16 May 2001 00:28:36 -0500
From: xris <xris@dont.send.spam>
Subject: Re: Make 'HTTP_REFERER' capture search engine referer
Message-Id: <xris-A1D93C.00283616052001@news.evergo.net>
In article <9dsqk3$k6v$1@sshuraaa-i-1.production.compuserve.com>,
"nosabi" <nosabi@snospamabi.com> wrote:
> Do I need to have my index.html replaced with a INDEX.CGI ?
I use an index.cgi (shopping cart stuff) that grabs referer info upon
customer arrival. Then, it checks to see if it's not from my own site,
and then that it exists (if it doesn't, it either means that they were
referred by a cloaking script, or typed the URL in directly). I doubt
there's a way to grab a referer if you have an index.html, unless you
have active Perl code within your html document.
-Chris
------------------------------
Date: 16 May 2001 06:55:54 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Make 'HTTP_REFERER' capture search engine referer
Message-Id: <slrn9g4964.jl4.rgarciasuarez@rafael.kazibao.net>
nosabi wrote in comp.lang.perl.misc:
} Hi,
} How do I set it up so that the 'HTTP_REFERER'
} is saved as soon as someone visits my top level DomainName.
} I want to be able to save the user info and what search engine
} sent my best customers together. However 'HTTP_REFERER'
} is lost as soon as they click on something.
} Do I need to have my index.html replaced with a INDEX.CGI ?
} What is everyone else doing ?
If you have access to the configuration of your web server, you can
probably ask it to log the referer. This way, you don't have to
implement your own logging.
If you can't do that, you'll have to put an index.cgi (or index.php, or
whatever) in place of your static home page. Whether this solution is
allowed depends on the configuration of your web server.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Wed, 16 May 2001 09:36:44 +0200
From: "Karol Nowakowski" <karol@imm.org.pl>
Subject: Measuring the time
Message-Id: <3b022d83$1@news.home.net.pl>
I'm now using this thing:
use LWP::Simple;
@data = get($urlzdj);
to download sth from the desired url.
Is it possible, and how to do it, to get the download time in miliseconds?
Best regards,
Charles
------------------------------
Date: 16 May 2001 08:59:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Measuring the time
Message-Id: <9dtfgm$9v$2@mamenchi.zrz.TU-Berlin.DE>
According to Karol Nowakowski <karol@imm.org.pl>:
> I'm now using this thing:
>
> use LWP::Simple;
> @data = get($urlzdj);
>
> to download sth from the desired url.
> Is it possible, and how to do it, to get the download time in miliseconds?
The Time::Hires module should do that.
Anno
------------------------------
Date: 16 May 2001 08:49:09 +0100
From: nobull@mail.com
Subject: Re: Measuring the time
Message-Id: <u9pud9y84r.fsf@wcl-l.bham.ac.uk>
Karol, do not interpret this as an attack on you.
"Karol Nowakowski" <karol@imm.org.pl> writes:
FAQ: "How can I measure time under a second?"
You must[1] read the FAQ _before_ you post.
[1] As a reaction to the band of assholes who seem intent on
disrupting any attempt to produce clear and concise posting guidelines
to help people like Karol, I have now changed "You are expected to" to
"You must" in my standard RTFFAQ response.
Of course when I say "you must" I really mean "in order not to make
yourself appear selfish you must". Let's be absolutely clear about
this... it is not an absolute "must"... if you _want_ to appear
selfish then it is perfectly OK not read the FAQ before you post.
Good I'm glad that's clear now.
Karol, do not interpret this as an attack on you.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 16 May 2001 10:46:08 +0200
From: Ulrich Ackermann <ack@ivu.de>
Subject: Re: Measuring the time
Message-Id: <3B023E50.C949187B@ivu.de>
Karol Nowakowski wrote:
> I'm now using this thing:
>
> use LWP::Simple;
> @data = get($urlzdj);
>
> to download sth from the desired url.
> Is it possible, and how to do it, to get the download time in miliseconds?
>
> Best regards,
> Charles
Maybe Time::HiRes is what you are looking for.
HTH, Ulrich
------------------------------
Date: Wed, 16 May 2001 03:03:52 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Measuring the time
Message-Id: <3B025088.3C048BB6@stomp.stomp.tokyo>
nobull@mail.com wrote:
> Karol, do not interpret this as an attack on you.
> "Karol Nowakowski" <karol@imm.org.pl> writes:
> FAQ: "How can I measure time under a second?"
> You must[1] read the FAQ _before_ you post.
> [1] As a reaction to the band of assholes who seem intent on
> disrupting any attempt to produce clear and concise posting guidelines
> to help people like Karol, I have now changed "You are expected to" to
> "You must" in my standard RTFFAQ response.
> Of course when I say "you must" I really mean "in order not to make
> yourself appear selfish you must". Let's be absolutely clear about
> this... it is not an absolute "must"... if you _want_ to appear
> selfish then it is perfectly OK not read the FAQ before you post.
"MUST does not mean MUST."
Book Of Tad 7:11
Godzilla!
------------------------------
Date: Wed, 16 May 2001 05:33:26 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Pattern match headache
Message-Id: <slrn9g43ou.90p.bernard.el-hagin@gdndev25.lido-tech>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>According to Bernard El-Hagin <bernard.el-hagin@lido-tech.net>:
>> On Tue, 15 May 2001 15:46:43 +0200, P.Eftevik <pef@trasra.noXX> wrote:
>> >I'm searching for words starting with the plus ('+') character,
>> >like this :
>> >
>> >if ( $word =~ / ^\+.* / ) { etc..}
>
>I believe the OP put the spaces in deliberately in an attempt to
>make the pattern match "words". This fails in multiple ways, partly
>because of the greediness of ".*" and partly because words at the
>beginning or end of a string are not surrounded by blanks.
Well, if he/she is going through a list of words one to a line then
getting rid of the blanks fixes it. :-)
Cheers,
Bernard
------------------------------
Date: Wed, 16 May 2001 17:47:05 +0800
From: "yungp" <yungp@netvigator.com>
Subject: Perl Modules
Message-Id: <9dtigp$q2u4@imsp212.netvigator.com>
Hi,
I am a newbie at this Perl programming. Recently, I have been trying to
install some Perl scripts, which I found on my RedHat Linux 6.2.
I tried to execute the script and I get an error like this:
Can't locate LWP/UserAgent.pm in @INC (@INC contains:
/usr/lib/perl5/5.00503/i38
6-linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux
/usr/li
b/perl5/site_perl/5.005 .) at ./swishspider line 3.
I have found 5 lines in the script that show the following:
use LWP::UserAgent;
use LWP::RobotUA;
use HTTP::Request;
use HTTP::Status;
use HTML::LinkExtor;
Do I just need to install the Perl Modules of LWP, HTTP and HTML for this?
Is there any possible version conflict that I should be aware of?
Thanks
Peter
------------------------------
Date: Wed, 16 May 2001 11:51:02 +0930
From: Chris <rebelvideo@hotmail.com>
Subject: Re: Please help with signals
Message-Id: <3B01E40E.F1086B7@hotmail.com>
Hi Villy
Sorry I am not all that familiar with unix
I believe su runs a new shell as the defined user
I cannot su to root, as the server is a remote server
I have access to cgi-bin only
How do I su to the user from my script?
to re-explain the problem...
(I don't think my original explanation was very clear)
I have a script that imitates cron,
I don't have access to cron, so I needed a script that regularly
launches site maintenance scripts.
this script runs adinfinitum or till the next boot :)
Thus I need a reliable way to kill the script
hence I create a script called cronman.pl (Cron Manager)
one of its jobs is to kill off cron if required
my idea was to simply send a signal from cronman to cron telling it to
quit.
when cron starts it writes it's pid to a file
cronman was supposed to pick this up and then simply "kill 'QUIT' $pid;"
It must be remembered this script is to be managed remotely through a
web interface, So I cannot telnet in etc...
So if you have any hints please let me know
--
Regards
Chris
rebelvideo@hotmail.com
Villy Kruse wrote:
>
> On Tue, 15 May 2001 16:16:20 +0930, Chris <rebelvideo@hotmail.com> wrote:
> >Hi guys
> >
> >I have managed to find out how to capture STDERR using backticks :)
> >
> >it has revealed the problem as kill: (15575) - Not owner
> >
> >I am trying to kill one script from another script
> >NOT a parent/child relationship
> >
> >both have the apache server as the userid
> >
> >How do I go about solving this dillemma
> >
> >How do I become the "owner" of a process that is already running?
> >
> >my only other choice seems to be to use a semaphore file, this will only
> >kill the process when it looks for it
> >so I can't make it jump out of the sleep call.
> >
>
> You need to "su" to the user that is running the process or "su" to root.
> Then you can send a signal to the process. It would not be nice if
> arbitrary users could kill processes started by other arbitrary users.
>
> Villy
------------------------------
Date: Wed, 16 May 2001 02:38:53 GMT
From: steven.smolinski@sympatico.ca (Steven Smolinski)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <slrn9g3ve0.t5.steven.smolinski@ragnar.stevens.gulch>
Mark Jason Dominus <mjd@plover.com> wrote:
> John Stanley <stanley@skyking.OCE.ORST.EDU> wrote:
> >Amost all of this is very good advice. I've only got a problem with the
> >imperatives that are being used.
>
> I agree. 'Must' is inappropriate, and only serves to make the authors
> look foolish.
I don't think it makes the authors look foolish if they use the term
properly, i.e., within a conditional. "*If* you wish to retain the interest
of the regulars, you must do x."
That is how terms like "must" and "shall" are interpreted in polite
company. For instance, the RFC's rules *must* be followed *if* one is
to build a complying implementation. Noone wails that the RFCs are
being overly authoritarian about their topics. They are stating
conditional facts.
And so it is here. *If* you want Tad to help (any many other good
people besides him) you *must* check the docs first. That's all I took
it to mean, and find it reasonable (and true) as said.
People who bristle at rules just because they're rules will always hate
these conditional absolutes. And if you word the rule so as to make it
seem optional, people will think the rule itself is optional. But it is
not. How optional is it that, say, Abigail will explain a FAQ to some
newbie who couldn't be bothered to grep through the pod?
Steve
--
Steven Smolinski => http://www.steven.cx/
------------------------------
Date: Wed, 16 May 2001 05:38:53 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <slrn9g4433.90p.bernard.el-hagin@gdndev25.lido-tech>
On 15 May 2001 16:52:43 GMT, John Stanley <stanley@skyking.OCE.ORST.EDU> wrote:
>In article <slrn9g268d.v5e.mgjv@martien.heliotrope.home>,
>Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
>>>>I cannot make the change you suggest.
>>>
>>> Why not? You are wrong to say "must", so why can you not correct it?
>>
>>The wording (not Tad) is wrong in _your_ opinion, but obviously not in
>>the eyes of many other posters here.
>
>Martien, this is an unmoderated USENET discussion group. Trying to claim
>that anything is a "must" before posting is just plain silly. Yes, tell
>people that it is a REALLY GOOD IDEA, and even shout if you want, but
>telling them that it is a "must" simply isn't true. Forty million
>Frenchmen WERE wrong. Apply the analogy.
You don't seem to understand that the 'must' means 'if you want expert
advice from some of the best Perl programmers in the world you must'
and not 'you must because, well, you just must'.
>>I happen to think that should is much too weak. Must is exactly what it
>>should read. Must. May not. Must not.
>
>Which of the "must" requirements did you fulfill prior to your posting
>this? If you are not willing to honor a "must" that you think you have
>the right to tell others, why do you think they will honor it?
Are you being stupid on purpose?
[loads of bollocks snipped]
Cheers,
Bernard
------------------------------
Date: Wed, 16 May 2001 05:40:22 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <slrn9g445s.90p.bernard.el-hagin@gdndev25.lido-tech>
On Tue, 15 May 2001 17:28:41 -0500, Andrew Yeretsky <ayeretsk@arm.com> wrote:
>This document you are arguing about is ridiculous. As someone who posted to
>this newsgroup for the first and probably the last time today, I have to say I
>agree with Godzilla.
Good, then go away and take her with you.
Cheers,
Bernard
------------------------------
Date: Wed, 16 May 2001 03:00:01 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <3B024FA1.11A4871F@stomp.stomp.tokyo>
Bernard El-Hagin wrote:
> Andrew Yeretsky wrote:
> >This document you are arguing about is ridiculous. As someone who posted to
> >this newsgroup for the first and probably the last time today, I have to say I
> >agree with Godzilla.
> Good, then go away and take her with you.
"You MUST not agree with Godzilla."
If you do, you MUST go away."
Book Of Tad, 11:23
Godzilla!
------------------------------
Date: 16 May 2001 02:10:08 GMT
From: dha@panix2.panix.com (David H. Adler)
Subject: Re: South Florida Job
Message-Id: <slrn9g3oc0.d0v.dha@panix2.panix.com>
In article <9drqjm$j34$1@slb1.atl.mindspring.net>, Todd Katcher wrote:
> Interested in a full time perl / php job in Sunny South Florida.
You have posted a job posting or a resume in a technical group.
Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.
Had you read and understood the Usenet user manual posted frequently to
"news.announce.newusers", you might have already known this. :) (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)
Another good source of information on how Usenet functions is
news.newusers.questions (information from which is also available at
http://www.geocities.com/nnqweb/).
Please do not explain your posting by saying "but I saw other job
postings here". Just because one person jumps off a bridge, doesn't
mean everyone does. Those postings are also in error, and I've
probably already notified them as well.
If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.
http://jobs.perl.org may be of more use to you
Yours for a better usenet,
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
she's a lovetarian especially in the form of puppies
- Jellyfish, Sebrina, Paste and Plato
------------------------------
Date: 15 May 2001 22:26:07 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: static values in a subroutine
Message-Id: <9dss0f$7um$1@ahab.cs.utexas.edu>
In article <3B0153F0.74289C0F@noaa.gov>,
Travis Stevens <Travis.Stevens@noaa.gov> wrote:
>I've been searching through my Programming Perl book and my Learning
>Perl book and have not found any information on this subject.
>Basically, I have a subroutine where I want to keep some values around
>so the next time I call the subroutine the values can be used. IE
>static varibles in C.
This really may or may not apply to your situation, but sometimes this
is an indication that you could benefit from taking an object-oriented
approach. You might end up with a much cleaner solution if you store
everything in an object.
Compare the non-object oriented approach:
package Counter;
{
my $counter;
sub initializeCounter
{
$counter = shift;
}
sub incrementCounter
{
$counter++;
}
sub getCounter
{
return $counter;
}
}
#----
package main;
Counter::initializeCounter;
for (1 .. 5) { Counter::incrementCounter };
print Counter::getCounter, "\n";
And the object-oriented approach:
package Counter;
sub new
{
my $class = shift;
my $self = {};
bless $self, $class;
$self->{counter} = 0;
return $self;
}
sub incrementCounter
{
my $self = shift;
$self->{counter}++;
}
sub getCounter
{
my $self = shift;
return $self->{counter};
}
#----
package main;
$counter = Counter::new;
for (1 .. 5) { $counter->incrementCounter; }
print $counter->getCounter, "\n";
For this contrived example, the object-oriented approach isn't
necessarily a million times better. (It does have the concrete
advantage that you can have more than one counter!) But, I'm sure if
you think of your problems in terms of this, it'll be easy to see
whether it will make for a better solution or not.
Often, when you need to store some state somewhere, it's hard to know
where. Sometimes storing it inside a subroutine is not a bad idea, but
often you'll find that storing it inside an object is better.
- Logan
--
my your his her our their _its_
I'm you're he's she's we're they're _it's_
------------------------------
Date: Wed, 16 May 2001 04:37:33 GMT
From: eggie@sunlink.net (James Kufrovich)
Subject: Where can I find The Perl Journal?
Message-Id: <slrn9g416v.m5a.eggie@melody.mephit.com>
Hi.
Like the subject says, where can I find copies of The Perl
Journal? I'd like to look at a copy or two before I decide to subscribe,
although I'm sure I'll subscribe to it anyway. The placeholder page says
that issue 20 has been sent off to bookstores, but I haven't seen it in
any. (The onle bookstores in this backwoods place are Waldenbooks, and
they don't carry it.) Does anybody know of any bookstore chains that *do*
carry it? Or how about online? I'm sure I remember some site having a
few issues; maybe it was linuxmall.com, but if it was, they don't have any
now. Any ideas from anyone? I'd appreciate any tips. Thanks.
Jamie Kufrovich
--
Egg, eggie (at) sunlink (dot) net
FMSp3a/MS3a A- C D H+ M+ P+++ R+ T W Z+
Sp++/p# RLCT a+ cl++ d? e++ f h* i+ j p+ sm+
------------------------------
Date: 16 May 2001 00:40:28 GMT
From: agnes@talarian.com.nospam
Subject: Re: XS and varargs
Message-Id: <9dsi9s$i0l$1@news.netmar.com>
"Dan Sugalski" <dan@tuatha.sidhe.org> wrote:
> agnes@talarian.com wrote:
>
> > So I am trying to write a perl wrapper around a set of C functions using
XS.
> > I ran into a problem with a "print-like" function that takes a format
argument
> > followed by a vararg list. From the perlxs manual, using an ellipsis
should
> > work. But the only example given assume that the programmer actually
knows
> > what will be in the list.
>
> This is documented in the perlxs chunk of the docs. Check out the bits
> in the "variable-length parameter lists" section specifically.
I RTFM'ed before posting, and couldn't figure a way to do it from the doc.
It does not show any way to stuff back whatever was sent by the ellipsis in a
vararg C function. As I said, it more or less assumes that the programmer
knows the possible combinations of arguments coming through the ellipsis
arguments, and that the number of possible permutations is finite.
However, if my XS stub looks like:
void myPrint (formatStr, ...)
char * formatStr;
CODE:
/* that's were I was stuck */
/* what parameter(s) should be given to printf?*/
printf(formatStr, ...);
I had a glimmer of hope on a way to solve the problem using vprintf instead of
printf, thinking that maybe I could loop on the items variable, adding each
argument (I would know the type at runtime) to a va_list, and then passing
the va_list to vprintf.
Unfortunately comp.lang.c confirmed that there is no way to create/modify a
va_list variable in C. So I concluded that the problem was unsolvable.
I would be glad to be proven wrong, though :-)
Agnes
PS: Just in case...
I am not really trying to rewrite print, but printf/vprintf were the
well-known C functions whose behaviour was closest to the one of the set of
functions I need to wrap.
----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web -----
http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
NewsOne.Net prohibits users from posting spam. If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 911
**************************************