[18744] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 912 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 16 09:05:43 2001

Date: Wed, 16 May 2001 06:05:12 -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: <990018312-v10-i912@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 16 May 2001     Volume: 10 Number: 912

Today's topics:
    Re: HELP: modifying a referenced array from a library s (Bruno Boettcher)
    Re: HELP: modifying a referenced array from a library s (Anno Siegel)
    Re: HELP: modifying a referenced array from a library s (Bruno Boettcher)
    Re: HELP: modifying a referenced array from a library s nobull@mail.com
    Re: HELP: modifying a referenced array from a library s (Anno Siegel)
    Re: Http REFFERER -> IP ADDR (Garry Williams)
    Re: I remember. <jfreeman@tassie.net.au>
        loosing contents of var mirvine@compsoc.com
    Re: loosing contents of var nobull@mail.com
    Re: Measuring the time <godzilla@stomp.stomp.tokyo>
    Re: Measuring the time <karol@imm.org.pl>
    Re: Pattern match headache <bart.lateur@skynet.be>
    Re: Perl Modules (Dennis Schoen)
    Re: Perl Modules (Steven Smolinski)
    Re: Perl Modules <a.v.a@home.nl>
    Re: Perl Modules <bart.lateur@skynet.be>
    Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Eric Bohlman)
    Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Dennis Schoen)
    Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Steven Smolinski)
        regExp question <peter.sogaard@tjgroup.com>
    Re: regExp question (Bernard El-Hagin)
    Re: regExp question <peter.sogaard@tjgroup.com>
    Re: regExp question (Bernard El-Hagin)
    Re: regExp question <peter.sogaard@tjgroup.com>
    Re: static values in a subroutine (Garry Williams)
    Re: Stumped on $?, duplicate output <nospam@hotmail.com>
    Re: To compress and uncompress text files ? <bart.lateur@skynet.be>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 16 May 2001 11:29:15 GMT
From: bboett@erm6.u-strasbg.fr (Bruno Boettcher)
Subject: Re: HELP: modifying a referenced array from a library subroutine...
Message-Id: <9dtoab$rjh$1@news.u-strasbg.fr>

In article <9dtfb4$9v$1@mamenchi.zrz.TU-Berlin.DE>,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>According to Bruno Boettcher <bboett@erm1.u-strasbg.fr>:
>> my @operators = @{$sysressource ->{"operators"}};
>
>Here is where it happens.  This statement places a copy of the array
>referenced by $sysressource ->{operators} in @operators.
darn.... ok!

>This pushes $newuser on the copy, not the original array, which
>is unchanged.  Do
>
>    push @{$sysressource ->{operators}}, $newuser;
>
>and you will find $newuser where you expect to find it.
yup true! thanks!

but now, that lines becomes really long, isn't there a way i could use
temporary references? i tryed the following:
$tempRef = $sysressource ->{operators};

but :
push @{$tempRef}, $newuser;
works again with a temporary copy of the array... :(



-- 
bboett at erm1 dot u-strasbg dot fr
http://erm6.u-strasbg.fr/~bboett
==============================================================
Unsolicited commercial email is NOT welcome at this email address


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

Date: 16 May 2001 11:06:42 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: HELP: modifying a referenced array from a library subroutine...
Message-Id: <9dtn02$9v$3@mamenchi.zrz.TU-Berlin.DE>

According to Bruno Boettcher <bboett@erm1.u-strasbg.fr>:
> In article <9dtfb4$9v$1@mamenchi.zrz.TU-Berlin.DE>,
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> >According to Bruno Boettcher <bboett@erm1.u-strasbg.fr>:
> >> my @operators = @{$sysressource ->{"operators"}};
> >
> >Here is where it happens.  This statement places a copy of the array
> >referenced by $sysressource ->{operators} in @operators.
> darn.... ok!
> 
> >This pushes $newuser on the copy, not the original array, which
> >is unchanged.  Do
> >
> >    push @{$sysressource ->{operators}}, $newuser;
> >
> >and you will find $newuser where you expect to find it.
> yup true! thanks!
> 
> but now, that lines becomes really long, isn't there a way i could use
> temporary references? i tryed the following:
> $tempRef = $sysressource ->{operators};
> 
> but :
> push @{$tempRef}, $newuser;
> works again with a temporary copy of the array... :(

What makes you think so?  $tempRef refers to the same anonymous
(or even named) array as $sysressource ->{operators}.  Have you
tried it?

Anno


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

Date: 16 May 2001 12:50:03 GMT
From: bboett@erm6.u-strasbg.fr (Bruno Boettcher)
Subject: Re: HELP: modifying a referenced array from a library subroutine...
Message-Id: <9dtt1r$sgj$1@news.u-strasbg.fr>

In article <9dtn02$9v$3@mamenchi.zrz.TU-Berlin.DE>,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>According to Bruno Boettcher <bboett@erm1.u-strasbg.fr>:
>What makes you think so?  $tempRef refers to the same anonymous
>(or even named) array as $sysressource ->{operators}.  Have you
>tried it?

yup! i tryed it :D and it didn't worked.... :(
as sayd a copy was made....
-- 
bboett at erm1 dot u-strasbg dot fr
http://erm6.u-strasbg.fr/~bboett
==============================================================
Unsolicited commercial email is NOT welcome at this email address


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

Date: 16 May 2001 12:53:32 +0100
From: nobull@mail.com
Subject: Re: HELP: modifying a referenced array from a library subroutine...
Message-Id: <u9lmnxy0g3.fsf@wcl-l.bham.ac.uk>

bboett@erm6.u-strasbg.fr (Bruno Boettcher) writes:

> In article <9dtn02$9v$3@mamenchi.zrz.TU-Berlin.DE>,
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> >According to Bruno Boettcher <bboett@erm1.u-strasbg.fr>:
> >What makes you think so?  $tempRef refers to the same anonymous
> >(or even named) array as $sysressource ->{operators}.  Have you
> >tried it?
> 
> yup! i tryed it :D and it didn't worked.... :(
> as sayd a copy was made....

If that is true then what you tried, and what you showed us were not
the same.

The code you showed us does not act on a copy of the array.  Please
show us the code you tried.  Also show how you arrived at the
conclusion that a copy was made.

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


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

Date: 16 May 2001 12:30:38 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: HELP: modifying a referenced array from a library subroutine...
Message-Id: <9dtrte$aek$1@mamenchi.zrz.TU-Berlin.DE>

According to Bruno Boettcher <bboett@erm1.u-strasbg.fr>:
> In article <9dtn02$9v$3@mamenchi.zrz.TU-Berlin.DE>,
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> >According to Bruno Boettcher <bboett@erm1.u-strasbg.fr>:
> >What makes you think so?  $tempRef refers to the same anonymous
> >(or even named) array as $sysressource ->{operators}.  Have you
> >tried it?
> 
> yup! i tryed it :D and it didn't worked.... :(
> as sayd a copy was made....

Then please show your code.  The method I suggested works fine for me.

Anno


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

Date: Wed, 16 May 2001 12:31:12 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Http REFFERER -> IP ADDR
Message-Id: <slrn9g4sog.54e.garry@zfw.zvolve.net>

On Tue, 15 May 2001 23:30:06 -0400, James Richardson
<time4tea@monmouth.com> wrote:

> If I have followed a link from my internal web site, IP address 198.192.0.10
> to any external website, the value for HTTP_REFERER will be my own web site,
> which is not a valid external IP address.... 

198.192.0.10 is a perfectly valid "external IP address", although it
doesn't appear to be currently assigned.  

Maybe you were thinking of 192.168.0.0/16 addresses?  

-- 
Garry Williams


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

Date: Wed, 16 May 2001 21:06:12 +1000
From: James freeman <jfreeman@tassie.net.au>
Subject: Re: I remember.
Message-Id: <3B025F24.1F0317CE@tassie.net.au>

smash wrote:

> Using another computer the first time I sent a message here it sent me an
> email.
>
> I was wondering if anyone had the thing to do that.
>
> Because there is a group where I am basically the only one who posts answers
> and I can't help people because they don't follow a proper format.

A welcome message is a good idea. Spam is not. This script will work on your
local box. You will need netscape and sendmail to use it essentially as is, or a
bit of recoding if you want to use Outlook Express (which generated your post
:-) You will need to hunt down a Win 32 port of sendmail if you want to run it
under win32. Try http://www.indigostar.com

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

my (%old, @all, @new, @welcome);
my $path = '/netscape/users/jfreeman/news';
my $snm = 'comp.lang.perl.misc.snm';
my $old_posters = 'old_posters.txt';
my $welcome = 'welcome.txt';
my $mail_prog = '/usr/lib/sendmail';
my $reply_to = 'nobody@noreply.org';
my $from = 'The xyz list guru';
my $subject = 'Welcome to xyz widget list';

&get_old_posters;
&get_all_posters;
&find_new_posters;
if (@new) {
    &get_welcome;
    &mail_new_posters;
    &rewrite_old_posters;
}
for (@new) {print " Emailed: $_\n";}
exit;

sub get_old_posters {
    return unless -e "$path/$old_posters";
    open (FILE, "<$path/$old_posters") || die "Unable to open
$path/$old_posters: $!\n";
    while (<FILE>) {chomp; $old{$_} = 1;}
    close FILE;
}
sub get_all_posters {
    local $/;
    undef $/;
    open (FILE, "<$path/$snm")|| die "Unable to open $path/$snm: $!\n";
    binmode FILE;
    $_ = <FILE>;
    close FILE;
    while (/<([\w\.]+?@[\w\.]+?)>/g) {
        next if $1 =~
/(?:no)?spam|no-?reply|junk-?mail|munge|anonymous|nobody|nowhere/i;
        push @all, $1;
    }
}
sub find_new_posters {
    for (@all) {
        push @new, $_ unless defined($old{$_});
    }
}
sub get_welcome {
    open (FILE, "<$path/$welcome")|| die "Unable to open $path/$welcome: $!\n";
    @welcome = <FILE>;
    close FILE;
}
sub mail_new_posters {
    for (@new) {
        next if /^\s*$/;
        open ('MAIL', "|$mail_prog -t");
        print MAIL "To: $_\n";
        print MAIL "Reply-to: $reply_to\n";
        print MAIL "From: $from\n";
        print MAIL "Subject: $subject\n";
        print MAIL "\n\n";
        for (@welcome) {print MAIL $_;}
        print MAIL "\n\n";
        close MAIL;
        $old{$_} = 1; # flag user in old hash as they have recieved the message
    }
}
sub rewrite_old_posters {
    open (FILE, ">$path/$old_posters") || die "Unable to write
$path/$old_posters: $!\n";
    for (keys %old) {print FILE "$_\n";}
    close FILE;
}

=head1 Name

Mail to New Posters V0.01

=head1 Author

(c) Dr James Freeman 2000-01 E<lt>jfreeman@tassie.net.auE<gt> All rights
reserved.

This package is free software and is provided ``as is'' without express or
implied warranty. It may be used, redistributed and/or modified under the terms
of the Perl Artistic License (see http://www.perl.com/perl/misc/Artistic.html)

=head1 Function

This is a stand alone 'Welcome' program. Using a Netscape .snm file as its core
data source it strips out email adresses and checks its database to see if
these email addresses are known to it. If a new email address is found are it
emails a one time welcome message and adds the address to the database. Email
addresses containing keywords such as nospam, nobody, nowhere, etc are ignored.

=head1 Configuration

Point the config variables in the right direction, write a welcome file and
drop it in the same directory as the the mail.snf file. Batch it to run
periodically.

Windows users will need a functioing version of Sendmail. Outlook Express users
will need Netscape 4+. Dare to be different. Discover the diference.

=cut.



--
################################################################
#                                                              #
#        A Thought on Perl Poetry and the Immortal JAPH        #
#                                                              #
#  I, require strict* and do not require warnings*. My answer  #
#  equals reference you unless answer equals 42. Question: If  #
#  defined, by this paradigm, do you do, the hacker foo?  Now  #
#  join the data (why Fs & Os?), so the space or newline goes  #
#  Character evaluate: Reverse split null, then for each foo:  #
#  You ate foo, but I ate two. Answer -> Join with null, sort  #
#  the spots, and print it join the dots. Go now and exit, do  #
#  not die, else go to question and answer why? JAPH! (c)JADF  #
#                                                              #
################################################################

I, require strict and do(not require warnings); my $answer = \$u
unless $answer == '42'; Question: if(defined by this_paradigm do
you_do_the_hacker_foo(??)){sub AUTOLOAD{$_=$now=join'the',<DATA>
;y?FO?01?; s.o|the| |\n..goe;s/(.{7})/(chr(eval'($u,$ate)=(0,1);
foreach $foo(reverse split "",$1){$u+=$ate*$foo;$but_I=$ate*=2;}
$$answer'))/eg;$_= join'',sort/(..)/g and print join'',/.(.)/go;
$now and exit, do(not die)}}else{goto Question and $answer;y???}
 __DATA__

OOFFOOOOOFOO      OFOO       OOFFFOOOFFO    FOOO    FFOO    OFFO
FFFOOFOOOFOF    OFFFFOOF     OFFFOOFOOOOO   OFOO    FOFO    FFFF
    FOOO      FOOF    OOFO   FOOO    OFOF   OOOO    FFOF    OOOF
    OFOF      OOFO    FFFO   OFFF    OOOO   OFFO    OOOF    FFFO
    OFFO      FOFOOOFFOFFO   FFFFFOOOFOFF   OOFFFFOOOFFO    FFOO
    OFOF      FOOFFOFOFOFF   FFFOOFFOOFO    FFFFFOOOOFOF    OOOF
    FFOO      OOOF    FFOO   OFOO           FFOO    OFFF    FOOO
FF  OFOO      FOOO    OOOF   FOFO           OOFO    OFFO
OOFFOFOO      FFFO    FOOO   FOFO           OOFO    FFOO    OOFO
 FFOOOF       OOOO    OFFO   FOOO           OOFF    OFOF    FFFO




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

Date: 16 May 2001 11:57:01 GMT
From: mirvine@compsoc.com
Subject: loosing contents of var
Message-Id: <9dtpud$tjk$1@news.netmar.com>

Hi,

I'm running the following extract of code as part of a larger script. It works
fine under windows 
(windows95,apache1.3.17 for cgi etc.). But when I move it to a unix server
(aix4.3,netscape enterprise server 3.6)
if fails. For some reason, the variable $testernos gets lost?? 

------8<--------------
sub total_dt{

    my ($start_time,$end_time,@testernos)=@_;
   
    my @with_quotes;
    foreach my $tester (@testernos){
         push(@with_quotes,"'".$tester."'");
    }
 
    my $testernos = join ",",@with_quotes;
  
    my $query = qq`SELECT sum(pdmdt_f),sum(mdt_f) FROM $table WHERE TESTERNO
IN ($testernos)
        and TIMESTAMP > '$start_time'
        and TIMESTAMP < '$end_time'
        and NAME like 'Total%'`;
        #die "query: $query";    # <--------  <----------- <------------

    my $sth = $dbh->prepare($query)  or die "$!.\nQUERY=$query\n";
    $sth->execute() or die "$!.\nQUERY=$query";

    while((my @row)=$sth->fetchrow_array()){
         #blah
    }
    #blah ...
------8<--------------

If I run the script with #die "query: $query";    # <-------- 
uncommented, I see that $testernos is evaluated correctly when $query 
is given a value. Seems ok. 

------8<--------------
query: SELECT sum(pdmdt_f),sum(mdt_f) FROM SPCINST.WORK_COMPLETED2 WHERE
TESTERNO IN
('M1E510','M1F518','M1F519')
and TIMESTAMP > '2001-05-16-08.00.00.000000' 
and TIMESTAMP < '2001-05-17-08.00.00.000000' 
and NAME like 'Total%' at
/home/irvinema/public_html/cgi/maintdb/leadtech.cgi line 504. 

------8<--------------

BUT, if I run the script with #die "query: $query";    # <-------- 
commented, the script dies on the $sth->execute() line, and it looks as
though
no value was assigned to $testernos??


------8<--------------

No such file or directory. QUERY=SELECT sum(pdmdt_f),sum(mdt_f) FROM
SPCINST.WORK_COMPLETED2
WHERE TESTERNO IN ()
and TIMESTAMP > '2001-05-16-08.00.00.000000' 
and TIMESTAMP < '2001-05-17-08.00.00.000000' 
and NAME like 'Total%' at
/home/irvinema/public_html/cgi/maintdb/leadtech.cgi line 506. 
------8<--------------

I thought that maybe this was a question of variable scope, but I really don't
see how.
Does anybody else find this strange? Any ideas on how I might get around
this?

One more note, there is a problem with the locale settings on the server, and
perl usually 
prints a warning about falling back to the standard locale 'C'.
I read in the documentation that this could cause problems with features that
depend on locale
settings. I don't know if that is relevant, but it might be.

On windows I'm running perl 5.6, and on aix server I'm running perl 5.005_03.
I'm also using DBI-1.14, and dbd-db2-0.74 for database connection to DB2 UDB
6.1.

Thanks,
Mark Irvine

 -----  Posted via NewsOne.Net: Free (anonymous) Usenet News via the Web  -----
  http://newsone.net/ -- Free reading and anonymous posting to 60,000+ groups
   NewsOne.Net prohibits users from posting spam.  If this or other posts
made through NewsOne.Net violate posting guidelines, email abuse@newsone.net


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

Date: 16 May 2001 13:05:23 +0100
From: nobull@mail.com
Subject: Re: loosing contents of var
Message-Id: <u9itj1xypv.fsf@wcl-l.bham.ac.uk>

mirvine@compsoc.com writes:

>     my $sth = $dbh->prepare($query)  or die "$!.\nQUERY=$query\n";

The DBI prepare() method does not return its error status in $!.

To find out what is wrong with the SQL in $query look at
$dbh->errstr().

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


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

Date: Wed, 16 May 2001 03:17:59 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Measuring the time
Message-Id: <3B0253D7.4E7B4A04@stomp.stomp.tokyo>

nobull@mail.com wrote:

(snipped)

> FAQ: "How can I measure time under a second?"
 
> You must[1] read the FAQ _before_ you post.
 
> [1] As a reaction to the band of assholes who seem intent on
> disrupting any attempt to produce clear and concise posting
> guidelines to help people like Karol....


Would you like those of us who voice an opinion
different than yours, to stitch a Star Of David
upon our clothing in a clearly visible place?

Godzilla!


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

Date: Wed, 16 May 2001 12:26:42 +0200
From: "Karol Nowakowski" <karol@imm.org.pl>
Subject: Re: Measuring the time
Message-Id: <3b025559$1@news.home.net.pl>

I'm not taking this as an attac, but You could be a bit more delicate.
Thank You, I've found this in FAQ.

Best Regards,
Charles




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

Date: Wed, 16 May 2001 12:00:33 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Pattern match headache
Message-Id: <5vq4gt8jtl9kfkjat5131j0o3pcj82cbvj@4ax.com>

Anno Siegel wrote:

>> >if ( $word  =~ / ^\+.* / )   { etc..}
>
>I believe the OP put the spaces in deliberately in an attempt to
>make the pattern match "words".

	/( |^)\+.*/

>This fails in multiple ways, partly
>because of the greediness of ".*"

	/( |^)\+\S*/

Don't we want to capture something, too?

	/(?: |^)(\+\S*)/

There. Check out $1.

-- 
	Bart.


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

Date: Wed, 16 May 2001 10:24:05 GMT
From: dennis@cobolt.net (Dennis Schoen)
Subject: Re: Perl Modules
Message-Id: <slrn9g4la4.3qf.dennis@smart.cobolt.net>

On Wed, 16 May 2001 17:47:05 +0800, yungp <yungp@netvigator.com> wrote:
> Hi,
> 
> I am a newbie at this Perl programming.  Recently, I have been trying to
> install some Perl scripts, which I found on my RedHat Linux 6.2.
> 
> I tried to execute the script and I get an error like this:
> 
> Can't locate LWP/UserAgent.pm in @INC (@INC contains:
> /usr/lib/perl5/5.00503/i38
> 6-linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux
> /usr/li
> b/perl5/site_perl/5.005 .) at ./swishspider line 3.
> 
> I have found 5 lines in the script that show the following:
> 
>  use LWP::UserAgent;
> use LWP::RobotUA;
> use HTTP::Request;
> use HTTP::Status;
> use HTML::LinkExtor;
> 
> Do I just need to install the Perl Modules of LWP, HTTP and HTML for this?
Yes! Welcome to the world of PERL.

> Is there any possible version conflict that I should be aware of?
If you use the CPAN Module it should handle everything for you :)

try: perl -MCPAN -e shell

and then "install LWP::UserAgent" for example.

HTH Dennis
-- 
"The Idea Is Good But The World Isn't Ready Yet"
                    -
    Tocotronic f(The Hamburg Years - 1998)


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

Date: Wed, 16 May 2001 11:15:15 GMT
From: steven.smolinski@sympatico.ca (Steven Smolinski)
Subject: Re: Perl Modules
Message-Id: <slrn9g4tma.im.steven.smolinski@ragnar.stevens.gulch>

Dennis Schoen <dennis@cobolt.net> wrote:
> On Wed, 16 May 2001 17:47:05 +0800, yungp <yungp@netvigator.com> wrote:

> > I have found 5 lines in the script that show the following:
> >  use LWP::UserAgent;
> > use LWP::RobotUA;
> > use HTTP::Request;
> > use HTTP::Status;
> > use HTML::LinkExtor;
> > 
> > Do I just need to install the Perl Modules of LWP, HTTP and HTML for this?
>
> Yes! Welcome to the world of PERL.

(That's Perl, not PERL.  See perlfaq1.)

> > Is there any possible version conflict that I should be aware of?
>
> If you use the CPAN Module it should handle everything for you :)
> try: perl -MCPAN -e shell
> and then "install LWP::UserAgent" for example.

Although, to save yourself typing, I suggest you install the whole lwp
bundle.  At the CPAN shell,

install Bundle::LWP

That gives you a whole host of great networking modules.

Steve
-- 
Steven Smolinski => http://www.steven.cx/


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

Date: Wed, 16 May 2001 11:40:48 GMT
From: AvA <a.v.a@home.nl>
Subject: Re: Perl Modules
Message-Id: <3B023F54.A21E0C24@home.nl>

yungp wrote:

> Hi,
>
> I am a newbie at this Perl programming.  Recently, I have been trying to
> install some Perl scripts, which I found on my RedHat Linux 6.2.
>
> I tried to execute the script and I get an error like this:
>
> Can't locate LWP/UserAgent.pm in @INC (@INC contains:
> /usr/lib/perl5/5.00503/i38
> 6-linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux
> /usr/li
> b/perl5/site_perl/5.005 .) at ./swishspider line 3.
>
> I have found 5 lines in the script that show the following:
>
>  use LWP::UserAgent;
> use LWP::RobotUA;
> use HTTP::Request;
> use HTTP::Status;
> use HTML::LinkExtor;
>
> Do I just need to install the Perl Modules of LWP, HTTP and HTML for this?
> Is there any possible version conflict that I should be aware of?
>
> Thanks
>
> Peter

yes you need to install them modules, if u install them correctly then u
shouldnt
have any problems atall



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

Date: Wed, 16 May 2001 12:28:01 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl Modules
Message-Id: <bds4gt4iiv1qj1ucsi62jc6jqo40o7hjbn@4ax.com>

yungp wrote:

>I have found 5 lines in the script that show the following:
>
> use LWP::UserAgent;
>use LWP::RobotUA;
>use HTTP::Request;
>use HTTP::Status;
>use HTML::LinkExtor;
>
>Do I just need to install the Perl Modules of LWP, HTTP and HTML for this?

If you do a search for these modules on CPAN (<http://search.cpan.org>)
then you'll see what packages you're supposed to install.

It turns out that the first 4 are part of the libwww-perl distribution
(<http://search.cpan.org/search?dist=libwww-perl>), and the last one,
HTML::Parser (<http://search.cpan.org/search?dist=HTML-Parser>).

-- 
	Bart.


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

Date: 16 May 2001 11:00:37 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <9dtmkl$4oi$1@bob.news.rcn.net>

Steven Smolinski <steven.smolinski@sympatico.ca> wrote:
> I don't think it makes the authors look foolish if they use the term
> properly, i.e., within a conditional.  "*If* you wish to retain the interest
> of the regulars, you must do x."

> That is how terms like "must" and "shall" are interpreted in polite
> company.  For instance, the RFC's rules *must* be followed *if* one is
> to build a complying implementation.  Noone wails that the RFCs are
> being overly authoritarian about their topics.  They are stating
> conditional facts.

That's because people who read RFCs generally do so with enough background 
knowledge to know that "must" is being used in a very precise, conditional 
sense.  That's knowledge, not intelligence; it comes from experience.  You 
can use very abbreviated language when you know that your readers share a 
common background.

The problem is that when you have a document that's intended to help 
orient people who are new to a field or subculture, you can't assume much 
background.  You're writing for outsiders, not insiders.  And in most 
common human discourse, "must" is an extremely strong word.  Most people 
don't read English the way geeks read formal languages like math notation 
or programming languages (a lot of geek humor is based on pretending to do 
such a reading).

In particular, words and phrases in human language don't just have
denotations (their literal meanings); they also have connotations
(associated "baggage").  Bergen Evans pointed out that if you're a paint
manufacturer looking for a name for a particular color of off-white
furniture enamel, both "old ivory" and "pale custard" accurately *denote*
the color, but the *connotations* of the former are desirable when you're
talking about enamel, whereas the connotations of the latter aren't.  In 
all but formal technical discourse, "must" has rather "bossy" 
connotations, even though all it *denotes* is a logical conditional.

Therefore, MHO is that if an orientation document is going to use "must" 
in its purely logical sense, it needs to spell that out at the beginning.  
I think that's part of the orientation itself; you need to let people know 
that this group contains a great deal of formal, technical discourse and 
that certain words, like "must," have special meanings in that sort of 
discourse and that they shouldn't be put off by it.

> And so it is here.  *If* you want Tad to help (any many other good
> people besides him) you *must* check the docs first.  That's all I took
> it to mean, and find it reasonable (and true) as said.  

That's because you're used to reading precise, logical statements and 
deriving their meaning, because you've got a good background reading 
technical discourse.  But someone without that background won't 
necessarily read it that way.  It's not something you can take for 
granted.  Most human-to-human communication is rather idiomatic and 
doesn't correspond one-to-one with formal logic.

In short, I consider understanding "must" in its RFC sense to be inside 
knowledge which doesn't fall into the same category as knowing not to cut 
in line or not to bogart the potato salad.  It's something people should 
be expected to *learn* (just as they should be expected to learn to use 
Perl's documentation), but it's not something they should be assumed to 
know in advance.

At this point, I think the best solution is to keep the existing uses of 
"must," but include a short paragraph at the beginning along the lines of:

In this document, we use words like "must" and "should" in the very 
precise sense that they're used in technical conversation (such as you're 
likely to encounter  in this newsgroup).  When we say that you *must* do 
something, we mean that if you don't do that something, then it's very 
unlikely that you're going to get much benefit from using this group.  
We're not trying to boss you around; we're just trying to convey the point 
without using a lot of words.


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

Date: Wed, 16 May 2001 10:26:00 GMT
From: dennis@cobolt.net (Dennis Schoen)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <slrn9g4ldo.3qf.dennis@smart.cobolt.net>

On Wed, 16 May 2001 03:00:01 -0700, Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> Bernard El-Hagin wrote:
>  
>> Andrew Yeretsky wrote:
> 
>> >This document you are arguing about is ridiculous.  As someone who posted to
>> >this newsgroup for the first and probably the last time today, I have to say I
>> >agree with Godzilla.
>  
>> Good, then go away and take her with you.
> 
> 
>  "You MUST not agree with Godzilla."
>   If you do, you MUST go away."
> 
>   Book Of Tad, 11:23
            ^^^ 
> 
> Godzilla!
  ^^^^^^^^

If both of you just ignore the other maybe we can go on and
discuss Perl related topics in this nesgroup? Hint: killfill

Dennis
-- 
"The Idea Is Good But The World Isn't Ready Yet"
                    -
    Tocotronic (The Hamburg Years - 1998)


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

Date: Wed, 16 May 2001 11:27:56 GMT
From: steven.smolinski@sympatico.ca (Steven Smolinski)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <slrn9g4ue3.im.steven.smolinski@ragnar.stevens.gulch>

Eric Bohlman <ebohlman@omsdev.com> wrote:
> [...] [P]eople who read RFCs generally do so with enough background 
> knowledge to know that "must" is being used in a very precise, conditional 
> sense.  That's knowledge, not intelligence; it comes from experience.  You 
> can use very abbreviated language when you know that your readers share a 
> common background.
> 
> The problem is that when you have a document that's intended to help 
> orient people who are new to a field or subculture, you can't assume much 
> background. 

I didn't learn what "must" meant by reading technical manuals, as it's
not a technical thing.  As my mom used to say: *if* you want strong
bones, you *must* drink your milk.  It's not a rare construction, and
certainly not "inside knowledge".

However, I'll grant that there are a set of people who will
misunderstand the term, notwithstanding my evaluation.  So your
suggestion to make it clear, while it reads to me too much like
coddling, may help the issue:

[...]
> At this point, I think the best solution is to keep the existing uses of 
> "must," but include a short paragraph at the beginning along the lines of:
> 
> In this document, we use words like "must" and "should" in the very 
> precise sense that they're used in technical conversation (such as you're 
> likely to encounter  in this newsgroup).  When we say that you *must* do 
> something, we mean that if you don't do that something, then it's very 
> unlikely that you're going to get much benefit from using this group.  
> We're not trying to boss you around; we're just trying to convey the point 
> without using a lot of words.

I like it all but the last sentence, which seems unnecessarily
obsequious.  Perhaps it should be a footnote to the first use of the
term, as the document itself should be quite short.

Steve
-- 
Steven Smolinski => http://www.steven.cx/


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

Date: Wed, 16 May 2001 14:13:19 +0200
From: "Peter Søgaard" <peter.sogaard@tjgroup.com>
Subject: regExp question
Message-Id: <9dtqsq$kfs$1@news.inet.tele.dk>

Hmm, this should be simple enought, but it's bugging me a bit.
Say I want to change all "monday","tuesday" etc. in a string to "mon","tue"
etc.
How do i approach this? use tr/// or s///?
with tr/// i can only replace 1 char by 1 char, or am i doing something
wrong?






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

Date: Wed, 16 May 2001 12:32:17 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: regExp question
Message-Id: <slrn9g4sa5.pk3.bernard.el-hagin@gdndev25.lido-tech>

On Wed, 16 May 2001 14:13:19 +0200, Peter Søgaard <peter.sogaard@tjgroup.com>
wrote:
>Hmm, this should be simple enought, but it's bugging me a bit.
>Say I want to change all "monday","tuesday" etc. in a string to "mon","tue"
>etc.
>How do i approach this? use tr/// or s///?
>with tr/// i can only replace 1 char by 1 char, or am i doing something
>wrong?

Assuming the word is in $_:

s/^(.{3}).*$/$1/;
print;

Or:

print substr($_, 0, 3);

Cheers,
Bernard


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

Date: Wed, 16 May 2001 14:39:01 +0200
From: "Peter Søgaard" <peter.sogaard@tjgroup.com>
Subject: Re: regExp question
Message-Id: <9dtsd1$o5o$1@news.inet.tele.dk>

Sorry, that's not what i meant...

Say i have a string:
$text = "blablabla at monday and blablabla at tuesday wednesday and thursday
blablabla";

then i want to translate all the days in $str to "mon","tue" etc.

I guess i need to make to lists...one the @seachList =
("monday","tuesday",etc) and the other the @translationList =
("mon","tue",etc)

but how do i use these 2 lists in my regexp?

Actually i want to do the same as you can with tr///

tr/abc/cde/ this translates a to c, b to d, c to e

I want the same, just with monday to mon, tuesday to tue etc...


"Bernard El-Hagin" <bernard.el-hagin@lido-tech.net> wrote in message
news:slrn9g4sa5.pk3.bernard.el-hagin@gdndev25.lido-tech...
> On Wed, 16 May 2001 14:13:19 +0200, Peter Søgaard
<peter.sogaard@tjgroup.com>
> wrote:
> >Hmm, this should be simple enought, but it's bugging me a bit.
> >Say I want to change all "monday","tuesday" etc. in a string to
"mon","tue"
> >etc.
> >How do i approach this? use tr/// or s///?
> >with tr/// i can only replace 1 char by 1 char, or am i doing something
> >wrong?
>
> Assuming the word is in $_:
>
> s/^(.{3}).*$/$1/;
> print;
>
> Or:
>
> print substr($_, 0, 3);
>
> Cheers,
> Bernard




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

Date: Wed, 16 May 2001 13:01:30 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: regExp question
Message-Id: <slrn9g4u0u.pk3.bernard.el-hagin@gdndev25.lido-tech>


[don't top post - it's annoying]

On Wed, 16 May 2001 14:39:01 +0200, Peter Søgaard <peter.sogaard@tjgroup.com>
wrote:

[snipped old solution]

>Sorry, that's not what i meant...

Well excuuuuuuuuse me. :-)

>Say i have a string:
>$text = "blablabla at monday and blablabla at tuesday wednesday and thursday
>blablabla";
>
>then i want to translate all the days in $str to "mon","tue" etc.
>
>I guess i need to make to lists...one the @seachList =
>("monday","tuesday",etc) and the other the @translationList =
>("mon","tue",etc)

Use a hash instead of two arrays:

my %days = (monday    => 'mon',
            tuesday   => 'tue',
            wednesday => 'wed'
           )


>but how do i use these 2 lists in my regexp?

$text =~ s/\b(.+?)\b/$days{$1} or $1/eg;
print $text;

>Actually i want to do the same as you can with tr///
>
>tr/abc/cde/ this translates a to c, b to d, c to e
>
>I want the same, just with monday to mon, tuesday to tue etc...

tr only translates character-to-character.

Cheers,
Bernard


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

Date: Wed, 16 May 2001 15:02:08 +0200
From: "Peter Søgaard" <peter.sogaard@tjgroup.com>
Subject: Re: regExp question
Message-Id: <9dttob$ru7$1@news.inet.tele.dk>

i can do it like this:

%trans = (
 'monday'=> 'mon',
 'tuesday'=> 'tue',
 'wednesday'=> 'wed'
);

foreach $key( keys %trans ){
  $text =~ s/$key/$trans{$key}/ig;
}


but is there a better than than using a loop?




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

Date: Wed, 16 May 2001 11:56:30 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: static values in a subroutine
Message-Id: <slrn9g4qne.54e.garry@zfw.zvolve.net>

On 15 May 2001 22:26:07 -0500, Logan Shaw <logan@cs.utexas.edu> wrote:
> In article <3B0153F0.74289C0F@noaa.gov>,
> Travis Stevens  <Travis.Stevens@noaa.gov> wrote:

[snip fine example]

> And the object-oriented approach:
> 
> 	package Counter;
> 
> 	sub new
> 	{
> 	    my $class = shift;
> 	    my $self = {};
> 	    bless $self, $class;
> 	    $self->{counter} = 0;
> 	    return $self;
> 	}

[snip]

> 	package main;
> 
> 	$counter = Counter::new;

  $counter = Counter->new;

-- 
Garry Williams


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

Date: Wed, 16 May 2001 07:47:08 -0500
From: Mr. SunRay <nospam@hotmail.com>
Subject: Re: Stumped on $?, duplicate output
Message-Id: <gFuM6.142$y84.36030@news.uswest.net>

Forgot to mention - 5.6 on Redhat 6.2

Also, I do have a $SIG{CHLD} handler in the form of "do {} while waitpid(-1, 
WNOHANG) > 0".

Running this as a standalone script (i.e. printing to STDOUT instead of a 
socket) seemed to work fine.

Regards,

Mr. Sunray




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

Date: Wed, 16 May 2001 11:58:13 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: To compress and uncompress text files ?
Message-Id: <itp4gtce8dpjdk1giddns96lf7uoeb2f18@4ax.com>

nosabi wrote:

>I have this perl script running a bullitn board for free postings of ads.
>After someone submits an ad  the email address, ad subject, ad message,
>date&time, #of months to display ad,
>is comma separated into an array and appended to a text file. Then saved.
>This file is accessed using perl to display ads.

In what way? Are all ads being skimmed , filtered, and the appropriate
ones displayed? Or are you just displaying one ad at a time?

>Since this is a popular feature on my board. The text file is becoming
>large. Is there a built in feature of PERL to
>compress and uncompress these text files "On The Fly"?

There's a fairly standard library file, Compress::Zlib. This
compresses/decompresses the standard gzip compression format. You can
even use it directly in Archive::Tar, to process (read/write) .tar.gz
AKA .tgz files. There's also Archive::Zip.

But I wonder if this is the solution to your problem. Which is...? Are
you worried about disk space, or about speed issues? THis might save
disk space, but it won't be faster. Er... un(g)zipping is quite fast,
actually. Gzipping takes longer. So, since a simple "append" will no
longer do, adding one ad to your archive will take a significant time.

>Or what should I be looking at to upgrade it to the Next Level ?

That depends on your worries. If you're having disk space concerns, a
flat text file will likely be the best in space/time trade-off.

If your main concern is speed, think of a database.

There are two major routes you can take in Perl: 

 A) The tied hash. Often based on the Berkeley DB engine, but there are
alternatives. Look up the docs for AnyDBM_File, or "DBM" in general.
This is a good approach to quickly find a record (ad) based upon its
unique key. Disk space usage is enormous, and one of the reasons is that
the dB uses a fixed amount of disk space for each record. I wouldn't be
too surprised if the dbm file turns out to be 5 to 10 times bigger than
your flat text file.

 B) The SQL approach. Look up DBI (and DBD::*). Depending on what your
ISP provides you with, there may be a databse server engine running.
MySQL is quite popular, but it's not the only choice. You connect
through DBI, issue a few SQL statements, and you get records back as a
hash reference, an array reference of an array (fetchrow_*); or you can
get the lot at one time (fetchall_arrayref).

You need a provider that runs such a DB engine, or you cannot even begin
to think about it. The database file itself will not be small. SQL
itself is a bit of an annoying bottleneck, a fairly limited language
really, but the resulting programs are generally quite fast.

-- 
	Bart.


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 912
**************************************


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