[16791] in Perl-Users-Digest
Perl-Users Digest, Issue: 4203 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 1 18:10:36 2000
Date: Fri, 1 Sep 2000 15:10:22 -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: <967846221-v9-i4203@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 1 Sep 2000 Volume: 9 Number: 4203
Today's topics:
Re: LWP::Parallel <uri@sysarch.com>
Re: LWP::Parallel joekind@my-deja.com
Re: LWP::Parallel joekind@my-deja.com
Re: LWP::Parallel <lr@hpl.hp.com>
Re: mod_perl redirection problem <dwilgaREMOVE@mtholyoke.edu>
Re: My Perl looks like C! (Greg Andrews)
New Free Metasearch <stevet@thevision.net>
Re: Newbie needs help! reschramz@my-deja.com
Re: open web file (Charles DeRykus)
Re: open web file <lr@hpl.hp.com>
Re: open web file <jeff@vpservices.com>
Perl/CGI Shell Commands darlenewong@my-deja.com
Re: print before exec (fvw)
problem with install mod_perl with CPAN ntang99@my-deja.com
Re: Q. relating to perlfaq(4) / sort <lr@hpl.hp.com>
THE BEST solution to encode Strings after a 3DES crypt <tong@quadrupede.com>
Unidentified Subroutine <edcap@netcom2.netcom.com>
Re: working out signatures (Abigail)
Re: working out signatures <peckert@epicrealm.com>
Re: working out signatures (Decklin Foster)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 01 Sep 2000 18:08:41 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: LWP::Parallel
Message-Id: <x7g0nkouhj.fsf@home.sysarch.com>
>>>>> "j" == joekind <joekind@my-deja.com> writes:
j> I have tried using forking too but I could not get the program to wait
j> until it had got all of the content from the sites. How did you get
j> yours to wait and how fast was did your program get the content? Any
j> code that you may have will help greatly.
i butchered out the relevent parts to a meta search script i wrote. this
will not compile/run as is and it has no driving code. but it should be
very easy to get running. the part where it reads from the search
engines will need hacking to suit your needs. my needs were very simple
as this was mostly a proof of concept.
uri
#!/home/uri/bin/perl -w
$| = 1 ;
use Symbol ;
use IO::Select ;
use LWP::Simple qw( $ua get ) ;
use strict ;
sub fork_engines {
my( $handle, $eng_ref ) ;
# prepare to read the children's results in parallel
$io_select = IO::Select->new( ) ;
# loop over all the search engines
foreach $eng_ref ( @engine_info ) {
# get a new file handle
$handle = gensym ;
# fork a child process. its STDOUT is connected to this handle in the parent.
if ( open( $handle, '-|' ) ) {
# in parent: save the handle and make a reverse lookup table
# so we can go from the handle back to the engine entry.
# then add the handle to the io select object
$eng_ref->{'handle'} = $handle ;
$handle2eng{ $handle } = $eng_ref ;
$io_select->add( $handle ) ;
next ;
}
# in child - never returns - execute a search on a real engine
child_engine( $eng_ref ) ;
}
}
# read the hit results from the children
sub read_engines {
my( @read_handles, $eng_name, $handle, $hit, $hit_count ) ;
# slurp hist results in paragraph mode
local( $/ ) = '' ;
$hit_count = 0 ;
# loop while we still have children to read or until we timeout
HIT:
while ( @read_handles = $io_select->can_read( 10 ) ) {
#print "read @read_handles\n" ;
# loop over the handles we can read
foreach $handle ( @read_handles ) {
# get the engine name from the handle
# in the future, there may be more stuff in the engine structure than the name
$eng_name = $handle2eng{ $handle }->{'name'} ;
# print "\n\t$eng_name\n" ;
# read the hit
$hit = <$handle> ;
# see if we actually read one (could be eof)
if ( $hit ) {
# stop reading hits if this was a good hit and we have seen enough
last HIT if hit2html( $hit ) &&
++$hit_count >= $max_hits ;
}
else {
# the child is dead, remove its handle and close it
$io_select->remove( $handle ) ;
close $handle ;
}
}
}
}
# this code is run in each child process.
sub child_engine {
my( $eng_ref ) = @_ ;
my( $eng_name, $search, $result, $query_text ) ;
# get the engine name and a search object
$eng_name = $eng_ref->{'name'} ;
$search = WWW::Search->new( $eng_name ) ;
die "bad engine $eng_name\n" && next unless $search ;
# print "$$ $eng_name\n" ;
# build the query for the engine. require all the terms.
# this may become a perl engine query generator. the @engine_info
# structure would contain a sub ref to the engine specific query
# maker.
$query_text = join( ' ', map "+$_", @query_terms ) ;
# start the search
$search->native_query( WWW::Search::escape_query( $query_text ) ) ;
# timeout the fetches of the actual pages
$ua->timeout( 2 ) ;
# loop over how many hits per engine
for ( 1 .. $max_engine_hits ) {
# get a search result (hit)
last unless $result = $search->next_result() ;
# send that hit back to the parent process
send_hit_info( $result->url ) ;
}
# child dies ;
exit( 0 ) ;
}
BEGIN {
@engine_info = (
{
'name' => 'AltaVista',
},
{
'name' => 'NorthernLight',
},
{
'name' => 'Infoseek',
},
{
'name' => 'Lycos',
},
) ;
}
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Fri, 01 Sep 2000 20:04:40 GMT
From: joekind@my-deja.com
Subject: Re: LWP::Parallel
Message-Id: <8op248$ct9$1@nnrp1.deja.com>
Thanks a lot for this code. but I got a few errors for some of the
variables because it said require explicite package, so I put "my"
infront of those variables. but when I try to put "my" infront of:
$handle2eng{$handle} = $eng_ref ;
it gives me a error. how can I get around this?
In article <x7g0nkouhj.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
> >>>>> "j" == joekind <joekind@my-deja.com> writes:
>
> j> I have tried using forking too but I could not get the program
to wait
> j> until it had got all of the content from the sites. How did you
get
> j> yours to wait and how fast was did your program get the
content? Any
> j> code that you may have will help greatly.
>
> i butchered out the relevent parts to a meta search script i wrote.
this
> will not compile/run as is and it has no driving code. but it should
be
> very easy to get running. the part where it reads from the search
> engines will need hacking to suit your needs. my needs were very
simple
> as this was mostly a proof of concept.
>
> uri
>
> #!/home/uri/bin/perl -w
>
> $| = 1 ;
>
> use Symbol ;
> use IO::Select ;
> use LWP::Simple qw( $ua get ) ;
>
> use strict ;
>
> sub fork_engines {
>
> my( $handle, $eng_ref ) ;
>
> # prepare to read the children's results in parallel
>
> $io_select = IO::Select->new( ) ;
>
> # loop over all the search engines
>
> foreach $eng_ref ( @engine_info ) {
>
> # get a new file handle
>
> $handle = gensym ;
>
> # fork a child process. its STDOUT is connected to this handle in the
parent.
>
> if ( open( $handle, '-|' ) ) {
>
> # in parent: save the handle and make a reverse lookup table
> # so we can go from the handle back to the engine entry.
> # then add the handle to the io select object
>
> $eng_ref->{'handle'} = $handle ;
> $handle2eng{ $handle } = $eng_ref ;
>
> $io_select->add( $handle ) ;
>
> next ;
> }
>
> # in child - never returns - execute a search on a real engine
>
> child_engine( $eng_ref ) ;
> }
> }
>
> # read the hit results from the children
>
> sub read_engines {
>
> my( @read_handles, $eng_name, $handle, $hit, $hit_count ) ;
>
> # slurp hist results in paragraph mode
>
> local( $/ ) = '' ;
>
> $hit_count = 0 ;
>
> # loop while we still have children to read or until we timeout
>
> HIT:
> while ( @read_handles = $io_select->can_read( 10 ) ) {
>
> #print "read @read_handles\n" ;
>
> # loop over the handles we can read
>
> foreach $handle ( @read_handles ) {
>
> # get the engine name from the handle
> # in the future, there may be more stuff in the engine structure than
the name
>
> $eng_name = $handle2eng{ $handle }->{'name'} ;
>
> # print "\n\t$eng_name\n" ;
>
> # read the hit
>
> $hit = <$handle> ;
>
> # see if we actually read one (could be eof)
>
> if ( $hit ) {
>
> # stop reading hits if this was a good hit and we have seen enough
>
> last HIT if hit2html( $hit ) &&
> ++$hit_count >= $max_hits ;
> }
> else {
>
> # the child is dead, remove its handle and close it
>
> $io_select->remove( $handle ) ;
> close $handle ;
> }
> }
> }
> }
>
> # this code is run in each child process.
>
> sub child_engine {
>
> my( $eng_ref ) = @_ ;
>
> my( $eng_name, $search, $result, $query_text ) ;
>
> # get the engine name and a search object
>
> $eng_name = $eng_ref->{'name'} ;
> $search = WWW::Search->new( $eng_name ) ;
>
> die "bad engine $eng_name\n" && next unless $search ;
>
> # print "$$ $eng_name\n" ;
>
> # build the query for the engine. require all the terms.
> # this may become a perl engine query generator. the @engine_info
> # structure would contain a sub ref to the engine specific query
> # maker.
>
> $query_text = join( ' ', map "+$_", @query_terms ) ;
>
> # start the search
>
> $search->native_query( WWW::Search::escape_query(
$query_text ) ) ;
>
> # timeout the fetches of the actual pages
>
> $ua->timeout( 2 ) ;
>
> # loop over how many hits per engine
>
> for ( 1 .. $max_engine_hits ) {
>
> # get a search result (hit)
>
> last unless $result = $search->next_result() ;
>
> # send that hit back to the parent process
>
> send_hit_info( $result->url ) ;
> }
>
> # child dies ;
>
> exit( 0 ) ;
> }
>
> BEGIN {
>
> @engine_info = (
>
> {
> 'name' => 'AltaVista',
> },
> {
> 'name' => 'NorthernLight',
> },
> {
> 'name' => 'Infoseek',
> },
> {
> 'name' => 'Lycos',
> },
> ) ;
>
> }
>
> --
> Uri Guttman --------- uri@sysarch.com ----------
http://www.sysarch.com
> SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX
Consulting
> The Perl Books Page ----------- http://www.sysarch.com/cgi-
bin/perl_books
> The Best Search Engine on the Net ----------
http://www.northernlight.com
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 01 Sep 2000 21:13:06 GMT
From: joekind@my-deja.com
Subject: Re: LWP::Parallel
Message-Id: <8op64h$ht8$1@nnrp1.deja.com>
Hi again. I fixed that problem by just taking out the use strict;
line. The code you have provided me so far is great and I really
appreciate your help, but I am still having a lot of trouble
understanding things because I do not know which variables do what and
which subs to call when. So if you want to help me out more, you could
just email me more of your code to kindness@sympatico.ca, it would help
out a lot. I have been working off and on with this speed problem for
over half a year and if this code can help me, then all of my
fustrations will float away.
Thanks, Joey.
In article <8op248$ct9$1@nnrp1.deja.com>,
joekind@my-deja.com wrote:
> Thanks a lot for this code. but I got a few errors for some of the
> variables because it said require explicite package, so I put "my"
> infront of those variables. but when I try to put "my" infront of:
> $handle2eng{$handle} = $eng_ref ;
> it gives me a error. how can I get around this?
>
> In article <x7g0nkouhj.fsf@home.sysarch.com>,
> Uri Guttman <uri@sysarch.com> wrote:
> > >>>>> "j" == joekind <joekind@my-deja.com> writes:
> >
> > j> I have tried using forking too but I could not get the program
> to wait
> > j> until it had got all of the content from the sites. How did
you
> get
> > j> yours to wait and how fast was did your program get the
> content? Any
> > j> code that you may have will help greatly.
> >
> > i butchered out the relevent parts to a meta search script i wrote.
> this
> > will not compile/run as is and it has no driving code. but it should
> be
> > very easy to get running. the part where it reads from the search
> > engines will need hacking to suit your needs. my needs were very
> simple
> > as this was mostly a proof of concept.
> >
> > uri
> >
> > #!/home/uri/bin/perl -w
> >
> > $| = 1 ;
> >
> > use Symbol ;
> > use IO::Select ;
> > use LWP::Simple qw( $ua get ) ;
> >
> > use strict ;
> >
> > sub fork_engines {
> >
> > my( $handle, $eng_ref ) ;
> >
> > # prepare to read the children's results in parallel
> >
> > $io_select = IO::Select->new( ) ;
> >
> > # loop over all the search engines
> >
> > foreach $eng_ref ( @engine_info ) {
> >
> > # get a new file handle
> >
> > $handle = gensym ;
> >
> > # fork a child process. its STDOUT is connected to this handle in
the
> parent.
> >
> > if ( open( $handle, '-|' ) ) {
> >
> > # in parent: save the handle and make a reverse lookup table
> > # so we can go from the handle back to the engine entry.
> > # then add the handle to the io select object
> >
> > $eng_ref->{'handle'} = $handle ;
> > $handle2eng{ $handle } = $eng_ref ;
> >
> > $io_select->add( $handle ) ;
> >
> > next ;
> > }
> >
> > # in child - never returns - execute a search on a real engine
> >
> > child_engine( $eng_ref ) ;
> > }
> > }
> >
> > # read the hit results from the children
> >
> > sub read_engines {
> >
> > my( @read_handles, $eng_name, $handle, $hit, $hit_count ) ;
> >
> > # slurp hist results in paragraph mode
> >
> > local( $/ ) = '' ;
> >
> > $hit_count = 0 ;
> >
> > # loop while we still have children to read or until we timeout
> >
> > HIT:
> > while ( @read_handles = $io_select->can_read( 10 ) ) {
> >
> > #print "read @read_handles\n" ;
> >
> > # loop over the handles we can read
> >
> > foreach $handle ( @read_handles ) {
> >
> > # get the engine name from the handle
> > # in the future, there may be more stuff in the engine structure
than
> the name
> >
> > $eng_name = $handle2eng{ $handle }->{'name'} ;
> >
> > # print "\n\t$eng_name\n" ;
> >
> > # read the hit
> >
> > $hit = <$handle> ;
> >
> > # see if we actually read one (could be eof)
> >
> > if ( $hit ) {
> >
> > # stop reading hits if this was a good hit and we have seen enough
> >
> > last HIT if hit2html( $hit ) &&
> > ++$hit_count >= $max_hits ;
> > }
> > else {
> >
> > # the child is dead, remove its handle and close it
> >
> > $io_select->remove( $handle ) ;
> > close $handle ;
> > }
> > }
> > }
> > }
> >
> > # this code is run in each child process.
> >
> > sub child_engine {
> >
> > my( $eng_ref ) = @_ ;
> >
> > my( $eng_name, $search, $result, $query_text ) ;
> >
> > # get the engine name and a search object
> >
> > $eng_name = $eng_ref->{'name'} ;
> > $search = WWW::Search->new( $eng_name ) ;
> >
> > die "bad engine $eng_name\n" && next unless $search ;
> >
> > # print "$$ $eng_name\n" ;
> >
> > # build the query for the engine. require all the terms.
> > # this may become a perl engine query generator. the @engine_info
> > # structure would contain a sub ref to the engine specific query
> > # maker.
> >
> > $query_text = join( ' ', map "+$_", @query_terms ) ;
> >
> > # start the search
> >
> > $search->native_query( WWW::Search::escape_query(
> $query_text ) ) ;
> >
> > # timeout the fetches of the actual pages
> >
> > $ua->timeout( 2 ) ;
> >
> > # loop over how many hits per engine
> >
> > for ( 1 .. $max_engine_hits ) {
> >
> > # get a search result (hit)
> >
> > last unless $result = $search->next_result() ;
> >
> > # send that hit back to the parent process
> >
> > send_hit_info( $result->url ) ;
> > }
> >
> > # child dies ;
> >
> > exit( 0 ) ;
> > }
> >
> > BEGIN {
> >
> > @engine_info = (
> >
> > {
> > 'name' => 'AltaVista',
> > },
> > {
> > 'name' => 'NorthernLight',
> > },
> > {
> > 'name' => 'Infoseek',
> > },
> > {
> > 'name' => 'Lycos',
> > },
> > ) ;
> >
> > }
> >
> > --
> > Uri Guttman --------- uri@sysarch.com ----------
> http://www.sysarch.com
> > SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX
> Consulting
> > The Perl Books Page ----------- http://www.sysarch.com/cgi-
> bin/perl_books
> > The Best Search Engine on the Net ----------
> http://www.northernlight.com
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 1 Sep 2000 14:46:43 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: LWP::Parallel
Message-Id: <MPG.1419c39dbea5fc0298ad16@nntp.hpl.hp.com>
[Rearranged and trimmed to provide coherent flow of ideas.]
In article <8op64h$ht8$1@nnrp1.deja.com> on Fri, 01 Sep 2000 21:13:06
GMT, joekind@my-deja.com <joekind@my-deja.com> says...
> In article <8op248$ct9$1@nnrp1.deja.com>,
> joekind@my-deja.com wrote:
> > Thanks a lot for this code. but I got a few errors for some of the
> > variables because it said require explicite package, so I put "my"
> > infront of those variables. but when I try to put "my" infront of:
> > $handle2eng{$handle} = $eng_ref ;
> > it gives me a error. how can I get around this?
You cannot use 'my' for an individual element of an aggregate.
my %handle2eng;
> Hi again. I fixed that problem by just taking out the use strict;
> line.
That doesn't fix the problem; it ignores it. One doesn't need to wear a
set belt, but it's nice to have it on if you get into an accident.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 01 Sep 2000 20:22:22 GMT
From: Dan Wilga <dwilgaREMOVE@mtholyoke.edu>
Subject: Re: mod_perl redirection problem
Message-Id: <dwilgaREMOVE-5ABFAF.16223501092000@news.mtholyoke.edu>
In article <%Wvr5.13498$Sh4.118791@news1.rdc1.ne.home.com>, asmussen@home.com
wrote:
> I won't put up the live code that is having problems, but here is an
> example
> program that suffers the exact same symptoms:
>
> #!/usr/local/bin/perl
> print "Location: http://name.of.test.box/index.html"
Change this to:
print "Status: 302\nLocation: http://name.of.test.box/index.html";
and I think your problem will go away. Essentially, every HTTP response should
have a Status somewhere in the header.
Dan Wilga dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply **
------------------------------
Date: 1 Sep 2000 14:47:07 -0700
From: gerg@ncal.verio.com (Greg Andrews)
Subject: Re: My Perl looks like C!
Message-Id: <8op84r$ps8$1@ncal.verio.com>
marcel@codewerk.com writes:
>
>Learn idiomatic Perl. Embrace hashes, map, grep, references, closures,
>regexes and all the other things that make Perl what it is.
>
Heh, when I saw this, it reminded me of _Desiderata_.
Has someone done a Perl Desiderata? Something like:
Go placidly amid the sorts and regexps,
and remember what peace there may be in -w.
That might be fun.
-Greg
------------------------------
Date: Fri, 01 Sep 2000 18:46:02 GMT
From: "Michael Turitzin" <stevet@thevision.net>
Subject: New Free Metasearch
Message-Id: <KPSr5.18$18.3301@news-west.eli.net>
After not being able to find a free metasearch engine (a script that
retrieves results from many search engines) I decided to make my own. I
just released it, and you can download it for free.
Just go to:
http://surfershome.com/scripts
------------------------------
Date: Fri, 01 Sep 2000 18:40:38 GMT
From: reschramz@my-deja.com
Subject: Re: Newbie needs help!
Message-Id: <8oot71$6pl$1@nnrp1.deja.com>
> >
> >
> >This is the third or fourth post asking for this same result. It
> > seems
> >not to be a coincidence that this is also the first week or two of
> >school in a lot of places, like maybe at cornell.edu.
> >
> >I wonder if your instructor ever reads usenet. I wonder if your
> >instructor knows about http://www.plagiarism.org
>
Would Cornell CS instructors really assign students to write programs
to run on Win32 systems?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 1 Sep 2000 19:15:19 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: open web file
Message-Id: <G082tJ.Ltr@news.boeing.com>
In article <m3u2c0s7mu.fsf@stig.a.sol.no>,
Stig Palmquist <stig@palmquist.org> wrote:
>"Sean Scannell" <sean@access-management.com> writes:
>
>> I guess I can fetch the file via LWP, but just wondering.
>
>use LWP::Simple;
>$data=get("http://www.foo.com/bar.html"):
>
Hey, there's the ticket :)
# ---- error checking left as proverbial exercise...
use LWP::Simple;
open( P, "-|") or getprint $url and exit;
print while <P>;
close P;
--
Charles DeRykus
------------------------------
Date: Fri, 1 Sep 2000 12:33:38 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: open web file
Message-Id: <MPG.1419a46d192e914f98ad14@nntp.hpl.hp.com>
In article <39AFDEB1.CBD36D0B@vpservices.com> on Fri, 01 Sep 2000
09:52:01 -0700, Jeff Zucker <jeff@vpservices.com> says...
...
> So my $0.02 is that, yes, "open" should apply to all kinds of files, and
> yes "path" should apply to both file system and http paths. But
> somewhere in there, there needs to be something that requires the user
> to specify what kind of path it is. That's what the URI and URL specs
> do -- they force us to put the word "train" or "bus" in front of the
> word station if we want to be understood. I presume that kind of
> specificity would be included in the HTTP semantics Abigail proposes and
> therefore any confusion would be the result of under-specification on
> the part of the speaker.
Wouldn't the scheme part of a URI ('http://' for example) uniquely
disambiguate it from a file-system pathname, absolute or relative?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 01 Sep 2000 12:54:44 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: open web file
Message-Id: <39B00984.A5B5D48F@vpservices.com>
Larry Rosler wrote:
>
> In article <39AFDEB1.CBD36D0B@vpservices.com> on Fri, 01 Sep 2000
> 09:52:01 -0700, Jeff Zucker <jeff@vpservices.com> says...
>
> ...
>
> > So my $0.02 is that, yes, "open" should apply to all kinds of files, and
> > yes "path" should apply to both file system and http paths. But
> > somewhere in there, there needs to be something that requires the user
> > to specify what kind of path it is. That's what the URI and URL specs
> > do -- they force us to put the word "train" or "bus" in front of the
> > word station if we want to be understood. I presume that kind of
> > specificity would be included in the HTTP semantics Abigail proposes and
> > therefore any confusion would be the result of under-specification on
> > the part of the speaker.
>
> Wouldn't the scheme part of a URI ('http://' for example) uniquely
> disambiguate it from a file-system pathname, absolute or relative?
In a round about way, that is just what I was saying. The
under-specification would only happen if the user themselves left that
part out.
--
Jeff
------------------------------
Date: Fri, 01 Sep 2000 19:18:57 GMT
From: darlenewong@my-deja.com
Subject: Perl/CGI Shell Commands
Message-Id: <8oovec$9dl$1@nnrp1.deja.com>
I need my CGI script to execute a series of Unix commands and return the
output. I can get
`command1`;
to execute fine by using backticks. However, I need the first command's
output redirected to the input of the second command, and so on:
`command1 | command2 | command 3 | ...`
I have four commands total. For some reason, the redirection beyond the
second command fails. Any help would be much appreciated!
Darlene
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 01 Sep 2000 19:36:47 GMT
From: fvw+usenet@var.cx (fvw)
Subject: Re: print before exec
Message-Id: <967837129YJW.fvw@var.cx>
<8ooota$iof$1@news0.skynet.be> (bachelart.pierre@skynet.be):
>#!/usr/bin/perl !
>some code
> ...
> ...
>print "hello\n";
>exec("another perl program"); # last line of my script
>
>When i start this in a cron i don't see the result of the print
>statement. Any idea ?
>If i replace exec by system i have no problem but i don't
>like this solution.
Your output is getting prolly getting buffered, and the buffer
isn't flushed untill it's flushed manually or more output is written
to it (Dunno how to flush manually actually, but it's gotta be possible).
Your best choice would probably be to disable output buffering with
$|, see perldoc perlvar for more info on it.
--
Frank v Waveren
fvw@var.cx
ICQ# 10074100
------------------------------
Date: Fri, 01 Sep 2000 19:06:30 GMT
From: ntang99@my-deja.com
Subject: problem with install mod_perl with CPAN
Message-Id: <8ooun7$8ku$1@nnrp1.deja.com>
I try to install mod_perl by using CPAN. The platform is Win2000,
ActivePerl 5.6, Apache 1.3.12. After run "install mod_perl", get the
following error:
Checking if your kit is complete...
Looks good
Writing Makefile for Apache
Writing Makefile for Apache::Connection
Writing Makefile for Apache::Constants
Writing Makefile for Apache::File
Writing Makefile for Apache::Leak
Writing Makefile for Apache::Log
Writing Makefile for Apache::ModuleConfig
Writing Makefile for Apache::PerlRunXS
Writing Makefile for Apache::Server
Writing Makefile for Apache::Symbol
Writing Makefile for Apache::Table
Writing Makefile for Apache::URI
Writing Makefile for Apache::Util
invalid top directory at E:/Tools/ActivePerl/lib/File/Find.pm line 279.
Running make test
Make had some problems, maybe interrupted? Won't test
Running make install
Make had some problems, maybe interrupted? Won't install
any help? Thanks,
-Michael
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 1 Sep 2000 12:02:56 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Q. relating to perlfaq(4) / sort
Message-Id: <MPG.14199d3af0f5e6c798ad13@nntp.hpl.hp.com>
In article <m34s4041q9.fsf@dhcp11-177.support.tivoli.com> on 01 Sep 2000
09:37:50 -0500, Ren Maddox <ren.maddox@tivoli.com> says...
> Ren Maddox <ren.maddox@tivoli.com> writes:
>
> > I read through this again (though I didn't go through the slides
> > again), and I didn't see anything about arbitrary length signed
> > "string" numbers. I suppose it would be simple to just make it a
> > two-key sort. Sort by sign, then by magnitude. Throwing in decimal
> > places would, I suppose, necessitate either some clever handling to
> > get the length right, or simply split the fractional portion into a
> > third key.
>
> Silly me... as long as you get the length right (which may be tricky),
> the fractional portion should take care of itself (assuming you stick
> a trailing null in before the original data).
One can use a fixed-width sprintf format for non-negative floating-point
numbers. For an extreme example, sprintf '%40.20f'. But one can more
compactly use binary double-precision (8 bytes), provided the
representation is big-endian (and byte-reversed otherwise). That also
handles signed floating-point numbers. No trailing null is needed,
provided any other sortkeys are also fixed-width.
All this is shown in Appendix B of the paper, including an experiment to
determine endian-ness.
> > Nope, not good enough... negative values need to be reverse sorted by
> > magnitude. Perhaps preprocessing into two lists, one for negative
> > values and one for non-negative values. Sort both lists and then just
> > combine them.
Only one list is necessary.
It is simpler to refer to signed integers, not negative numbers. Signed
32-bit integers can be biased upward (by adding or xoring 1<<31 or
2**31) and then sorted as unsigned 'N'-packed or sprintf-ed integers.
All this is shown in Appendix B of the paper.
http://www.hpl.hp.com/personal/Larry_Rosler/sort/
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 1 Sep 2000 20:56:44 +0200
From: "Tong YANG" <tong@quadrupede.com>
Subject: THE BEST solution to encode Strings after a 3DES crypt ?
Message-Id: <8oou3r$1ttj$1@news4.isdnet.net>
Context : Perl/CGI/HTML
Hi,
I search an idea to encode a string after a 3DES crytage :
I want to submit this string to another CGI-script but 2 problems
appear :
- The result of the crypt looks like #e$%*ům'""'"')°= and it can
be interfer with a HTML tag like this <INPUT ...="##e$%*ům'""'"'"> :
We cannot determine where the TAG finish !
- The CGI module recup the CGI param in it url-encoded form...(like
৭NI&mdlfk
So, I search the perfect solution : I want to transmit the string in
an numeric form, where each chars are converted to a number (hex or long).
Each value of chars is separated by ":" for exemple. So, I cannot
find a Perl function to translate chars -> ascii value. I tried with
pack and unpack but without good results...
the function looks like :
sub a2n {
# receive a string as parameter
.....
# $result looks like "478:145:478:478:445:";
return $result;
}
AND the sub n2a(). ==> the reverse function
Someone have a good idea ?
------------------------------
Date: 1 Sep 2000 21:38:48 GMT
From: Ed Capriola <edcap@netcom2.netcom.com>
Subject: Unidentified Subroutine
Message-Id: <8op7l8$9t4$1@slb7.atl.mindspring.net>
want to set the value in $SS::script to the name of the invoked program. The CGI.pm function script_name() did that untill I tried to use it in a module I created. Can I get the SS.pm to use the CGI.pm function.
Error message:
Undefined subroutine &SS::script_name called at /usr/lib/perl5/5.00503/SS.pm line6. Begin failed--compilation aborted at ./xt line 3.
Command line:
$./xt
File xt:
#!/usr/bin/perl
use CGI qw(:standard :html3);
use SS;
#
file SS.pm
### Set Global Reuseable Variables ###
package SS;
require 5.004;
$SS::revision = 'original try';
$SS::version = '0.0';
$SS::script = script_name();
#
------------------------------
Date: 01 Sep 2000 18:31:21 GMT
From: abigail@foad.org (Abigail)
Subject: Re: working out signatures
Message-Id: <slrn8qvte4.8ac.abigail@alexandra.foad.org>
Paul Eckert (peckert@epicrealm.com) wrote on MMDLVIII September MCMXCIII
in <URL:news:39AFED51.F39B02E@epicrealm.com>:
..
.. > the particular signature im working on is:
.. >
.. > perl -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
.. > for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
.. > print chr 0x$& and q
.. > qq}*excess********}'
.. >
..
.. I dunno.
.. This one seems to be missing things. It doesn't run on my Solaris 2.7 box,
.. either.
That is odd, as it was developed on a Solaris 2.7 box.
.. Are you sure you cut-n-pasted the entire signature? Abigail's are usually
.. flawless.
It's the entire signature and runs fine here (Linux, but there's nothing
system related happening).
Abigail
--
@_=map{[$!++,$_^$/]}split$,,"\@\x7Fy~*kde~box*Zoxf*Bkiaox";$\="\r";
$|=++$*;do{($#,$=)=(rand@_,rand@_);@_[$#,$=]=@_[$=,$#]}for($*..@_);
for$:($|..@_-$|){for($|..@_-$:){@_[$_-$|,$_]=@_[$_=>$_-$*]if$_[$_][
$,]<$_[$_-$*][$,];print+map{$_->[$|]}@_;select$,,$,,$,,0.1}}print$/
------------------------------
Date: Fri, 01 Sep 2000 19:14:25 GMT
From: Paul Eckert <peckert@epicrealm.com>
Subject: Re: working out signatures
Message-Id: <39B00037.BBC064FE@epicrealm.com>
Abigail wrote:
>
> Paul Eckert (peckert@epicrealm.com) wrote
>> Abigail wrote
>> It's the entire signature and runs fine here (Linux, but there's nothing
>> system related happening).
Sigh... After I fixed _my_ typo, it sure 'nuff worked.
--
Paul Eckert
Sr. Software Engineer
Epicrealm Inc.
1651 N. Glenville Dr., Suite 212
Richardson, TX 75081
(972) 479-0135 x300
peckert@epicrealm.com
------------------------------
Date: Fri, 01 Sep 2000 20:48:27 GMT
From: decklin+usenet@red-bean.com (Decklin Foster)
Subject: Re: working out signatures
Message-Id: <vCUr5.6520$CW2.70386@news1.rdc1.ct.home.com>
matt venn <matt@cipherdesign.com> writes:
> perl -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
> for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
> print chr 0x$& and q
> qq}*excess********}'
[BTW, these are called JAPHs]
I decided to work this one out for fun. Some hints:
1. Obviously, know the rules for quoting operators.
2. '**' can mean two different things here.
3. The special variable chosen is not important.
4. Mathematicians probably hate Perl.
Then it's a simple matter of wiping off the cruft, and you can
trivally get rid of the for (well, replace it with something more
readable).
[P.S. Number 4 is important]
--
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)
------------------------------
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 4203
**************************************