[17221] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4643 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 17 14:10:39 2000

Date: Tue, 17 Oct 2000 11: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: <971806222-v9-i4643@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 17 Oct 2000     Volume: 9 Number: 4643

Today's topics:
        mySQL caching <ubl@schaffhausen.de>
    Re: Net::DNS host info (Michael Fuhr)
        new perl can not fine libperl.sl lopez@abqato.abq.sc.philips.com
    Re: new perl can not fine libperl.sl lopez@abqato.abq.sc.philips.com
    Re: Parsing binary files <ajai@netscape.net>
    Re: Passwd Help?? nobull@mail.com
    Re: Perl's open command on unix files <jboes@eomonitor.com>
        Problem with a regular expression (Please Help) (Ken Laird)
    Re: Problem with a regular expression (Please Help) <james@NOSPAM.demon.co.uk>
    Re: question <anmcguire@ce.mediaone.net>
    Re: question <joe+usenet@sunstarsys.com>
    Re: Regex substitution question... (Jerome O'Neil)
    Re: Regex substitution question... nobull@mail.com
    Re: Regex substitution question... (Jerome O'Neil)
    Re: rename not working (Clay Irving)
    Re: rename not working <newsposter@cthulhu.demon.nl>
    Re: sendmail and "cc:" (Clay Irving)
    Re: sendmail and "cc:" <james@NOSPAM.demon.co.uk>
    Re: space <russ_jones@rac.ray.com>
    Re: split problem <godzilla@stomp.stomp.tokyo>
        strange behaviour regular expression (Jens-Uwe Rumstich)
    Re: strange behaviour regular expression (John J. Trammell)
    Re: strange behaviour regular expression <jeffp@crusoe.net>
    Re: strange behaviour regular expression (Tony L. Svanstrom)
    Re: Trouble setting up perl daemon on Linux sbrown5@my-deja.com
        URL History. p_wilver@gasou.edu
    Re: URL History. <james@NOSPAM.demon.co.uk>
    Re: URL History. (Tony L. Svanstrom)
    Re: value exchange of two vars <anmcguire@ce.mediaone.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 17 Oct 2000 17:23:04 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: mySQL caching
Message-Id: <39EC6ED7.B5BA35C9@schaffhausen.de>

Dies ist eine mehrteilige Nachricht im MIME-Format.
--------------4C52FE2B0E851BA096D880DA
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,

if I run a high traffic site with data on it that changes in
intervalls of a week, should I store the data in a memory cache
that lives a long as a mod_perl process with the overhead of
checking (based on the date added) whether the data is still valid
or should I read the data from the database upon every request
using a persistent data connection?

I know I could time this with Benchmark.pm but a cache would be 
rather hard to implement (...considering Mozilla), so I thought
I'd better ask if anyone here had any experience with the topic.

Thanks,

malte
--------------4C52FE2B0E851BA096D880DA
Content-Type: text/x-vcard; charset=us-ascii;
 name="ubl.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Visitenkarte fŸr Malte Ubl
Content-Disposition: attachment;
 filename="ubl.vcf"

begin:vcard 
n:Ubl;Malte
tel;cell:+49 173 9237521
tel;fax:+49 4121 472938
tel;home:+49 4121 438297
tel;work:+49 4121 472964
x-mozilla-html:FALSE
url:http://www.schaffhausen.de
org:Schaffhausen | Interactive
adr:;;Daimlerstrasse 17;Elmshorn;;25337;Germany
version:2.1
email;internet:ubl@schaffhausen.de
title:Developer for web-based applications
x-mozilla-cpt:;1
fn:Malte Ubl
end:vcard

--------------4C52FE2B0E851BA096D880DA--



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

Date: 17 Oct 2000 09:45:01 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Net::DNS host info
Message-Id: <8shs5t$gqo@flatland.dimensional.com>

"Peter Sundstrom" <peter.sundstrom@eds.com> writes:

> I'm using Net::DNS to list a zone and I want to return the data without the
> SOA TTL field.

Actually, each record has its own TTL.  In older versions of BIND, the
"minimum" field in the SOA record was used as a default if the TTL
wasn't specified.  In newer versions of BIND, the $TTL statement in the
zone file sets the default (see RFC 2308).

> The code snippet I'm using is:
>
> foreach my $rr (@zone) {
>         next if ($rr->type !~ /\bA|CNAME\b/);
>
>         my $name = $rr->name;
>         my $class = $rr->class;
>         my $type = $rr->type;
>
>         if ($rr->type eq 'CNAME') {
>                 $data=$rr->cname;
>         }
>         elsif ($rr->type eq 'MX') {
>                 $data=$rr->mx;
>         }
>         else {
>                 $data=$rr->address;
>         }
>
>         push(@hosts,"$name $class $type $data\n");
> }
>
> return @hosts;
>
> This seems like a lot of overkill to do what I want to achieve.  The other
> way I though of doing it was:
>
> foreach my $rr (@zone) {
>     next if ($rr->type !~ /\bA|CNAME\b/);
>
>     my @data=split(' ',$rr->string);
>      push(@hosts,"$data[0] $data[2] $data[3] $data[4]\n");
> }
>
> return @hosts;
>
> That still seems a little messy.  Suggestions for better ways to do it?

The $rr->rdatastr method returns a string representation of the record
data, so you don't need to check each record type.  See if this does
what you want:

foreach my $rr (@zone) {
    next unless $rr->type =~ /^(A|CNAME)$/;
    push (@hosts, join(" ", $rr->name, $rr->class, $rr->type, $rr->rdatastr) . "\n");
}

Hope this helps.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


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

Date: 17 Oct 2000 10:57:10 -0600
From: lopez@abqato.abq.sc.philips.com
Subject: new perl can not fine libperl.sl
Message-Id: <jc64s2b1k49.fsf@abqato.abq.sc.philips.com>

I just built an instance of perl last night on a HPUX server.
This is from the build log:
gnu_sahphpd2[31]% perl -V
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=hpux, osvers=11.00, archname=PA-RISC2.0
    uname='hp-ux sahphpd2 b.11.00 u 9000800 688319363 unlimited-user license '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='gcc', optimize='-O', gccversion=2.95.2 19991024 (release)
    cppflags='-D_HPUX_SOURCE -I/usr/local/include'
    ccflags ='-D_HPUX_SOURCE -I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib/pa1.1 /lib /usr/lib /usr/ccs/lib
    libs=-lnsl -lnm -lndbm -ldld -lm -lc -lndir -lcrypt
    libc=, so=sl, useshrplib=true, libperl=libperl.sl
  Dynamic Linking:
    dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-B,deferred '
    cccdlflags='-fpic', lddlflags='-b -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Built under hpux
  Compiled at Oct 16 2000 19:15:24
  @INC:
    /usr/local/lib/perl5/5.00503/PA-RISC2.0
    /usr/local/lib/perl5/5.00503
    /usr/local/lib/perl5/site_perl/5.005/PA-RISC2.0
    /usr/local/lib/perl5/site_perl/5.005
    .

Now I came in this morning and this is what is happening:
gnu_sahphpd2[40]% perl -V
/usr/lib/dld.sl: Can't open shared library: /usr/local/build/perl-5.005.03/libperl.sl
/usr/lib/dld.sl: No such file or directory
IOT trap (core dumped)

The libperl.sl is really at
/usr/local/lib/perl5/5.00503/PA-RISC2.0/CORE/libperl.sl
where I think it should be.

I do not understand
1) Why the perl is asking dld.sl to look for /usr/local/build/perl-5.005.03/libperl.sl
   which was part of only the build tree which I would think can be now removed.
2) Why the libperl.sl file is no longer in the build tree. I never did a make clean
   and the build log never shows any remove which could account for the disappearance.

Thanks in advance for suggestions on how to fix this.
-- 
Robert.Lopez@Philips.com
Assembly and Test Organization,  Philips Semiconductors
Mail Stop 20,   9201 Pan American Fwy. N.E.,
Albuquerque, New Mexico 87113 USA  [P: (505)822-7112  F: x7237]


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

Date: 17 Oct 2000 11:23:02 -0600
From: lopez@abqato.abq.sc.philips.com
Subject: Re: new perl can not fine libperl.sl
Message-Id: <jc63dhv1ix5.fsf@abqato.abq.sc.philips.com>

lopez@abqato.abq.sc.philips.com writes:
I now see the answer to one of my questions:
> I just built an instance of perl last night on a HPUX server.
> This is from the build log:
> gnu_sahphpd2[31]% perl -V
> Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
>   Platform:
>     osname=hpux, osvers=11.00, archname=PA-RISC2.0
>     uname='hp-ux sahphpd2 b.11.00 u 9000800 688319363 unlimited-user license '
>     hint=recommended, useposix=true, d_sigaction=define
>     usethreads=undef useperlio=undef d_sfio=undef
>   Compiler:
>     cc='gcc', optimize='-O', gccversion=2.95.2 19991024 (release)
>     cppflags='-D_HPUX_SOURCE -I/usr/local/include'
>     ccflags ='-D_HPUX_SOURCE -I/usr/local/include'
>     stdchar='unsigned char', d_stdstdio=define, usevfork=false
>     intsize=4, longsize=4, ptrsize=4, doublesize=8
>     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
>     alignbytes=8, usemymalloc=y, prototype=define
>   Linker and Libraries:
>     ld='ld', ldflags =' -L/usr/local/lib'
>     libpth=/usr/local/lib /lib/pa1.1 /lib /usr/lib /usr/ccs/lib
>     libs=-lnsl -lnm -lndbm -ldld -lm -lc -lndir -lcrypt
>     libc=, so=sl, useshrplib=true, libperl=libperl.sl
>   Dynamic Linking:
>     dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-B,deferred '
>     cccdlflags='-fpic', lddlflags='-b -L/usr/local/lib'
> 
> 
> Characteristics of this binary (from libperl): 
>   Built under hpux
>   Compiled at Oct 16 2000 19:15:24
>   @INC:
>     /usr/local/lib/perl5/5.00503/PA-RISC2.0
>     /usr/local/lib/perl5/5.00503
>     /usr/local/lib/perl5/site_perl/5.005/PA-RISC2.0
>     /usr/local/lib/perl5/site_perl/5.005
>     .
> 
> Now I came in this morning and this is what is happening:
> gnu_sahphpd2[40]% perl -V
> /usr/lib/dld.sl: Can't open shared library: /usr/local/build/perl-5.005.03/libperl.sl
> /usr/lib/dld.sl: No such file or directory
> IOT trap (core dumped)
> 
> The libperl.sl is really at
> /usr/local/lib/perl5/5.00503/PA-RISC2.0/CORE/libperl.sl
> where I think it should be.
> 
> I do not understand
> 1) Why the perl is asking dld.sl to look for /usr/local/build/perl-5.005.03/libperl.sl
>    which was part of only the build tree which I would think can be now removed.
> 2) Why the libperl.sl file is no longer in the build tree. I never did a make clean
>    and the build log never shows any remove which could account for the disappearance.

This is because I renamed the directory in /usr/local/build from
perl-5.005.03 to built-perl-5.005.03 which is a practive I have which
normally helps me instead of causing me problems. So, the only
remaining question is why isn't the
/usr/local/lib/perl5/5.00503/PA-RISC2.0/CORE/libperl.sl
file being referenced?

> 
> Thanks in advance for suggestions on how to fix this.
> -- 
> Robert.Lopez@Philips.com
> Assembly and Test Organization,  Philips Semiconductors
> Mail Stop 20,   9201 Pan American Fwy. N.E.,
> Albuquerque, New Mexico 87113 USA  [P: (505)822-7112  F: x7237]

-- 
Robert.Lopez@Philips.com
Assembly and Test Organization,  Philips Semiconductors
Mail Stop 20,   9201 Pan American Fwy. N.E.,
Albuquerque, New Mexico 87113 USA  [P: (505)822-7112  F: x7237]


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

Date: Tue, 17 Oct 2000 16:57:28 GMT
From: Ajai Khattri <ajai@netscape.net>
Subject: Re: Parsing binary files
Message-Id: <8si0dj$t6v$1@nnrp1.deja.com>

In article <8sg79i$a8r$1@riva.ucam.org>,
  cjw44@flatline.org.uk (Colin Watson) wrote:

> Set the input record separator variable $/ to "\n\n\001\001".

Yes that works. I was initially reading the file as binary data (binmode
and read) and trying to search through it - this is much simpler (which
is how it should be in PERL! ;-) I also was using \000 instead of \001
for ^A - I should know better!

This file has 5 records in it but when I do a count I get 6 records
returned - any ideas?

Some test code:

# open input file
open(ARCHIVE, $input_file) or die "Can't open file: $input_file";

    # record separator
    $/ = "\n\n\001\001";

    $c = 0;
    while (<ARCHIVE>)
    {
	    $c = $c + 1;
    }

    print $c;

Or maybe I should just use $c - 1 ?
--
Aj. (ajai@netscape.net)


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 17 Oct 2000 18:04:01 +0100
From: nobull@mail.com
Subject: Re: Passwd Help??
Message-Id: <u9n1g3xuv2.fsf@wcl-l.bham.ac.uk>

Fraser <r.fraser@student.murdoch.edu.au> writes:

> In Perl, how do you use system information such as "passwd" and
> "getpwnam"

You can use this information however you please.  It depends on what
you want to achieve.  These functions are documented in "perldoc -f
getpwnam".

> and print the info to the screen (stdout)?

The function for printing is print().  Unless you've used select() to
change the output stream it will default to STDOUT.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Tue, 17 Oct 2000 11:47:57 -0400
From: Jeff Boes <jboes@eomonitor.com>
Subject: Re: Perl's open command on unix files
Message-Id: <39ec752a$0$30005$44a10c7e@news.net-link.net>

On Fri, 13 Oct 2000 21:05:59 GMT,
         nandagopalj@hotmail.com <nandagopalj@hotmail.com> wrote:
>
>The following error handler in my PERL script does NOT work.
>
>
>    # Open a handle to the results of the grep
>    if (!(open(GREP_H, "grep a $fileName | grep b |")))
>    {
>        $errorFlag = $FAILURE;
>        print "Attempt to grep in file failed!";
>    }
>
>This does NOT catch the error if $fileName is unreadable.  The 'grep'
>command fails, but the open command returns success.  How do I catch
>this error?

You'll need to test $fileName before you execute the grep system
command, e.g.,

# Test to make sure $fileName is readable

if (!-r $fileName) {
  print "Can't open $filename\n";
} elsif (!open(GREP_H, ...


-- 
Jeff Boes <jboes@eoexchange.com>          Tel:  (616) 381-9889 x.18
Sr. Software Engineer, EoExchange, Inc.   http://www.eoexchange.com/
Search, Monitor, Notify.                  http://www.eomonitor.com/


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

Date: 17 Oct 2000 15:31:17 GMT
From: kenlaird@yahoo.com (Ken Laird)
Subject: Problem with a regular expression (Please Help)
Message-Id: <8shrc5$1noa$1@news4.isdnet.net>

I've got this expression searching thru a file.

chomp($var=<STDIN>);         	getting something
if (/^thing=$var$/) {
print "ok \n";
}


 ...


cat file

blahblah
fdsfdsdsf
thing=something
ddvdsvdffdfd

 ...


I wanna get beginning of thing (^) with end of something ($) ,
it seems to work ,but it looks a bit odd to me.
I'm worried if there could be any exceptions that won't work.
The dollar in the middle worries me , or maybe it's correct ?
How perl tells the difference between both $ ??
I've tried to prepend some \ , but the search won't work.

Would be very grateful to hear any opinion on the subject.

Ken Laird
kenlaird@yahoo.com



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

Date: Tue, 17 Oct 2000 16:52:49 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: Problem with a regular expression (Please Help)
Message-Id: <ant171549927fNdQ@oakseed.demon.co.uk>

In article <8shrc5$1noa$1@news4.isdnet.net>, Ken Laird
<URL:mailto:kenlaird@yahoo.com> wrote:
> I've got this expression searching thru a file.
> 
> chomp($var=<STDIN>);         getting something
> if (/^thing=$var$/) {
> print "ok \n";
> }

I don't see what you want that to do. Your code snippet
gives no clue as to what $_ might contain. Perhaps you
meant to write:

while ($line = <STDIN>) {
    chomp $line; # Probably superfluous
    if ( ($something) = $line =~ /^thing=(.*)$/ ) {
        # Now $something contains the 'something'
    }
}

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Tue, 17 Oct 2000 11:49:23 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: question
Message-Id: <Pine.LNX.4.21.0010171138110.26054-100000@hawk.ce.mediaone.net>

On Tue, 17 Oct 2000, mexicanmeatballs@my-deja.com quoth:

> In article <m37l78p8an.fsf@mumonkan.sunstarsys.com>,
>   Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
> > "Andrew N. McGuire " <anmcguire@ce.mediaone.net> writes:
> >
> > > On Mon, 16 Oct 2000, Jim Mauldin quoth:
> > > JM> Perl's strength arises not from shortcuts that are useful, valid
> but
> > > JM> sometimes obscure (e.g. $.), but from
> > >
> > > I just cant agree that $. is obscure.  That is like saying $?
> > > is obscure.  Both are well documented in perlvar and other places,
> > > they behave as documented, so how can that be obscure?  As I posted
> > > before, the docs even say:
> > >
> > > (Mnemonic: many programs use "." to mean the current line number.)
> 
> Which programs though?

vi and its clones pop to mind immediately.

[ snip ]

> "$." is however harder to read than $INPUT_LINE_NUMBER, surely
> everyone agrees with that? I don't believe that anyone thinks it's
> generally good practice to name variables with punctuation.

Yes, $. is harder to read than $INPUT_LINE_NUMBER.  $/ is harder
to read than $INPUT_RECORD_SEPARATOR, and $@ is harder to read
than $EVAL_ERROR.  All of these statements are true in my eyes,
but only if you qualify them with "at first".  Getting to know
the ${punctuation} variables is part of getting to know Perl.
Getting to know the meanings of \s+, (?=...), etc. is no different
in my eyes.  ( This is all just my loony opinion of course ).

>  The other option is to use FileHandle and lexically scope your
> file handles, thus $. becomes $fh->input_line_number, and you
> can immediately see what it is and which file handle it's
> referring to.
> 
> Harder on the fingers though.

That is another option, yes, and a good one. 

anm
-- 
$ # = "%.6g" ; stat $0 or die $! ;
_ = q.Just another Perl Hacker.  ;
print $ #                        ;
main'_ . v10                     ;



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

Date: 17 Oct 2000 13:44:51 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: question
Message-Id: <m31yxfpdkc.fsf@mumonkan.sunstarsys.com>

mexicanmeatballs@my-deja.com writes:

> In article <m37l78p8an.fsf@mumonkan.sunstarsys.com>,
>   Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
> > "Andrew N. McGuire " <anmcguire@ce.mediaone.net> writes:
> >
> > > On Mon, 16 Oct 2000, Jim Mauldin quoth:
> > > JM> Perl's strength arises not from shortcuts that are useful, valid
> but
> > > JM> sometimes obscure (e.g. $.), but from
> > >
> > > I just cant agree that $. is obscure.  That is like saying $?
> > > is obscure.  Both are well documented in perlvar and other places,
> > > they behave as documented, so how can that be obscure?  As I posted
> > > before, the docs even say:
> > >
> > > (Mnemonic: many programs use "." to mean the current line number.)
> 
> Which programs though?
> 
> > Although my intent was not to imply that $. is "obscure",
> > it is certainly fair to read my statement that way, and
> > post a civil disagreement about such a claim.  You would
> > find in fact that I would fall on your side of that argument,
> > since "." it's part of the heritage of both perl and Unix.
> > And there's lots of good examples of it's use throughout
> > the docs, all I was saying that I wasn't familiar with
> > it (until a few days ago :)
> 
> "$." is however harder to read than $INPUT_LINE_NUMBER, surely
> everyone agrees with that? I don't believe that anyone thinks it's
> generally good practice to name variables with punctuation.
> 

If I may be so bold :), I really think the reason this thread
is/was polarizing is because of an inherent "cultural" bias:
the the word "obscure" carries a strong negative connotation,
so strong that many read my original comments "in reverse" and 
felt that I was making a value judgement on their own replies.
This simply wasn't the case at all - I didn't look at 
what others posted, and kept my opinions to my own code.
"widely used" != "widely known", and for better or worse, my
own usage of the word "obscure" leans toward the former.

Earlier that day, I got some advice from someone else on this
ng that was very valuable, and to restore the cosmic balance
I figured I'd help out with a question I felt reasonable sure
I'd get right.  So a posted a response, saw that OP had later
submitted his code, so I tried to comment on what I saw.  I thought
it would be better to help him fix his own code than simply adopt
mine :). I took a quick look, saw something "peculiar" to me, and 
checked the docs to see what it was.  After reading the description, 
and in consideration of his experience, I didn't feel comfortable 
implicitly endorsing his application of "$.".  So I said what I said,
and figured that would be the end of it.  Admittedly I don't follow
this ng, so I wasn't familiar with the way things "work" here.

Nevertheless I don't feel that I was treated very fairly by the 
welcoming committee. I suppose by now the feeling is mutual; 
the golden rule is a two-edged sword.

>  The other option is to use FileHandle and lexically scope your
> file handles, thus $. becomes $fh->input_line_number, and you
> can immediately see what it is and which file handle it's
> referring to.

I think that's a great suggestion :)

> --
> Jon
> perl -e 'print map {chr(ord($_)-3)} split //, "MrqEdunhuClqdph1frp";'
> 
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.

-- 
Joe Schaefer


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

Date: Tue, 17 Oct 2000 16:28:05 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: Regex substitution question...
Message-Id: <p6%G5.401$Tj6.135122@news.uswest.net>

"Colin Tucker" <ctucker@no.omenmedia.spam.com> elucidates:
>> > No, sorry, but that doesn't help me at all unfortunately.
>>
>> Using common sense always helps me.
>> Why don't you try using some common sense?
> 
> I am, I'm just asking for some help.

This is the right place to ask for Perl help, just not the 
right troll.  Godzilla is a known troll, but beyond that,
you should be aware that everything it posts, without exception,
is wrong.

Good Luck!

-- 
"Civilization rests on two things: the discovery that fermentation 
produces alcohol, and the voluntary ability to inhibit defecation.  
And I put it to you, where would this splendid civilization be without 
both?" --Robertson Davies "The Rebel Angels" 


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

Date: 17 Oct 2000 18:02:03 +0100
From: nobull@mail.com
Subject: Re: Regex substitution question...
Message-Id: <u9pukzxuyc.fsf@wcl-l.bham.ac.uk>

jerome@activeindexing.com (Jerome O'Neil) writes:

> "Colin Tucker" <ctucker@no.omenmedia.spam.com> elucidates:
> >> > No, sorry, but that doesn't help me at all unfortunately.
> >>
> >> Using common sense always helps me.
> >> Why don't you try using some common sense?
> > 
> > I am, I'm just asking for some help.
> 
> This is the right place to ask for Perl help, just not the 
> right troll.  Godzilla is a known troll, but beyond that,
> you should be aware that everything it posts, without exception,
> is wrong.

"Without exception" is quite untrue.  A finite minority of what
Godzilla posts contains good advice.  And some of it is even good
advice that is relevant to the question.  I nearly fell off my chair
the first time I saw a relevant, helpfull and accurate answer from
Godzilla. (Could it be the "infinite number of monkeys" effect?)

Of course the fact remains that almost all of what Godzilla posts is
either:

 1) Factually wrong.

 2) Likely to make your code fail in difficult to debug ways at some
    point in the future.

 3) Addressing a different question from that which was asked.  Or
    sometimes pedantically addressing _precisely_ the question asked
    when clearly from context the question was intented as a example
    of a wider question.

 4) Random ad hominem rantings - a bit like this really.

BTW: NoBull may be frank but is not Frank.

In fairness I must add that Godzilla is not the only one to do (3)
above.  But other people (including myself) do it to punish people who
are too lazy to RTFM/RTFFAQ.  Godzilla does it because she can.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Tue, 17 Oct 2000 17:46:10 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: Regex substitution question...
Message-Id: <Cf0H5.302$h77.195712@news.uswest.net>

nobull@mail.com elucidates:
> jerome@activeindexing.com (Jerome O'Neil) writes:

>> > I am, I'm just asking for some help.
>> 
>> This is the right place to ask for Perl help, just not the 
>> right troll.  Godzilla is a known troll, but beyond that,
>> you should be aware that everything it posts, without exception,
>> is wrong.
> 
> "Without exception" is quite untrue.  A finite minority of what
> Godzilla posts contains good advice.  And some of it is even good
> advice that is relevant to the question.  I nearly fell off my chair
> the first time I saw a relevant, helpfull and accurate answer from
> Godzilla. (Could it be the "infinite number of monkeys" effect?)

Perhaps.  If I ever see something helpfull, relevent, and correct 
from it, I'll certainly fall off my chair, too. 

Until then, "without exception" is my story, and I'm sticking to it.

-- 
"Civilization rests on two things: the discovery that fermentation 
produces alcohol, and the voluntary ability to inhibit defecation.  
And I put it to you, where would this splendid civilization be without 
both?" --Robertson Davies "The Rebel Angels" 


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

Date: 17 Oct 2000 15:14:38 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: rename not working
Message-Id: <slrn8uor6u.45h.clay@panix2.panix.com>

On Tue, 17 Oct 2000 15:46:07 +0100, Mike Dorrel <mdorrel@fsnet.co.uk> wrote:

>The script is running on FreeBSD.
>
>I've tried the following (after searching Deja):
>
>     #!/usr/bin/perl5
>
>     print "Content-type: text/html\n\n";
>
>     use CGI::Carp 'fatalsToBrowser';
>
>     $old= 'text.txt';
>     $new= 'text2.txt';
>
>     rename($old, $new) || die("Cannot rename $old to $new : $!\n");
>
>and get the following response:
>
>     Content-type: text/html
>     Software error:
>     Cannot rename text.txt to text2.txt : Permission denied
>
>I've tried to chmod the script and text.txt files, but the
>script is still not working.
>
>     #!/usr/bin/perl5
>
>     print "Content-type: text/html\n\n";
>
>     use CGI::Carp 'fatalsToBrowser';
>
>     $old= 'text.txt';
>     $new= 'text2.txt';
>
>    rename($old, $new) or system("mv", $old, $new);
>
>and get no response from the browser (clear screen)
>
>Any ideas anyone? I'll be trying to move the file as renaming it,
>later. Will this have any effect on the script?

As a previous person responded:

  rename ($old, $new) or die "Can't rename $old: $!\n";

Also, in the example you posted if the rename was successful what you
you expect to see in a Web browser? 

-- 
Clay Irving <clay@panix.com>
Cheer up -- if the economy collapses completely, you won't owe your
student loan to *anybody*. 


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

Date: 17 Oct 2000 15:17:22 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: rename not working
Message-Id: <8shqi2$53i$1@internal-news.uu.net>

Mike Dorrel <mdorrel@fsnet.co.uk> wrote:

>      rename($old, $new) || die("Cannot rename $old to $new : $!\n");

> and get the following response:

>      Content-type: text/html
>      Software error:
>      Cannot rename text.txt to text2.txt : Permission denied

  As what user is your cgi script running? Does that user have write
permissions for /usr ?

Erik



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

Date: 17 Oct 2000 15:19:14 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: sendmail and "cc:"
Message-Id: <slrn8uorfi.45h.clay@panix2.panix.com>

On Tue, 17 Oct 2000 15:38:24 +0100, JA <jalford12@yahoo.co.uk> wrote:

>I'm trying to use a CC: address with sendmail (Unix of course) from Perl.
>
>I'm piping the mail header and body to sendmail and I cannot find the
>correct syntax and/or case for the cc: mail header label.
>
>Does anyone out there in the Unix world know what this should be ?

Hey, where's the Perl question?

Nonetheless, try:

  man sendmail

Personally, I'd use one of the fine Perl modules like Mail::Send.

  use Mail::Send;

  $msg = new Mail::Send;

  $msg->to('user@host');
  $msg->subject('example subject');
  $msg->cc('user@host');
  $msg->bcc('someone@else');
[...]

-- 
Clay Irving <clay@panix.com>
I went to the hardware store and bought some used paint.  It was in the shape
of a house.  I also bought some batteries, but they weren't included.  So I had
to buy them again.  
- Steven Wright 


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

Date: Tue, 17 Oct 2000 16:19:13 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: sendmail and "cc:"
Message-Id: <ant171513fecfNdQ@oakseed.demon.co.uk>

In article <6xZG5.26793$Kx.2051431@e420r-sjo1.usenetserver.com>, JA
<URL:mailto:jalford12@yahoo.co.uk> wrote:
> I'm piping the mail header and body to sendmail and I cannot find the
> correct syntax and/or case for the cc: mail header label.

RFC822 says (oh no not again) in section 3.4.7 "Case independence"
that header names can be of any case CC, cc, cC, it doesn't matter.
Perhaps your problem is with something else, such as not using
sendmail's -t command line option.

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Tue, 17 Oct 2000 10:26:25 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: space
Message-Id: <39EC6FA1.F34DD8C4@rac.ray.com>

default wrote:
> 
> How much space will 5.6.0 take up on a unix box?

How long is a piece of string?

-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

Quae narravi, nullo modo negabo. - Catullus


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

Date: Tue, 17 Oct 2000 08:43:24 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: split problem
Message-Id: <39EC739C.23A5D024@stomp.stomp.tokyo>

Michael Carman wrote:
 
> [Apologies to the ng for feeding the troll.]
 
> "Godzilla!" wrote:
 
> > Why would I need to justify code which performs
> > with absolute perfection? [...] it performs flawlessly.
 
> What does it do with this line?
 
> 234,tree,"Smith,John",6834
 
> Or this one?
 
> 234,tree,"©Smith, John",6834
 
> These are not "changed parameters," they are perfectly 
> reasonable values to have in the source file.


Those examples are well outside stated
parameters. You have changed the stated
parameters, purposely. You have elected
to tell technological lies to afford 
yourself a chance to spread hatred and,
afford yourself a chance to masturbate
your fragile bruised ego.

Was it good for you?


Godzilla!


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

Date: 17 Oct 2000 16:39:53 GMT
From: rumstich@informatik.hu-berlin.de (Jens-Uwe Rumstich)
Subject: strange behaviour regular expression
Message-Id: <8shvcp$54a$1@hahn.informatik.hu-berlin.de>


Hello!

I have a strange behavior neither I nor the PERL gurus here can explain. Since
this is a VERY important routine, I don't want to have it doing things I
can not explain!

I have a list of Product, which I want to compare with a string. Strangely
the found products change, if I change the list of products!!!

The source in question:

    # compare with all products
    foreach $ProductArray (@$ProductList)
    {
        my $ProductNameStripped = $ProductArray->[0];

        # check, if SearchTextStripped contains ProductName
        print "try \"$ProductNameStripped\". Text =  \"$SearchTextStripped\":  ";
        if ($SearchTextStripped =~ /$ProductNameStripped/g)
        {
            print "found\n";
        } else
        {
            print "not found\n";
        }
    }

If I have as Products the EOS3, EOS300 and EOS3000, I get the following
output:

try "EOS3". Text =  "EOS3000EF2880HERSTELLERCANON":  found
try "EOS300". Text =  "EOS3000EF2880HERSTELLERCANON":  not found   (!!!!)
try "EOS3000". Text =  "EOS3000EF2880HERSTELLERCANON":  found

you see, that usually ALL 3 products should be found here. If I change the
list of products, and add a potential EOS30, I get the following result:

try "EOS3". Text =  "EOS3000EF2880HERSTELLERCANON":  found
try "EOS30". Text =  "EOS3000EF2880HERSTELLERCANON":  not found  (!!!)
try "EOS300". Text =  "EOS3000EF2880HERSTELLERCANON":  found
try "EOS3000". Text =  "EOS3000EF2880HERSTELLERCANON":  not found  (!!!)

you see, that the EOS300, which was not found above, is found now, but it
does not find the EOS30 and not the EOS3000, which was found above.

Now my question is, what possible reasons can be there for this behaviour?
Why does it not find all 4 / 3 products??
If the problem is not in this little piece of code, where else can I look
for? I am using "version 5.005_03 built for i586-linux" on a Suse6.4.

Thanks ahead for your help!

cu
	Jens-Uwe


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

Date: 17 Oct 2000 17:19:31 GMT
From: trammell@nitz.hep.umn.edu (John J. Trammell)
Subject: Re: strange behaviour regular expression
Message-Id: <slrn8uo85o.7gt.trammell@nitz.hep.umn.edu>

On 17 Oct 2000 16:39:53 GMT, Jens-Uwe Rumstich
<rumstich@informatik.hu-berlin.de> wrote:
>
>Hello!
>
>I have a strange behavior neither I nor the PERL gurus here can explain.
>Since this is a VERY important routine, I don't want to have it doing
>things I can not explain!
[snip]
>        if ($SearchTextStripped =~ /$ProductNameStripped/g)
[snip]

What's the 'g' doing there?

-- 
John J. Trammell
johntrammell@yahoo.com


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

Date: Tue, 17 Oct 2000 13:41:30 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: strange behaviour regular expression
Message-Id: <Pine.GSO.4.21.0010171339360.25707-100000@crusoe.crusoe.net>

[posted & mailed]

On Oct 17, Jens-Uwe Rumstich said:

>        if ($SearchTextStripped =~ /$ProductNameStripped/g)

The problem is the /g modifier on your regex:


  $string = "foobar";
  print $string =~ /foo/g ? 1 : 0;  # 1
  print $string =~ /foo/g ? 1 : 0;  # 0
  print $string =~ /foo/g ? 1 : 0;  # 1

The /g modifier will make your next regex on that variable start where the
last match left off.

Remove the /g modifier (as it is quite superfluous here anyway) and all
should be well.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/





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

Date: Tue, 17 Oct 2000 17:43:48 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: strange behaviour regular expression
Message-Id: <1einw1o.4mjvpjirdu6fN%tony@svanstrom.com>

Jens-Uwe Rumstich <rumstich@informatik.hu-berlin.de> wrote:

> I have a strange behavior neither I nor the PERL gurus here can explain. Since
> this is a VERY important routine, I don't want to have it doing things I
> can not explain!

I REALLY want you to TELL me WHAT a "PERL guru" is... 

I mean, people around this neck of usenet might know a thing or two
about perl and Perl, but PERL? What's that?


     /Tony... bored...
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
   on the verge of frenzy - i think my mask of sanity is about to slip
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©99-00 <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: Tue, 17 Oct 2000 14:59:29 GMT
From: sbrown5@my-deja.com
Subject: Re: Trouble setting up perl daemon on Linux
Message-Id: <8shpgc$mfa$1@nnrp1.deja.com>

I found the answer to my own problem, so I'll post it as an F.Y.I to
help anyone else with a similar issue.

In my "scotd" script in /etc/rc.d/init.d I had "daemon scotd" for
starting the daemon, "killproc scotd" for stopping it, etc.

Because I'm running a Perl script, I needed to say:
     daemon "perl /usr/sbin/scotd"
and: killproc "perl /usr/sbin/scotd"

I assume this is because pound-bang support ("#!perl") may not be
initialized yet at the lower run levels that the start/stop script
could be used at, so it requires the full path.

- Scott


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 17 Oct 2000 16:50:31 GMT
From: p_wilver@gasou.edu
Subject: URL History.
Message-Id: <8si00j$sod$1@nnrp1.deja.com>

I'm using perl 5.00501 on UNIX. I have an html page that consists of an
html form submitting feedback by way of a perl cgi script. Because a
person can come to this form from multiple locations, I want to be able
to determine the URL they were at before coming to the html page with
the form on it. $ENV{'HTTP_REFERER'} returns the URL of the form, but, I
want to know the previous URL. Is this possible or do I need to use
javascript ?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 17 Oct 2000 18:37:30 +0100
From: James Taylor <james@NOSPAM.demon.co.uk>
Subject: Re: URL History.
Message-Id: <ant171730d58fNdQ@oakseed.demon.co.uk>

In article <8si00j$sod$1@nnrp1.deja.com>, <URL:mailto:p_wilver@gasou.edu>
wrote:
> to determine the URL they were at before coming to the html page with
> the form on it. $ENV{'HTTP_REFERER'} returns the URL of the form, but,
> I want to know the previous URL.

This is not really a Perl question but what you need to do is get a
CGI script to generate the form so that it can see the true referer (sic).
Preferably the same script to both generate and process the form data.
This is relatively easy to do if you're using CGI.pm.

-- 
James Taylor <james (at) oakseed demon co uk>
PGP key available ID: 3FBE1BF9
Fingerprint: F19D803624ED6FE8 370045159F66FD02



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

Date: Tue, 17 Oct 2000 17:43:46 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: URL History.
Message-Id: <1einvua.15noc5210zl9ugN%tony@svanstrom.com>

<p_wilver@gasou.edu> wrote:

> I'm using perl 5.00501 on UNIX. I have an html page that consists of an
> html form submitting feedback by way of a perl cgi script. Because a
> person can come to this form from multiple locations, I want to be able
> to determine the URL they were at before coming to the html page with
> the form on it. $ENV{'HTTP_REFERER'} returns the URL of the form, but, I
> want to know the previous URL. Is this possible or do I need to use
> javascript ?

1) Not a perl-question, so... comp.infosystems.www.authoring.cgi
2) Nothing that says that referer or any other information must be sent
to the server.
3) A half working solution is to check the referer when the html-page is
downloaded.


     /Tony
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
   on the verge of frenzy - i think my mask of sanity is about to slip
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©99-00 <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: Tue, 17 Oct 2000 10:08:24 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: value exchange of two vars
Message-Id: <Pine.LNX.4.21.0010171007480.26054-100000@hawk.ce.mediaone.net>

On Tue, 17 Oct 2000, Paul quoth:

P> hi
P> 
P> i have heart that there is the possibility to exchange the values of
P> variables in one step.
P> please can anybody tell me how this works?!
P> 
P> many tnx in advance

#!/usr/bin/perl -w
use strict;

my ( $var_a, $var_b ) = ( 1, 2 );
   ( $var_b, $var_a ) = ( $var_a, $var_b );

print "$var_a, $var_b\n";

anm
-- 
$ # = "%.6g" ; stat $0 or die $! ;
_ = q.Just another Perl Hacker.  ;
print $ #                        ;
main'_ . v10                     ;



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

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 4643
**************************************


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