[29365] in Perl-Users-Digest
Perl-Users Digest, Issue: 610 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 2 18:54:34 2007
Date: Mon, 2 Jul 2007 13:09:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 2 Jul 2007 Volume: 11 Number: 610
Today's topics:
Re: Asynchronous forking(?) processes on Windows <tbrazil@perforce.com>
Re: Asynchronous forking(?) processes on Windows xhoster@gmail.com
Re: best Excel module <bart.lateur@pandora.be>
Help finding CGI files on Unix server <bassintro@gmail.com>
Re: Help finding CGI files on Unix server <kkeller-usenet@wombat.san-francisco.ca.us>
Re: Help finding CGI files on Unix server <bassintro@gmail.com>
Re: Help finding CGI files on Unix server <glex_no-spam@qwest-spam-no.invalid>
Re: Help finding CGI files on Unix server <bassintro@gmail.com>
Re: Help finding CGI files on Unix server <kkeller-usenet@wombat.san-francisco.ca.us>
Re: Help finding CGI files on Unix server <jurgenex@hotmail.com>
Re: Help finding CGI files on Unix server <ts@dionic.net>
Re: Help finding CGI files on Unix server <glex_no-spam@qwest-spam-no.invalid>
Re: Help finding CGI files on Unix server <bassintro@gmail.com>
Re: Help finding CGI files on Unix server <bassintro@gmail.com>
Re: Portable general timestamp format, not 2038-limited <jwkenne@attglobal.net>
Re: unlurking <bik.mido@tiscalinet.it>
Re: unlurking <bik.mido@tiscalinet.it>
Re: unlurking <peter@makholm.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 02 Jul 2007 11:01:15 -0700
From: Tim <tbrazil@perforce.com>
Subject: Re: Asynchronous forking(?) processes on Windows
Message-Id: <1183399275.852538.121360@j4g2000prf.googlegroups.com>
> > for( $ichild = $nchildren; $ichild > 0; $ichild-- )
> > {
> > pipe RFH, WFH;
>
> > if( $pid =fork) {
> > print "Forked pid $pid.\n";
> > open $rfhs{ $pid }, "<&RFH";
>
> I think it would be better just to use lexicals, then use a simple
> assignment rather than a dup.
>
Hi Xho
I have just finished dancing around my cube and singing your praises.
The foreach statement did indeed fix my problem. Regarding your
recommendation to use lexicals for the filehandles... how would the
open statement look like without using the dup? I guess you can now
tell that I'm a rookie on lexicals. I've mostly used global
filehandles.
Once again.. thanks for the help. Tim
------------------------------
Date: 02 Jul 2007 19:16:48 GMT
From: xhoster@gmail.com
Subject: Re: Asynchronous forking(?) processes on Windows
Message-Id: <20070702151650.694$7w@newsreader.com>
Tim <tbrazil@perforce.com> wrote:
> > > for( $ichild = $nchildren; $ichild > 0; $ichild-- )
> > > {
> > > pipe RFH, WFH;
> >
> > > if( $pid =fork) {
> > > print "Forked pid $pid.\n";
> > > open $rfhs{ $pid }, "<&RFH";
> >
> > I think it would be better just to use lexicals, then use a simple
> > assignment rather than a dup.
> >
>
> Hi Xho
>
> I have just finished dancing around my cube and singing your praises.
> The foreach statement did indeed fix my problem.
Great. It is nice to know that at least some of my experience
translates to windows.
> Regarding your
> recommendation to use lexicals for the filehandles... how would the
> open statement look like without using the dup?
pipe my($RFH, $WFH) or die $!;
if( $pid = fork ) {
print "Forked pid $pid.\n";
$rfhs{ $pid } = $RFH;
As a matter of style, I wouldn't really use caps to name the lexicals $RFH
and $WFH, but I wanted to make the fewest changes to your code.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Mon, 02 Jul 2007 16:45:30 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: best Excel module
Message-Id: <4qai839jjo3e37jujbua53e7399dnj0med@4ax.com>
cartercc@gmail.com wrote:
>I have just
>looked at CPAN and discovered 149 modules for use with Excel
Yet they fall into 2 core groups:
1) Direct manipulation of Excel files, in pure Perl, using
SpreadSheet::Write::Excel and SpreadSheet::ParseExcel
2) Manipulation of Excel through OLE, with Win32::OLE
The other modules are just fluff on top of those.
--
Bart.
------------------------------
Date: Mon, 02 Jul 2007 09:24:40 -0700
From: bassintro <bassintro@gmail.com>
Subject: Help finding CGI files on Unix server
Message-Id: <1183393480.471812.229840@q75g2000hsh.googlegroups.com>
Help!
I need a way to find all the cgi files on my server and simply list
their name and dir.
I have been using the find command...
find . -type f -name '*.*htm*' -exec grep cgi {} \;
However, I need a better way to do this and be more specific. I also
don't want to have to go into each vhost html dir and run this command
everytime.
Anyone have any suggestions and/or comments?
Thanks!
------------------------------
Date: Mon, 2 Jul 2007 10:21:17 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Help finding CGI files on Unix server
Message-Id: <eponl4xk6s.ln2@goaway.wombat.san-francisco.ca.us>
On 2007-07-02, bassintro <bassintro@gmail.com> wrote:
> I need a way to find all the cgi files on my server and simply list
> their name and dir.
>
> I have been using the find command...
> find . -type f -name '*.*htm*' -exec grep cgi {} \;
>
> However, I need a better way to do this and be more specific. I also
> don't want to have to go into each vhost html dir and run this command
> everytime.
>
> Anyone have any suggestions and/or comments?
Post the Perl code that you've tried. Have you looked at File::Find?
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information
------------------------------
Date: Mon, 02 Jul 2007 10:42:46 -0700
From: bassintro <bassintro@gmail.com>
Subject: Re: Help finding CGI files on Unix server
Message-Id: <1183398166.653424.65730@q75g2000hsh.googlegroups.com>
On Jul 2, 1:21 pm, Keith Keller <kkeller-use...@wombat.san-
francisco.ca.us> wrote:
> On 2007-07-02, bassintro <bassin...@gmail.com> wrote:
>
> > I need a way to find all the cgi files on my server and simply list
> > their name and dir.
>
> > I have been using the find command...
> > find . -type f -name '*.*htm*' -exec grep cgi {} \;
>
> > However, I need a better way to do this and be more specific. I also
> > don't want to have to go into each vhost html dir and run this command
> > everytime.
>
> > Anyone have any suggestions and/or comments?
>
> Post the Perl code that you've tried. Have you looked at File::Find?
>
> --keith
>
> --
> kkeller-use...@wombat.san-francisco.ca.us
> (try just my userid to email me)
> AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
> see X- headers for PGP signature information
No I haven't tried to write a script or anything, just used the find
command along with grep so far.
------------------------------
Date: Mon, 02 Jul 2007 12:56:52 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Help finding CGI files on Unix server
Message-Id: <46893c64$0$516$815e3792@news.qwest.net>
bassintro wrote:
> On Jul 2, 1:21 pm, Keith Keller <kkeller-use...@wombat.san-
> francisco.ca.us> wrote:
>> On 2007-07-02, bassintro <bassin...@gmail.com> wrote:
>>
>>> I need a way to find all the cgi files on my server and simply list
>>> their name and dir.
>>> I have been using the find command...
>>> find . -type f -name '*.*htm*' -exec grep cgi {} \;
>>> However, I need a better way to do this and be more specific. I also
>>> don't want to have to go into each vhost html dir and run this command
>>> everytime.
>>> Anyone have any suggestions and/or comments?
>> Post the Perl code that you've tried. Have you looked at File::Find?
>>
>> --keith
> No I haven't tried to write a script or anything, just used the find
> command along with grep so far.
What doesn't that do that you want it to do?
Using File::Find will do essentially the same thing.
You could index all the files and use a search engine, like ht://Dig,
but there's nothing wrong with find and grep.
------------------------------
Date: Mon, 02 Jul 2007 11:03:39 -0700
From: bassintro <bassintro@gmail.com>
Subject: Re: Help finding CGI files on Unix server
Message-Id: <1183399419.808630.303650@q69g2000hsb.googlegroups.com>
On Jul 2, 1:56 pm, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
wrote:
> bassintro wrote:
> > On Jul 2, 1:21 pm, Keith Keller <kkeller-use...@wombat.san-
> > francisco.ca.us> wrote:
> >> On 2007-07-02, bassintro <bassin...@gmail.com> wrote:
>
> >>> I need a way to find all the cgi files on my server and simply list
> >>> their name and dir.
> >>> I have been using the find command...
> >>> find . -type f -name '*.*htm*' -exec grep cgi {} \;
> >>> However, I need a better way to do this and be more specific. I also
> >>> don't want to have to go into each vhost html dir and run this command
> >>> everytime.
> >>> Anyone have any suggestions and/or comments?
> >> Post the Perl code that you've tried. Have you looked at File::Find?
>
> >> --keith
> > No I haven't tried to write a script or anything, just used the find
> > command along with grep so far.
>
> What doesn't that do that you want it to do?
>
> Using File::Find will do essentially the same thing.
>
> You could index all the files and use a search engine, like ht://Dig,
> but there's nothing wrong with find and grep.- Hide quoted text -
>
> - Show quoted text -
I was actually looking for an alternative to running...
find . -type f -name '*.*htm*' -exec grep cgi {} \;
it spits out the results of the cgi. I just want it to list the file
and state what dir it's in, that's all...
------------------------------
Date: Mon, 2 Jul 2007 11:12:07 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Help finding CGI files on Unix server
Message-Id: <oornl4x1ks.ln2@goaway.wombat.san-francisco.ca.us>
On 2007-07-02, bassintro <bassintro@gmail.com> wrote:
>
> No I haven't tried to write a script or anything, just used the find
> command along with grep so far.
find and grep are not Perl. You can try one of the shell groups, or one
of the unix/linux misc groups, as find and grep are not on-topic for this
newsgroup. (They might be offtopic for the shell groups, too; read
their FAQ before posting, so that you don't have to be told where to
post like you were here.)
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information
------------------------------
Date: Mon, 02 Jul 2007 18:20:28 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Help finding CGI files on Unix server
Message-Id: <Mlbii.5946$DM4.4813@trndny06>
bassintro wrote:
> I need a way to find all the cgi files on my server and simply list
> their name and dir.
It might help if you explain what you mean by "cgi files".
I can imagine a number of different definitions of this term, none of which
seems to be a very good one:
CGI is defined by a standard. However I think it's unlikely that you are
refering to the files that are defining this standard.
The term "a foobar file" is often used to describe a file with the extension
"foobar". If this is what you mean then a trivial find would solve your
problem.
The term "a foobar file" is also used very often to describe a file that
contains source code in the foobar programming language. However CGI is not
a programming language, therefore AFAICS this definition is not applicable
in this case.
CGI of course defines an interface. Maybe you mean a program that adheres to
the CGI interface when talking about CGI files? However that is a question
about the behaviour of a program and as we all know the behaviour of a
program cannot be decided because it is of the same complexity as the
halting problem.
Therefore I am a bit baffled as to what do you mean when talking about CGI
files.
jue
------------------------------
Date: Mon, 02 Jul 2007 19:39:17 +0100
From: Tim Southerwood <ts@dionic.net>
Subject: Re: Help finding CGI files on Unix server
Message-Id: <46894655$0$648$5a6aecb4@news.aaisp.net.uk>
bassintro coughed up some electrons that declared:
>
> I was actually looking for an alternative to running...
> find . -type f -name '*.*htm*' -exec grep cgi {} \;
>
> it spits out the results of the cgi. I just want it to list the file
> and state what dir it's in, that's all...
slocate (also called locate) is more efficient in that you pre-index the
filesystem and then search on the index with regexes if you wish.
However, a CGI file does not necessarily end with ".cgi" nor is it always
written in perl, though both statements are common truths.
The definition of a CGI file might be:
a) Wrong, but practical: a file that lives in a path and whose name matches
a pattern that a webserver is configured to serve up as CGI (eg mod_cgi or
mod_fastcgi in Apache).
b) Also dodgey, but more accurate: An executable file (including scripts
with #! notation on line 1, assuming *nix) that emits some sort of output
likely to be of interest to a web server (usually (X)HTML but could be
JPEG, or in fact anything), possibly preceded by some HTTP headers (Apache
assumption probably) and may interact with some environment variables for
obtaining input data (Apache assumed again).
Feck knows what the equivalent "definition" on IIS would be...
Proving (b) is very hard.
OTOH if you *know* your web server only treats files ending in .cgi as CGI
then your find solution, and slocate is valid.
If you like find, then as others suggest, File::Find is the perl native way
to do it, but it's possibly less efficient than find.
Cheers
Tim
------------------------------
Date: Mon, 02 Jul 2007 13:46:23 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Help finding CGI files on Unix server
Message-Id: <468947ff$0$10307$815e3792@news.qwest.net>
bassintro wrote:
> I was actually looking for an alternative to running...
> find . -type f -name '*.*htm*' -exec grep cgi {} \;
Why?
> it spits out the results of the cgi.
No, it prints the results of the grep for the string 'cgi' from the files.
>I just want it to list the file
> and state what dir it's in, that's all...
Maybe "grep -l" is what you're after?
------------------------------
Date: Mon, 02 Jul 2007 18:47:51 -0000
From: bassintro <bassintro@gmail.com>
Subject: Re: Help finding CGI files on Unix server
Message-Id: <1183402071.154974.239920@k79g2000hse.googlegroups.com>
On Jul 2, 2:20 pm, "J=FCrgen Exner" <jurge...@hotmail.com> wrote:
> bassintro wrote:
> > I need a way to find all the cgi files on my server and simply list
> > their name and dir.
>
> It might help if you explain what you mean by "cgi files".
>
> I can imagine a number of different definitions of this term, none of whi=
ch
> seems to be a very good one:
>
> CGI is defined by a standard. However I think it's unlikely that you are
> refering to the files that are defining this standard.
>
> The term "a foobar file" is often used to describe a file with the extens=
ion
> "foobar". If this is what you mean then a trivial find would solve your
> problem.
>
> The term "a foobar file" is also used very often to describe a file that
> contains source code in the foobar programming language. However CGI is n=
ot
> a programming language, therefore AFAICS this definition is not applicable
> in this case.
>
> CGI of course defines an interface. Maybe you mean a program that adheres=
to
> the CGI interface when talking about CGI files? However that is a question
> about the behaviour of a program and as we all know the behaviour of a
> program cannot be decided because it is of the same complexity as the
> halting problem.
>
> Therefore I am a bit baffled as to what do you mean when talking about CGI
> files.
>
> jue
What I mean is I am trying to find executable files that are run on
the server side of a www connection. The extension is partly
irrelevant to my search. The files could be *.pl *.cgi *.htm *.html
etc... However what I am trying to go is find any dynamic type file in
a specific dir like /home/* which has cgi content and output the name
of the file and directory.
It is mostly for security purposes. I am migrating servers and want to
put all cgi content on one server and all basic html static content on
another.
Sorry for the miscommunication...
- Paul
------------------------------
Date: Mon, 02 Jul 2007 18:58:57 -0000
From: bassintro <bassintro@gmail.com>
Subject: Re: Help finding CGI files on Unix server
Message-Id: <1183402737.687176.319920@n60g2000hse.googlegroups.com>
On Jul 2, 2:39 pm, Tim Southerwood <t...@dionic.net> wrote:
> bassintro coughed up some electrons that declared:
>
>
>
> > I was actually looking for an alternative to running...
> > find . -type f -name '*.*htm*' -exec grep cgi {} \;
>
> > it spits out the results of the cgi. I just want it to list the file
> > and state what dir it's in, that's all...
>
> slocate (also called locate) is more efficient in that you pre-index the
> filesystem and then search on the index with regexes if you wish.
>
> However, a CGI file does not necessarily end with ".cgi" nor is it always
> written in perl, though both statements are common truths.
>
> The definition of a CGI file might be:
>
> a) Wrong, but practical: a file that lives in a path and whose name matches
> a pattern that a webserver is configured to serve up as CGI (eg mod_cgi or
> mod_fastcgi in Apache).
>
> b) Also dodgey, but more accurate: An executable file (including scripts
> with #! notation on line 1, assuming *nix) that emits some sort of output
> likely to be of interest to a web server (usually (X)HTML but could be
> JPEG, or in fact anything), possibly preceded by some HTTP headers (Apache
> assumption probably) and may interact with some environment variables for
> obtaining input data (Apache assumed again).
>
> Feck knows what the equivalent "definition" on IIS would be...
>
> Proving (b) is very hard.
>
> OTOH if you *know* your web server only treats files ending in .cgi as CGI
> then your find solution, and slocate is valid.
>
> If you like find, then as others suggest, File::Find is the perl native way
> to do it, but it's possibly less efficient than find.
>
> Cheers
>
> Tim
Im on an HP-UX box and dont have locate or slocate, just basic unix
------------------------------
Date: Mon, 02 Jul 2007 12:27:37 -0400
From: "John W. Kennedy" <jwkenne@attglobal.net>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <ZH9ii.1647$GD2.1116@newsfe12.lga>
Martin Gregorie wrote:
> Roedy Green wrote:
>>
>> To add to the confusion you have GPS, Loran and Julian day also used
>> as scientific times.
> >
> GPS time is UTC time
No it isn't. GPS has never introduced a leap second, and is still on
uncorrected UTC-as-of-1980. However, the GPS signal also includes an
occasional UTC correction figure, so it can be used to obtain UTC.
--
John W. Kennedy
"The first effect of not believing in God is to believe in anything...."
-- Emile Cammaerts, "The Laughing Prophet"
------------------------------
Date: Mon, 02 Jul 2007 19:50:35 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: unlurking
Message-Id: <5mei835npa8k34l23i4slcjb0sg9lla1og@4ax.com>
On Sun, 1 Jul 2007 16:52:42 -0400, "Wade Ward" <invalid@invalid.nyet>
wrote:
>Nope. I thought I was being Superman to get the script to perl.exe. I was
>also unsure whether __END__ was part of the script or a way of saying "stop
>snipping here" on a usenet message. I am still correct that the hash
>character is how to comment in perl, somehow with the complete exception of
>the first line?
Nope, *almost* always and *including* on the first line, where it may
have a special significance to the kernel of some osen.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Mon, 02 Jul 2007 19:49:30 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: unlurking
Message-Id: <djei831iftpuq747pdkcd9jivaeecm8kc1@4ax.com>
On Sun, 1 Jul 2007 15:56:53 -0400, "Wade Ward" <invalid@invalid.nyet>
wrote:
>open my $ofh, '>', 'articles.txt'
> or die "Cannot open articles.txt: $!";
[snip]
>Making matters worse, I can't seem to redirect the output stream using the
>usual >text3.txt . Ideas?
AIUI the script is not supposed to print to STDOUT so that you can
redirect it but to a file with the hardcoded name of 'articles.txt';
you can change that yourself, if you like.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Mon, 02 Jul 2007 18:16:09 +0000
From: Peter Makholm <peter@makholm.net>
Subject: Re: unlurking
Message-Id: <87abuesmc6.fsf@makholm.net>
Michele Dondi <bik.mido@tiscalinet.it> writes:
>>Nope. I thought I was being Superman to get the script to perl.exe. I was
>>also unsure whether __END__ was part of the script or a way of saying "stop
>>snipping here" on a usenet message. I am still correct that the hash
>>character is how to comment in perl, somehow with the complete exception of
>>the first line?
>
> Nope, *almost* always and *including* on the first line, where it may
> have a special significance to the kernel of some osen.
No, the #! line have speciel signicance to perl no matter if the line
have speciel significance to the kernel or not. 'perldoc perlrun'
says:
The #! line is always examined for switches as the line is being
parsed. Thus, if you're on a machine that allows only one argument
with the #! line, or worse, doesn't even recognize the #! line, you
still can get consistent switch behavior regardless of how Perl was
invoked, even if -x was used to find the beginning of the program.
//Makholm
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V11 Issue 610
**************************************