[24044] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 6241 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 10 06:05:42 2004

Date: Wed, 10 Mar 2004 03:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 10 Mar 2004     Volume: 10 Number: 6241

Today's topics:
    Re: $result = system('/usr/bin/cksum TEST.mp3 >&1'); <news@vangee.nl>
    Re: $result = system('/usr/bin/cksum TEST.mp3 >&1'); <vek@station02.ohout.pharmapartners.nl>
    Re: [OT] Rockets Alternative <vetro@online.no>
    Re: How to comment more than one line in Perl? <sammie-nospam@greatergreen.com>
    Re: How to comment more than one line in Perl? (Anno Siegel)
    Re: How to comment more than one line in Perl? <xxala_qumsiehxx@xxyahooxx.com>
    Re: How to comment more than one line in Perl? <sammie-nospam@greatergreen.com>
    Re: How to comment more than one line in Perl? <vetro@online.no>
    Re: How to redirect headers in Perl? <nospam@bigpond.com>
    Re: How to redirect headers in Perl? (Crazy Monkey)
        How to use times? <s020274@cuhk.edu.hk>
    Re: How to use times? <komsbomb@hotmail.com>
    Re: How to use times? <yanoff@NOSPAMMINGyahoo.com>
    Re: How to use times? <krahnj@acm.org>
    Re: How to use times? (Anno Siegel)
    Re: Multiple compares -- TMTOWTDI (Anno Siegel)
    Re: Need help with Undeliverable Emails <jwillmore@remove.adelphia.net>
        Net::SCP::Expect issue <jcall@ellijay.com>
    Re: Net::SCP::Expect issue (Anno Siegel)
    Re: Ordering large files (in perl?) <jurgenex@hotmail.com>
        Perl module for analyzing log files (Krishna Srinivasan)
    Re: Perl module for analyzing log files <jwillmore@remove.adelphia.net>
        Quoting non-numbers <auto87829@hushmail.com>
    Re: Quoting non-numbers <roel-perl@st2x.net>
        regex  <yamini_rajan@nospam.com>
    Re: regex  <mgjv@tradingpost.com.au>
    Re: Rockets Alternative <usenet@morrow.me.uk>
    Re: Rockets Alternative <matternc@comcast.net>
    Re: Rockets Alternative <EvR@compuserve.com>
    Re: storing and accessing a has in a package user@domain.invalid
    Re: storing and accessing a has in a package (Anno Siegel)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 10 Mar 2004 08:14:43 +0100
From: "Ewald van Gemert" <news@vangee.nl>
Subject: Re: $result = system('/usr/bin/cksum TEST.mp3 >&1');
Message-Id: <404ebf11$0$99723$1b2cd167@news.wanadoo.nl>

I did find the answer:

$result = `/usr/bin/cksum TEST.mp3 >&1`

Thank you all for being so kind.
Ewald

"Chris Mattern" <matternc@comcast.net> wrote in message
news:8sqdnTPmZN4IjtPdRVn-tA@comcast.com...
> Ewald van Gemert wrote:
>
> > Hi,
> >
> > I would like to get the output:
> >     1306701436 266 TEST.mp3
> > in the $result string.
> >
> > This doen't work.
> > What does?
> >
> $result="1306701436 266 TEST.mp3";
>
> This seems a trifle simple.  Perhaps you meant to ask
> some other question.
>
>           Chris Mattern




------------------------------

Date: 10 Mar 2004 08:28:21 GMT
From: Villy Kruse <vek@station02.ohout.pharmapartners.nl>
Subject: Re: $result = system('/usr/bin/cksum TEST.mp3 >&1');
Message-Id: <slrnc4tkd5.g2i.vek@station02.ohout.pharmapartners.nl>

On Wed, 10 Mar 2004 08:14:43 +0100,
    Ewald van Gemert <news@vangee.nl> wrote:


> I did find the answer:
>
> $result = `/usr/bin/cksum TEST.mp3 >&1`
>


What exactly is the purpose of >&1.  Redirecting stdout to stdout kind of
doesn't make sense.

Appart from that; sometimes the construct qx(...) or qx/.../ is preferred
over the `...` construct only for the reason that ` and ' may be mixed
up in print, and occasionaly be replaced by some of the other quote
characters by the print formatting software.



Villy


------------------------------

Date: Wed, 10 Mar 2004 09:32:07 +0100
From: Vetle Roeim <vetro@online.no>
Subject: Re: [OT] Rockets Alternative
Message-Id: <m3fzchdrw8.fsf@quimby.dirtyhack.org>

* Ben Morrow
> Quoth "John W. Kennedy" <jwkenne@attglobal.net>:
>> 
>> Assuming that you meant "space vessel", and not "rocket", the answer is 
>> that gravity can be used for certain purposes, under certain conditions, 
>> but you couldn't get anywhere using gravity alone; in general, there is 
>> no known way other than reaction.
>
> Not true. Here is not the place to go into detail, but a large 'sail'
> silvered on one side and black on the other will accelerate due to
> photon pressure. Obviously this will only work in the Solar system, not
> in deep space.

  Just like Count Dookus spacecraft in Star Wars: Episode II! But I
  guess it won't accelerate that fast. Think I saw something about
  that in a documentary on the Discovery Channel once...


-- 
#!/usr/bin/vr


------------------------------

Date: Tue, 9 Mar 2004 16:06:46 -0800
From: "Brad Walton" <sammie-nospam@greatergreen.com>
Subject: Re: How to comment more than one line in Perl?
Message-Id: <RJednannqYG7wdPd4p2dnA@comcast.com>

"cayenne" <chilecayenne@yahoo.com> wrote in message
news:2deb3d1.0403090726.4312cb7f@posting.google.com...
> Hello all,
> I'm trying to learn/debug Perl...and while doing that I'd like to be
> able to comment LARGE, multiple lines of code....

I have been using:

if (0) {
    ... code to be ignored ...
}

Then if you want to execute the 'commented' code, just change the (0) to a
(1). May not be the best solution, but it works for me and it's simple.

Brad




------------------------------

Date: 10 Mar 2004 00:39:38 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How to comment more than one line in Perl?
Message-Id: <c2lo4a$59$3@mamenchi.zrz.TU-Berlin.DE>

Brad Walton <sammie-nospam@greatergreen.com> wrote in comp.lang.perl.misc:
> "cayenne" <chilecayenne@yahoo.com> wrote in message
> news:2deb3d1.0403090726.4312cb7f@posting.google.com...
> > Hello all,
> > I'm trying to learn/debug Perl...and while doing that I'd like to be
> > able to comment LARGE, multiple lines of code....
> 
> I have been using:
> 
> if (0) {
>     ... code to be ignored ...
> }
> 
> Then if you want to execute the 'commented' code, just change the (0) to a
> (1). May not be the best solution, but it works for me and it's simple.

As a variant of this, with an existing "if" you can force a branch for
debugging by saying 

    if ( 1 or (original condition) ) {

or similar.  If "original condition" has a side-effect, it may matter
that it isn't executed.  Debugging is an art...

Anno


------------------------------

Date: Wed, 10 Mar 2004 00:43:42 GMT
From: "Ala Qumsieh" <xxala_qumsiehxx@xxyahooxx.com>
Subject: Re: How to comment more than one line in Perl?
Message-Id: <2xt3c.7836$Xo5.3594@newssvr27.news.prodigy.com>

"Brad Walton" <sammie-nospam@greatergreen.com> wrote in message
news:RJednannqYG7wdPd4p2dnA@comcast.com...
> "cayenne" <chilecayenne@yahoo.com> wrote in message
> news:2deb3d1.0403090726.4312cb7f@posting.google.com...
> > Hello all,
> > I'm trying to learn/debug Perl...and while doing that I'd like to be
> > able to comment LARGE, multiple lines of code....
>
> I have been using:
>
> if (0) {
>     ... code to be ignored ...
> }

Two problems:

1) Minor: this breaks my emacs indentation.
2) Major: this does not comment out any compile-time directives like
'use()'.

> Then if you want to execute the 'commented' code, just change the (0) to a
> (1). May not be the best solution, but it works for me and it's simple.

The solution given in the FAQs is simpler and safer.

--Ala




------------------------------

Date: Tue, 9 Mar 2004 20:54:00 -0800
From: "Brad Walton" <sammie-nospam@greatergreen.com>
Subject: Re: How to comment more than one line in Perl?
Message-Id: <usWdnTMlQur1AtPdRVn-sQ@comcast.com>

> > > Hello all,
> > > I'm trying to learn/debug Perl...and while doing that I'd like to be
> > > able to comment LARGE, multiple lines of code....
> >
> > I have been using:
> >
> > if (0) {
> >     ... code to be ignored ...
> > }
>
> Two problems:
>
> 1) Minor: this breaks my emacs indentation.
> 2) Major: this does not comment out any compile-time directives like
> 'use()'.
>
> > Then if you want to execute the 'commented' code, just change the (0) to
a
> > (1). May not be the best solution, but it works for me and it's simple.
>
> The solution given in the FAQs is simpler and safer.

1) My Perl editor allows mass indentions to keep the code in good form, so
that wasn't an problem for me.. but I could see it being an issue (and an
annoyance).

2) I didn't know that.. thanks!

I was going to say that the perldoc was probably a better solution, but
wanted to give some options to cayenne, and avoid the 'why did you make this
suggestion if you didn't think it was better than perldocs' :)

The one thing I like about my option is you just have to change one number
to comment/uncomment, but I am only using it for code past any 'use'
statements.

Thanks for the feedback, I will definitely keep that in mind for the future.

Brad




------------------------------

Date: Wed, 10 Mar 2004 09:41:46 +0100
From: Vetle Roeim <vetro@online.no>
Subject: Re: How to comment more than one line in Perl?
Message-Id: <m3ad2pdrg5.fsf@quimby.dirtyhack.org>

* chilecayenne@yahoo.com
> Hello all,
> Is there anything similar to the /*...................*/ construct
> where you can comment out large blocks of code traversing multiple
> lines ?

  If you're using GNU Emacs, you can use M-x comment-region (and M-x
  uncomment-region). :)


-- 
#!/usr/bin/vr


------------------------------

Date: Wed, 10 Mar 2004 11:30:32 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: How to redirect headers in Perl?
Message-Id: <9635278.EYNYrsa9u6@GMT-hosting-and-pickle-farming>

Crazy Monkey wrote:

> Hi:
> 
> I am new to Perl.  I need to write a Perl page on the server that
> will do an auto login to a site. I have got the following code.  It
> works for the first page, but on subsequent page, user is prompted for
> credential again.  I suspected the issue has something to do with
> cookies.  I want to pass the header from the secure site to the
> client, but I don't know how to do it.  May be I approached the
> problem the wrong way.  Thanks for the help.
> 

You may need to give the userid/password with each request.
There is a URI syntax for basic authentication shown below.

Try

use LWP::Simple;

my $page1=get("userid:password@www.site.com");

# your processing logic

my $page2=get("userid:password@www.site.com/next");


------------------------------

Date: 9 Mar 2004 18:11:56 -0800
From: wlin98004@hotmail.com (Crazy Monkey)
Subject: Re: How to redirect headers in Perl?
Message-Id: <db81df92.0403091811.c97b8fe@posting.google.com>

Well.  I was able to "jam" the cookie setting into the header and it
did not solve my problem.  I used a tool to look at the request and
the responses.  I see that the cookie is set properly.  What I lack is
the the authorization line?  When I hit the secure site directly and
login properly, I see the following line been sent to the server in
the header on almost all of the my requests.  By the way, the login is
not a web page login, but a Realm login (Windows Pop-up box).
	
Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxx	

	I used the authorization_basic( $user, $password ) in my Perl code,
but the authentication is not sticking.  It works for the page that I
am fetching through the Perl.  By the way, the Perl page is located on
a web server.  It is not on the client machine.
	
	Thanks.
	
	
Crazy Monkey


------------------------------

Date: Wed, 10 Mar 2004 11:20:23 +0800
From: "Tsui Wai-ming" <s020274@cuhk.edu.hk>
Subject: How to use times?
Message-Id: <c2m1hm$188s$1@justice.itsc.cuhk.edu.hk>

I've written a script using 'times' to compute the time needed to execute a
code, but it always gives me 0 seconds.  Could anyone see if my syntax is
wrong?

if ( $choiceA ) {
 $start = ( times )[0];

 if ( $choiceB ) {
  $end = ( times )[0];
  $dur = $end - $start;
  open( IN, ">>time.txt" ) or die( "Cannot open file: $!" );
  print( IN "$dur\t" );
  close( IN ) or die( "Cannot close file: $!" );
 }
}





------------------------------

Date: Wed, 10 Mar 2004 11:58:24 +0800
From: "Koms Bomb" <komsbomb@hotmail.com>
Subject: Re: How to use times?
Message-Id: <c2m3nh$1vopa7$1@ID-165313.news.uni-berlin.de>

> I've written a script using 'times' to compute the time needed to execute
a
> code, but it always gives me 0 seconds.  Could anyone see if my syntax is
> wrong?
>
> if ( $choiceA ) {
>  $start = ( times )[0];
>
>  if ( $choiceB ) {
>   $end = ( times )[0];
>   $dur = $end - $start;
>   open( IN, ">>time.txt" ) or die( "Cannot open file: $!" );
>   print( IN "$dur\t" );
>   close( IN ) or die( "Cannot close file: $!" );
>  }
> }

I guess 'times' is not correct or usable on Win32 platform.


--
Koms Bomb

*****Pardon my poor English*****
---------------------
My TASM homepage, resource for assembly. Tools, articles, links.
http://komsbomb.ols-lab.com




------------------------------

Date: Tue, 09 Mar 2004 23:04:47 -0600
From: S Yanoff <yanoff@NOSPAMMINGyahoo.com>
Subject: Re: How to use times?
Message-Id: <slx3c.60168$LD5.46074@twister.rdc-kc.rr.com>

Tsui Wai-ming wrote:

> I've written a script using 'times' to compute the time needed to execute a
> code, but it always gives me 0 seconds.  Could anyone see if my syntax is
> wrong?

If that's not an option, there are some easy-to-use modules related to 
benchmarking that you can try:

http://search.cpan.org/search?query=benchmark&mode=all

Good luck,
-Scott



------------------------------

Date: Wed, 10 Mar 2004 07:05:27 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: How to use times?
Message-Id: <404EBE0D.E5F8ED3A@acm.org>

Tsui Wai-ming wrote:
> 
> I've written a script using 'times' to compute the time needed to execute a
> code, but it always gives me 0 seconds.  Could anyone see if my syntax is
> wrong?
> 
> if ( $choiceA ) {
>  $start = ( times )[0];
> 
>  if ( $choiceB ) {
>   $end = ( times )[0];
>   $dur = $end - $start;
>   open( IN, ">>time.txt" ) or die( "Cannot open file: $!" );
>   print( IN "$dur\t" );
>   close( IN ) or die( "Cannot close file: $!" );
>  }
> }

times() and time() only have a resolution of one second so it is not
very useful to time a small section of code.  Use the Time::HiRes or
Benchmark modules for that purpose.


John
-- 
use Perl;
program
fulfillment


------------------------------

Date: 10 Mar 2004 09:23:06 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How to use times?
Message-Id: <c2mmpq$k8q$1@mamenchi.zrz.TU-Berlin.DE>

John W. Krahn <krahnj@acm.org> wrote in comp.lang.perl.misc:
> Tsui Wai-ming wrote:
> > 
> > I've written a script using 'times' to compute the time needed to execute a
> > code, but it always gives me 0 seconds.  Could anyone see if my syntax is
> > wrong?
> > 
> > if ( $choiceA ) {
> >  $start = ( times )[0];
> > 
> >  if ( $choiceB ) {
> >   $end = ( times )[0];
> >   $dur = $end - $start;
> >   open( IN, ">>time.txt" ) or die( "Cannot open file: $!" );
> >   print( IN "$dur\t" );
> >   close( IN ) or die( "Cannot close file: $!" );
> >  }
> > }
> 
> times() and time() only have a resolution of one second so it is not
> very useful to time a small section of code.  Use the Time::HiRes or
> Benchmark modules for that purpose.

The resolution of times() is usually better than that, 0.01 s is typical.  
Your argument is still valid.

Anno


------------------------------

Date: 10 Mar 2004 00:33:14 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Multiple compares -- TMTOWTDI
Message-Id: <c2lnoa$59$2@mamenchi.zrz.TU-Berlin.DE>

Matija Papec  <perl@my-header.org> wrote in comp.lang.perl.misc:
> X-Ftn-To: Anno Siegel 
> 
> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
> >> >sub RemoveIrrelevantCodes
> >
> >That is not a good name for a sub.  The caller is interested in what it
> >returns, not what it does to get there.  "select_codes" says the
> 
> Yes, it would be better.
> 
> >> >{$ReturnCode = '';  #Initialize $ReturnCode
> >>   ^^^^^^^^^^^-- do you really need it?
> >
> >It wasn't used (the initialization wasn't) if I remember the original
> 
> I was referring to underlined piece (variable), not to initialization
> itself. Variables like $ReturnCode aren't necessary in such simple code
> since it's used only once for implicit return value at the end of sub.

Quite.  I agreed (which I should have said) and went on to criticize
the comment, under the supposition that the code was somehow justified.

[snip]

> >The initialization should happen at compile time, in my opinion.  I like
> >to use a BEGIN block for the no-longer-bare container block, so
> >
> >    # {{ marks an un-indented block
> >
> >    BEGIN {{
> >    my %err = map ...
> >    sub select_codes {
> >       # Matija's code here
> >    }}
> 
> I'm not sure(uneven brace number?), but shouldn't this be:
>     BEGIN {
>     my %err = map ...
>     sub select_codes {
>       ..
>     }}

Ooh.... that shouldn't have happened.

No, the double braces are intentional, I use them for top-level blocks
I don't want to indent (and remarked so in a comment).  I missed the
closing brace of "sub select_codes {" and that made it unintelligible.
I'm sorry.

> >Compiling a sub in a BEGIN block has no measurable semantic effect :)
> 
> Perhaps, but I would like to have private variables defined more like in
> some other language, this BEGIN block seems like, "hey, we have BEGIN
> already so we could also use it for persistent lexicals!" :))

I have come to like the use of a block (bare or BEGIN) for persistent
lexicals.  A well-defined set of sub's get to share a set of variables
and make up a kind of one-off, anonymous object, if an object is a
set of data with operations to work on it.  All with no extra syntax.

The special case of a single sub with persistent data gets a bit blown
up that way.  Well, that's the price.

If the variables need initialization and we want it at compile time,
a BEGIN block is not so far-fetched.  Otherwise, a bare block will do.
I like to initialize early.  If that is paranoia, it is bred in debugging
sessions where I want to call my routines at any time from anywhere.

Anno



------------------------------

Date: Wed, 10 Mar 2004 03:17:39 -0500
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Need help with Undeliverable Emails
Message-Id: <pan.2004.03.10.08.17.37.220366@remove.adelphia.net>

On Tue, 09 Mar 2004 12:27:42 -0800, Malcolm Dew-Jones wrote:

> James Willmore (jwillmore@remove.adelphia.net) wrote:
> 
> : I mean, if all *you* do is turn taint checking on and 'use : strict',
> then your code isn't as secure as what you think it might be.
> 
> I'm not sure what you mean.
> 
> If that was all the user did then in this case (calling an external
> program) the perl script would die with a warning before it could do
> anything bad - which seems pretty safe.

Consider the following (saved in a file called sendmail.pl): 
--script--
#!/usr/bin/perl -Tw

use strict;

my $sendmail_binary = '/usr/sbin/sendmail -t';

my $to = 'jim@localhost';
my $message = "This is a test\n";

open(SENDMAIL, "| $sendmail_binary")
    or die "Can't send email: $!";
print SENDMAIL <<EOM;
From: $to
To: $to
Subject: test
testing ...
 .

EOM
close SENDMAIL;
--script--

Running the script yields the following message: 
Insecure $ENV{PATH} while running with -T switch at sendmail.pl line 10.

Adding the following line after the line with 'use strict' eliminates the
warning:

$ENV{PATH} = '/bin:/usr/sbin';

The point of the post was simple - you *can't* just turn taint checking on
and expect Perl to magically do your bidding.  There are other steps (like
setting the path ($ENV{PATH}) to a sane value) to be taken to make the
script work and work securely.

Which is why I use a module to do such things as send email.  This issue
of an insecure path doesn't come up - because you're opening a connection
to the MTA - not using a binary.  This is one good reason *not* to use a
system binary to do the work a module can easily do.  And, no worries
about the binary being exploited - because you're not using it :-)  Yes,
the Perl binary can be exploited, but where's the pay off?  It's more of a
payoff to exploit such binaries such as 'ps', 'ls', or ... 'sendmail'.

I also like the fact that *most* Perl email modules (like Net::SMTP)
follow RFC821.  It will tell you exactly what's going on.  And, if you
have a bad address in the email, no waiting for it to bounce.  Since the
MTA will tell you (in most cases) that the address is bad while the script
is trying to send the email.  No waiting :-)

In short, you can do what you will, but I have yet to see a solid reason
*not* to use a Perl module to send email.  Even the issue of using
multiple MX records to send email is shot down by using Net::DNS to do MX
lookups and forming Net::SMTP objects based upon the lookups.  With well
over 2000 modules, you *can* find one (or more) that will work, work well,
and has been tested in production environments - all without using system
commands.  Why use Perl if you're going to use it like any shell?  Or not
take advantage of it's portability?  Try using this script on a Windows
box without open source software installed :-)

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
At no time is freedom of speech more precious than when a man
<hits his thumb with a hammer.   -- Marshall Lumsden 



------------------------------

Date: Tue, 9 Mar 2004 21:40:17 -0500
From: "John Call" <jcall@ellijay.com>
Subject: Net::SCP::Expect issue
Message-Id: <c2lv6h0k2g@enews1.newsguy.com>

I run the code below from two places. One is a command line program that I
run as root and the other is a cgi program through the browser. The was
working just fine through both means until today. It still works from
command line as root but not through cgi. The client says nothing has
changed on their systems but I'm not convinced but I can't find out what's
wrong with this code either.

I have debugged and know it is dying at the '$scpe->scp($args{'file'},
$host);' but verbose isn't returing any information whatsoever to tell me
why it's dying. I suspect that for some reason that it's being asked yes/no
by the box I am connecting to but I have auto_yes turned on (I have seen
this be a little flaky before).

I tried to 'su apache' to see if I could scp from the command line as apache
but the box (redhat) wouldn't let me become user apache. Not sure why.

I didn't see anything in the docs for this module to describe the behavior.
Any help is appreciated.

Thanks,

John Call

---------------------------
sub scp_file {
        my %args = (@_);

        my $scpe = Net::SCP::Expect->new(auto_yes => 1, timeout_auto => 60,
verbose => 1);

        $scpe->login($args{'username'}, $args{'password'}) or
die("<br>Couldn't login to SCP '$args{'username'}', '$args{'password'}'");

        $host = $args{'host'} . ':' . $args{'dir'};

        $scpe->scp($args{'file'}, $host);
}





------------------------------

Date: 10 Mar 2004 08:14:24 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Net::SCP::Expect issue
Message-Id: <c2mip0$i92$1@mamenchi.zrz.TU-Berlin.DE>

John Call <jcall@ellijay.com> wrote in comp.lang.perl.misc:

[...]

> I tried to 'su apache' to see if I could scp from the command line as apache
> but the box (redhat) wouldn't let me become user apache. Not sure why.

Probably because it has no shell.  Give it one for the test, then take
it away again.  

Anno


------------------------------

Date: Wed, 10 Mar 2004 02:50:56 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Ordering large files (in perl?)
Message-Id: <kov3c.35808$rW6.10028@nwrddc03.gnilink.net>

Jim Gibson wrote:
> In article <ffde43bc.0403081722.6fdc2988@posting.google.com>, Oeln
> <ohmy9od@yahoo.com> wrote:
>
>> I've got a large file in which there is one word on each line. I've
>> got to output each word it includes to a new file, in order. I've
>> currently got the following:
[...]
>> In general this is working fine; but if I've got to open a larger
>> file (over 1gb, for example, or even 10 gb..whatever) it fails.
[...]
> Yes. Do not reinvent the wheel. If you are on linux, use the sort
> command. 'man sort'.

And if you are not on Linux then there is still no need to reinvent the
wheel.
Get a good book about algorithms and implement one of the solutions for
sorting files on an external media.
This was a very common task in the old days when 16MB was considered a huge
hard drive and RAM was more expensive than gold.

jue




------------------------------

Date: 9 Mar 2004 22:06:18 -0800
From: krishna@multimediastudio.com (Krishna Srinivasan)
Subject: Perl module for analyzing log files
Message-Id: <361f42ca.0403092206.4c5a295b@posting.google.com>

Am looking for a CPAN Perl Module to analyze an Apache server log
file. I want to read the log file line by line and extract information
(break it into bits). For example the date for a particular referrer
etc. Is there such a module available?

Krishna Srinivasan.


------------------------------

Date: Wed, 10 Mar 2004 03:26:36 -0500
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Perl module for analyzing log files
Message-Id: <pan.2004.03.10.08.26.34.850349@remove.adelphia.net>

On Tue, 09 Mar 2004 22:06:18 -0800, Krishna Srinivasan wrote:

> Am looking for a CPAN Perl Module to analyze an Apache server log
> file. I want to read the log file line by line and extract information
> (break it into bits). For example the date for a particular referrer
> etc. Is there such a module available?

http://search.cpan.org/~akira/Apache-ParseLog-1.02/

hth

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
"We demand rigidly defined areas of doubt and uncertainty!"   -- 
Vroomfondel 



------------------------------

Date: Wed, 10 Mar 2004 21:37:59 +1100
From: "Stevens" <auto87829@hushmail.com>
Subject: Quoting non-numbers
Message-Id: <404ef008$0$8356$afc38c87@news.optusnet.com.au>

Dear all,

I'm trying to create a regular expression that takes a list of space
delimited words and numbers and encloses every non-number within single
quotes.

e.g 1967 foo 3.234 system_analyst 87834/d23434 would be returned as 1967
'foo' 3.234 'system_analyst' '87834/d23434'

I can't get the syntax right ... how could you do this?




------------------------------

Date: 10 Mar 2004 10:49:30 GMT
From: Roel van der Steen <roel-perl@st2x.net>
Subject: Re: Quoting non-numbers
Message-Id: <slrnc4tson.dnh.roel-perl@localhost.localdomain>

On Wed, 10 Mar 2004 at 10:37 GMT, Stevens wrote:
> Dear all,
> 
> I'm trying to create a regular expression that takes a list of space
> delimited words and numbers and encloses every non-number within single
> quotes.
> 
> e.g 1967 foo 3.234 system_analyst 87834/d23434 would be returned as 1967
> 'foo' 3.234 'system_analyst' '87834/d23434'
> 
> I can't get the syntax right ... how could you do this?
> 
> 

#!/usr/bin/perl
use strict;
use warnings;

$_ = '1967 foo 3.234 system_analyst 87834/d23434';
s/(\S+)/'$1'/g;
print $_;


------------------------------

Date: Tue,  9 Mar 2004 22:45:32 -0600
From: "yamini" <yamini_rajan@nospam.com>
Subject: regex 
Message-Id: <13da2dcb5a59c40397587791b515da41@localhost.talkaboutprogramming.com>

hi,
$_="{NP_P}<p>TGF-beta</p>{/NP_P} {VP_act}phosphorylated{/VP_act} {NP_B}<AND><p>EGFR</p>_,_<p>ERK</p>_and_<B>p38MAPK</B></AND>{/NP_B} in {NP}a_<AND><B>PKC-</B>_and_<B>MMP-dependent</B>_manner</AND>{/NP} .";

I have to write a regex that extracts the information within {NP_B}<AND>...</AND>{/NP_B}.I have to validate all the tags(<p>,</p>,<B>,</B>,AND>,</AND) within {NP_B}..{/NP_B}.
Also there may be any no of occurrences of the above said tags within {NP_B}..{/NP_B},and i have to extract all of them.

expected output:
EGFR,ERK,p38MAPK

can anyone help me to get the solution?

thank u for ur time.
     yamini



------------------------------

Date: 10 Mar 2004 05:19:39 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: regex 
Message-Id: <slrnc4t9b9.u52.mgjv@verbruggen.comdyn.com.au>

On Tue,  9 Mar 2004 22:45:32 -0600,
	yamini <yamini_rajan@nospam.com> wrote:
> hi,

> I have to write a regex that extracts the information within
> {NP_B}<AND>...</AND>{/NP_B}.I have to validate all the
> tags(<p>,</p>,<B>,</B>,AND>,</AND) within {NP_B}..{/NP_B}.

You keep asking the same, or similar questions about this data (this
is the third occurrence that I have seen), but you never seem to
suggest that you have actually tried anything yourself.

Read the replies to earlier posts of your about this, implement some
Perl code based on those replies, and then come back with some
specific questions about the bits you have trouble with.

All i have you seen ask for is for other people to write code for you,
and never any acknowledgment that what people posted was in any way
helpful.

I, for my part, will not see any more of your posts.

Martien
-- 
                        | 
Martien Verbruggen      | Freudian slip: when you say one thing but
Trading Post Australia  | mean your mother.
                        | 


------------------------------

Date: Tue, 9 Mar 2004 23:31:23 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Rockets Alternative
Message-Id: <c2lk4b$ma2$1@wisteria.csv.warwick.ac.uk>


Quoth Jim Gibson <jgibson@mail.arc.nasa.gov>:
> In article <c2kl7o$t8t$1@wisteria.csv.warwick.ac.uk>, Ben Morrow
> <usenet@morrow.me.uk> wrote:
> > Quoth "George Kinley" <georgekinley@hotmail.com>:
> > 
> > > Is there any  way  for rockets to fly in space , other then throwing mass
> > > out in one direction and moving in other
> > 
> > Yes.
> 
> Can you give us a patent number or other reference on your
> "reactionless drive", Ben? :)

As I and someone else already said downthread, 'sailing' a photon stream
with a large sheet silver on one side and black on the other. This has
the huge advantage that the power source is entirely external to the
space vessel, giving huge weight savings.

Ben

-- 
   If you put all the prophets,   |   You'd have so much more reason
   Mystics and saints             |   Than ever was born
   In one room together,          |   Out of all of the conflicts of time.
ben@morrow.me.uk                                    The Levellers, 'Believers'


------------------------------

Date: Tue, 09 Mar 2004 18:42:10 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Rockets Alternative
Message-Id: <u9edndlA9-_yy9PdRVn-jA@comcast.com>

Jim Gibson wrote:

> In article <c2kl7o$t8t$1@wisteria.csv.warwick.ac.uk>, Ben Morrow
> <usenet@morrow.me.uk> wrote:
> 
>> Quoth "George Kinley" <georgekinley@hotmail.com>:
>> > Hi
>> > Is there any  way  for rockets to fly in space , other then throwing
>> > mass out in one direction and moving in other
>> 
>> Yes.
>> 
>> Ben
> 
> Can you give us a patent number or other reference on your
> "reactionless drive", Ben? :)

If you can depend on an outside force, you don't need a "reactionless
drive" to get somewhere in space without throwing stuff out the back.
Solar sails, for example.

                       Chris Mattern


------------------------------

Date: Tue, 9 Mar 2004 22:32:13 -0700
From: "Richard A. Evans" <EvR@compuserve.com>
Subject: Re: Rockets Alternative
Message-Id: <c2m98v$df1$1@ngspool-d02.news.aol.com>

> Is there any  way  for rockets to fly in space , other then throwing mass
> out in one direction and moving in other

This question was posed to the Usenet Oracle:

If you drop a buttered piece of bread, it will fall on the floor butter-side
down. If a cat is dropped from a window or other high and towering place, it
will land on its feet.

But what if you attach a buttered piece of bread, butter-side up on a cat's
back and toss them both out the window? Will the cat land on its feet? Or
will the butter splat on the ground?

And in response, thus spoke the Oracle:

Even if you are too lazy to do the experiment yourself you should be able to
deduce the obvious result. The laws of butterology demand that the butter
must hit the ground, and the equally strict laws of feline aerodynamics
demand that the cat can not smash its furry back. If the combined construct
were to land, nature would have no way to resolve this paradox. Therefore it
simply does not fall.

That's right, you clever mortal (well, as clever as a mortal can get), you
have discovered the secret of antigravity! A buttered cat will, when
released, quickly move to a height where the forces of cat-twisting and
butter repulsion are in equilibrium. This equilibrium point can be modified
by scraping off some of the butter, providing lift, or removing some of the
cat's limbs, allowing descent.

Most of the civilized species of the Universe already use this principle to
drive their ships while within a planetary system. The loud humming heard by
most sighters of UFOs is, in fact, the purring of several hundred tabbies.

The one obvious danger is, of course, if the cats manage to eat the bread
off their backs they will instantly plummet. Of course the cats will land on
their feet, but this usually doesn't do them much good, since right after
they make their graceful landing several tons of red-hot starship and pissed
off aliens crash on top of them.




------------------------------

Date: Wed, 10 Mar 2004 11:50:57 +0200
From: user@domain.invalid
Subject: Re: storing and accessing a has in a package
Message-Id: <c2moe6$k6u$1@ctb-nnrp2.saix.net>

True hashes are not ordered and have no "Next" method. All
of those details are taken care of in the package. The hash stores
file names, at least in the original thinking. To avoid memory issues,
file names are no longer stored, a directory handle is used instead.

The "Next" method BTW looks like:

    $nextEntry  = readdir($self->{HOMEDIRHANDE});
    return $nextEntry



------------------------------

Date: 10 Mar 2004 10:25:06 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: storing and accessing a has in a package
Message-Id: <c2mqe2$n8r$1@mamenchi.zrz.TU-Berlin.DE>

 <user@domain.invalid> wrote in comp.lang.perl.misc:

Please leave some context of what you are replying to.

> True hashes are not ordered and have no "Next" method. All
> of those details are taken care of in the package.

That's like saying "Pigs have no wings and cannot fly.  All of those
details are taken care of in the package."

Your original question was about the declaration of a hash.  Now you
tell us the hash is "taken care of" in the package so that it doesn't
behave like a hash at all.  The role it plays in the design is still
unclear.  It is impossible to give advice when the main parts of the
question are missing.

>                                                    The hash stores
> file names, at least in the original thinking. To avoid memory issues,
> file names are no longer stored, a directory handle is used instead.
> 
> The "Next" method BTW looks like:
> 
>     $nextEntry  = readdir($self->{HOMEDIRHANDE});
>     return $nextEntry

So if you are using the directory as a repository of file names, what
is the hash for?  Do you still need it?

Anno


------------------------------

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 V10 Issue 6241
***************************************


home help back first fref pref prev next nref lref last post