[17355] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4777 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 31 18:06:54 2000

Date: Tue, 31 Oct 2000 15:05:34 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <973033533-v9-i4777@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 31 Oct 2000     Volume: 9 Number: 4777

Today's topics:
    Re: "chown" of symlink instead of linked file <uri@sysarch.com>
    Re: "chown" of symlink instead of linked file (Tom Christiansen)
    Re: "chown" of symlink instead of linked file (Chris Fedde)
    Re: "chown" of symlink instead of linked file <joe+usenet@sunstarsys.com>
    Re: "chown" of symlink instead of linked file <uri@sysarch.com>
    Re: "chown" of symlink instead of linked file (Martien Verbruggen)
    Re: + or - <jeff@yoak.com>
    Re: + or - (Richard J. Rauenzahn)
    Re: + or - (Richard J. Rauenzahn)
    Re: Breaking a long word <gellyfish@gellyfish.com>
    Re: CGI Perl vs. Java Servlets... (Jerome O'Neil)
    Re: CGI Perl vs. Java Servlets... desarollador@my-deja.com
    Re: CGI Perl vs. Java Servlets... <joe+usenet@sunstarsys.com>
    Re: CGI Perl vs. Java Servlets... (Jerome O'Neil)
        CGI.pm and dbm files (Roderick Clay)
    Re: code counter v1 released :-) (Mark-Jason Dominus)
    Re: comment on my bandwidth throttling code <elijah@workspot.net>
    Re: complex regex <tim@ipac.caltech.edu>
        CPAN for perl 5.6 <pougetou@cybercable.fr>
    Re: CPAN for perl 5.6 (Clay Irving)
        cutting / parsing URLS out of a live HTML document <maartenh@usa.net>
    Re: cutting / parsing URLS out of a live HTML document (Chris Fedde)
    Re: equivalent to $DEBUG in ksh (Tad McClellan)
    Re: equivalent to $DEBUG in ksh <peter.sundstrom@eds.com>
    Re: FormMail.pl with file attachment support? <jesusx@who.net>
    Re: FormMail.pl with file attachment support? <camerond@mail.uca.edu>
    Re: Have I released all memory? (Mark-Jason Dominus)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 31 Oct 2000 19:51:29 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: "chown" of symlink instead of linked file
Message-Id: <x7g0lciybi.fsf@home.sysarch.com>

>>>>> "TC" == Tom Christiansen <tchrist@perl.com> writes:


  TC> Then the answer is system("chown -h").

  TC>      -h Change the user ID and/or the group ID on symbolic
  TC>      links. The -R

hmm, gnu chown doesn't support that. solaris does have it but its sunos
compatible chown does not.

so this is not an acceptable solution as the option is not
standard. assuming gnu chown for linux, then it is not there either.

and why does apache check for link ownership? is there really a trapdoor
that a symlink owner could create?

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: 31 Oct 2000 13:02:58 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: "chown" of symlink instead of linked file
Message-Id: <39ff2572@cs.colorado.edu>

In article <x7g0lciybi.fsf@home.sysarch.com>,
Uri Guttman  <uri@sysarch.com> wrote:
>  TC> Then the answer is system("chown -h").
>  TC>      -h Change the user ID and/or the group ID on symbolic
>  TC>      links. The -R
>
>hmm, gnu chown doesn't support that. 

So what?  Just install a proper working version instead.
It's always better to use sane utilities anyway.

>solaris does have it but its sunos
>compatible chown does not.
>
>so this is not an acceptable solution as the option is not
>standard. assuming gnu chown for linux, then it is not there either.

Since when are we a prisoner of what the vendors give us?
Perl was never standard, either.

What do you want, some funky module to do this?  Sure, I could do
that.  It would be dumb, however, as once again, it would be
non-standard.  Non-standard is not a dirty word that should get
your shorts in a snit.  If you can't install software, THEN WHY ARE
YOU WRITING IT?

--tom


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

Date: Tue, 31 Oct 2000 20:09:06 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: "chown" of symlink instead of linked file
Message-Id: <CFFL5.58$Bf7.169981440@news.frii.net>

In article <x7g0lciybi.fsf@home.sysarch.com>,
Uri Guttman  <uri@sysarch.com> wrote:
>>>>>> "TC" == Tom Christiansen <tchrist@perl.com> writes:
>
>
>  TC> Then the answer is system("chown -h").
>
>  TC>      -h Change the user ID and/or the group ID on symbolic
>  TC>      links. The -R
>
>hmm, gnu chown doesn't support that. solaris does have it but its sunos
>compatible chown does not.
>
>so this is not an acceptable solution as the option is not
>standard. assuming gnu chown for linux, then it is not there either.
>
>and why does apache check for link ownership? is there really a trapdoor
>that a symlink owner could create?
>
>uri
>

From the Apache Doc:

    SymLinksIfOwnerMatch 
	 The server will only follow symbolic links for which the
	 target file or directory is owned by the same user id as
	 the link.  

-- 
    This space intentionally left blank


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

Date: 31 Oct 2000 15:25:16 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: "chown" of symlink instead of linked file
Message-Id: <m3vgu84v2r.fsf@mumonkan.sunstarsys.com>

cfedde@fedde.littleton.co.us (Chris Fedde) writes:

> >and why does apache check for link ownership? is there really a trapdoor
> >that a symlink owner could create?
> >
> >uri
> >
> 
> From the Apache Doc:
> 
>     SymLinksIfOwnerMatch 
> 	 The server will only follow symbolic links for which the
> 	 target file or directory is owned by the same user id as
> 	 the link.  

IMHO, it's basically a gut check that prevents a local user from making 
/etc/passwd available via ~luser/symlink_to_config_file .

-- 
Joe Schaefer



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

Date: Tue, 31 Oct 2000 20:22:34 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: "chown" of symlink instead of linked file
Message-Id: <x7d7ggiwvo.fsf@home.sysarch.com>

>>>>> "TC" == Tom Christiansen <tchrist@perl.com> writes:

  TC> Since when are we a prisoner of what the vendors give us?
  TC> Perl was never standard, either.

where did yo uget that idea? i use both the gnu and solaris utilities
and sometime override one with another. 

  TC> What do you want, some funky module to do this?  Sure, I could do
  TC> that.  It would be dumb, however, as once again, it would be
  TC> non-standard.  Non-standard is not a dirty word that should get
  TC> your shorts in a snit.  If you can't install software, THEN WHY ARE
  TC> YOU WRITING IT?

tom, calm down. i am not in need of the chown -h option and i have it on
my box if i needed it. i am just saying it is not a widespread option so
it makes changing the symlink owner problem trickier from perl. if you
don't have the -h option and since perl doesn't support it directly,
another choice is the syscall function which can get at lchown and that
should work on most any unix box.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Tue, 31 Oct 2000 22:26:23 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: "chown" of symlink instead of linked file
Message-Id: <slrn8vuhof.ksa.mgjv@verbruggen.comdyn.com.au>

On Tue, 31 Oct 2000 19:51:29 GMT,
	Uri Guttman <uri@sysarch.com> wrote:
> >>>>> "TC" == Tom Christiansen <tchrist@perl.com> writes:
> 
> 
>   TC> Then the answer is system("chown -h").
> 
>   TC>      -h Change the user ID and/or the group ID on symbolic
>   TC>      links. The -R
> 
> hmm, gnu chown doesn't support that. solaris does have it but its sunos
> compatible chown does not.

[mgjv@verbruggen /tmp]# cat lchown.pl
#!/usr/local/bin/perl -w
use strict;
require 'syscall.ph';

die "Usage: $0 user:group file\n" unless @ARGV == 2;

my ($user, $group) = split /:/, shift;
my $uid            = (getpwnam $user )[2] 
                          or die "$user doesn't exist\n";
my $gid            = (getgrnam $group)[2]   || -1;
my $file           = shift;

print "lchown of '$file' to $user:$group ($uid:$gid)\n";
$! = 0;
my $rc = syscall(&SYS_lchown, $file, $uid, $gid);
die "syscall lchown: $!" if $! or $rc == -1;

[mgjv@verbruggen /tmp]# ln -s bar foo
[mgjv@verbruggen /tmp]# ls -l foo
lrwxrwxrwx   1 root     root            3 Nov  1 09:22 foo -> bar
[mgjv@verbruggen /tmp]# ./lchown.pl nobody:news foo
lchown of 'foo' to nobody:news (99:13)
[mgjv@verbruggen /tmp]# ls -l foo
lrwxrwxrwx   1 nobody   news            3 Nov  1 09:22 foo -> bar
[mgjv@verbruggen /tmp]# ./lchown.pl mgjv:nonexist foo
lchown of 'foo' to mgjv:nonexist (146:-1)
[mgjv@verbruggen /tmp]# ls -l foo
lrwxrwxrwx   1 mgjv     news            3 Nov  1 09:22 foo -> bar
[mgjv@verbruggen /tmp]# ./lchown.pl furbie:root foo
furbie doesn't exist

This ignores nonexisting groups. Adapt to your needs.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd.   | you come to the end; then stop.
NSW, Australia                  | 


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

Date: Tue, 31 Oct 2000 11:26:40 +0800
From: "Jeff Yoak" <jeff@yoak.com>
Subject: Re: + or -
Message-Id: <8tn6et01r7l@news2.newsguy.com>

In article <39FEA572.6C2101E5@infineon.com>, "Caron Franck"
<frnack.caron@infineon.com> wrote:

> let try
> 
> $a =~ s/^\-(\d+)$/$1/ ;
> 
> Where $a is your variable.
> 
> This will work even if your var is not a number.But something like :
> 
> $a = ($a <0) ? -$a : $a;
> 
> will work for $a numerical but if a is not a number (i.e. $a = 'toto')
> you will have a runtime error message.

I think both of these suggestions are really silly and better suggestions
are found elsewhere in this thread, but what runtime error message do you
receive and with what version of Perl?  That statement won't generate a runtime
error message with any perl I remember, which stretches back to 4.036 .
Did you actually try it?

Cheers,
Jeff


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

Date: 31 Oct 2000 20:43:27 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: + or -
Message-Id: <973025006.410086@hpvablab.cup.hp.com>

"Jeff Yoak" <jeff@yoak.com> writes:
>In article <39FEA572.6C2101E5@infineon.com>, "Caron Franck"
>>
>> This will work even if your var is not a number.But something like :
>> 
>> $a = ($a <0) ? -$a : $a;
>> 
>> will work for $a numerical but if a is not a number (i.e. $a = 'toto')
>> you will have a runtime error message.
>
>I think both of these suggestions are really silly and better suggestions
>are found elsewhere in this thread, but what runtime error message do you
>receive and with what version of Perl?  That statement won't generate a runtime
>error message with any perl I remember, which stretches back to 4.036 .
>Did you actually try it?

I just did -- did you try it with '-w'?

$ perl5 -w
my $a = "toto";

$a = ($a <0) ? -$a : $a;

print "$a\n";
^D
Argument "toto" isn't numeric in numeric lt (<) at - line 5.
toto
$ perl5 -v

This is perl, v5.6.0 built for PA-RISC2.0

[...]

Rich
-- 
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant     | I speak for me,     |   19055 Pruneridge Ave. 
Development Alliances Lab|            *not* HP |                MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014


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

Date: 31 Oct 2000 21:11:33 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: + or -
Message-Id: <973026692.472577@hpvablab.cup.hp.com>

nospam@hairball.cup.hp.com (Richard J. Rauenzahn) writes:
>$ perl5 -w
>my $a = "toto";
>
>$a = ($a <0) ? -$a : $a;
>
>print "$a\n";
>^D
>Argument "toto" isn't numeric in numeric lt (<) at - line 5.
                                                      ^^^^^^

Err, please ignore that error line.  I reduced some whitespace after my
cut and space.  The warning does correspond with the "$a = ($a <0) ?
-$a : $a;" line.

Rich
-- 
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant     | I speak for me,     |   19055 Pruneridge Ave. 
Development Alliances Lab|            *not* HP |                MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014


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

Date: 31 Oct 2000 19:45:46 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Breaking a long word
Message-Id: <8tn7ha$i05$1@orpheus.gellyfish.com>

On 28 Oct 2000 13:28:58 GMT Jimtaylor5 wrote:
> I was wondering if anyone could help me in finding a solutionin using perl to
> break a long URL off and print the remainder on another line or place it in
> another variable, as long URL's warp my printout. Say I have a URL in a
> variable 60 characters long, and I want to print that variable. How would I
> make sure maximum 40 characters get printed on one line, and the rest on
> another. I guess I'm asking how do I break a variable off at a certain number
> of characters, and yet retain that broken off to print on another line. Or if
> any of you guys would have a better way of doing it. Thanks guys in advance. 


Just for completeness, You can also do :

print "$1\n" while $url /(.{0,40})/g;


check out the perlre manpage for more on that stuff ....

/J\
-- 
Jonathan Stowe                      |     
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: Tue, 31 Oct 2000 19:05:57 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: CGI Perl vs. Java Servlets...
Message-Id: <pKEL5.112$v37.147696@news.uswest.net>

James Taylor <james@NOSPAM.demon.co.uk> elucidates:
> In article <39fe25f5$1_2@news2.one.net>, Ryan Bedford
> <URL:mailto:ryanb@one.net> wrote:
>> All things being equal which is faster?  CGI Perl or Java Servlets?
> 
> From the lack of a sensible answer from any of the other posters
> so far it looks like you'll have to do your own performance tests.
> I'd be interested in what you discover.
> 

What he'll discover is that it's faster to write and maintain Perl.  He'll
also discover that for small, low volume applications, there isn't a whole
lot of noticable difference.  For more complex applications, Servlets
offer a host of features, such as session managment and chaining, that
are beneficial.  For high volume, Servlets scale better.

The notion that "all things being equal" is absurd.  Things aren't
equal.  It's akin to saying "All things being equal, which is
faster, a saw, or a hammer."
















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

Date: Tue, 31 Oct 2000 19:10:21 GMT
From: desarollador@my-deja.com
Subject: Re: CGI Perl vs. Java Servlets...
Message-Id: <8tn5el$79o$1@nnrp1.deja.com>

In article <m166m962hn.fsf@halfdome.holdit.com>,
  merlyn@stonehenge.com (Randal L. Schwartz) wrote:
> >>>>> "Ryan" == Ryan Bedford <ryanb@one.net> writes:
>
> Ryan> All things being equal which is faster?  CGI Perl or Java
Servlets?
>
> You just said they were equal!  Unless "CGI Perl" and "Java Servlets"
> are not part of "All things".
>
> Sorta like that old phrase, "Presume a perfectly spherical cow..."
>
> Why not come up with a question which really makes sense, and could
> empower you, instead of being nonsense?
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!
>

Man, it is just sad when someone writes in to a newsgroup with a valid
question and everyone avoids the answer and just makes fun of them.

Could it be that perhaps no one wants to admit the fact that something
could be faster than Perl?




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


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

Date: 31 Oct 2000 14:48:03 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: CGI Perl vs. Java Servlets...
Message-Id: <m3zojk4wss.fsf@mumonkan.sunstarsys.com>

desarollador@my-deja.com writes:

> Man, it is just sad when someone writes in to a newsgroup with a valid
> question and everyone avoids the answer and just makes fun of them.

Not so sad at all.  When someone posts a question to 

comp.lang.<language X>.*

and asks "which is better, language X or language Y",
it's very unlikely they are asking the question in earnest,
but rather are just trolling. Had OP asked it in a newsgroup
like c.i.w.s.unix, the possibility of a reasonable response
would have increased significantly. (In fact, that's where I thought
this was originally posted :)

> Could it be that perhaps no one wants to admit the fact that something
> could be faster than Perl?

Are you guilty of the same offense?

-- 
Joe Schaefer


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

Date: Tue, 31 Oct 2000 19:52:54 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: CGI Perl vs. Java Servlets...
Message-Id: <qqFL5.121$v37.162959@news.uswest.net>

desarollador@my-deja.com elucidates:

> 
> Man, it is just sad when someone writes in to a newsgroup with a valid
> question and everyone avoids the answer and just makes fun of them.

It's hardly a valid question.  

> Could it be that perhaps no one wants to admit the fact that something
> could be faster than Perl?

There are lots of things faster than Perl.  Servlets may or may
not be one of them, depending on the problem trying to be solved.


-- 
"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: Tue, 31 Oct 2000 20:31:49 GMT
From: clay.1@osu.edu (Roderick Clay)
Subject: CGI.pm and dbm files
Message-Id: <39ff2326.21163261@nntp.service.ohio-state.edu>

Hello.  I'm a fairly new perl programmer and completely new to this
newsgroup, so please forgive my ignorance if it shows (which it
probably will!)

We recently plugged the CGI.pm module into one of our CGI scripts, in
order to use the 'param' method to get the parameters passed into our
script.  A couple of days ago we noticed that we have a problem of
some kind with a dbm file that we have used in this script for years -
we appear to be either not getting or setting the right values in the
dbm file now.  In fact, there appear to be duplicate keys in the dbm
file now, which we thought was impossible!

Is there any possible connection that anyone is aware of between use
of the CGI.pm module and use of dbm files?  Or is my problem
elsewhere, in a place I haven't even thought to look yet?!?

Thanks in advance for any help that anyone can offer this relative
newbie.

Rod Clay
rclay@regents.state.oh.us


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

Date: Tue, 31 Oct 2000 20:16:42 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: code counter v1 released :-)
Message-Id: <39ff28a9.3367$24c@news.op.net>
Keywords: Merrimack, complaisant, insensitive, omega


On a vaguely related note, I built the following item as an example
for my 'Tricks of he Wizards' class:


        package Devel::Count;

        sub DB::DB { ++$count }

        END { print STDERR "Total statements: $count\n" }


You put this into the file Devel/Count.pm, and then you take your
program and run it like this:

        perl -d:Count myprogram.pl

Your program runs normally, but when it finishes executing, it prints
out

        Total statements: 59683

or whatever.  It's not really clear that this is useful for anything,
excapt as an example but I thought if I posted it here maybe someone
would come up with something to do with it.





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

Date: 31 Oct 2000 21:28:48 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: comment on my bandwidth throttling code
Message-Id: <eli$0010311607@qz.little-neck.ny.us>

On Wed 25 Oct 2000, in comp.lang.perl.misc, Eli the Bearded 
<elijah@workspot.net> wrote:
> Looking for 'throttle' at search.cpan.org doesn't turn up much,
 ...

No one has any comments? (Other than the link Randal sent
by mail...)

Elijah
------
he did not comment per-se, but show another way to throttle


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

Date: Tue, 31 Oct 2000 11:15:06 -0800
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: complex regex
Message-Id: <39FF1A3A.855E7BDB@ipac.caltech.edu>

Cam wrote:
> 
> If I am searching a file for 3 different keywords and want to do something
> upon finding these keywords, how should I proceed?
> I dont want to have to parse the string 3 seperate times which is the only
> way I can see how to do it.

Try something like this (untested):

my @keywords = qw(APPLE ORANGE PEAR);
my $re = join "|",@keywords;

while(<FILE>) {

  for my $key ( /\b($re)\b/igo ) {
    # Do stuff
  }

}

See perlre.

--

-- Tim Conrow         tim@ipac.caltech.edu                           |


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

Date: Tue, 31 Oct 2000 21:59:56 +0100
From: "Nicolas" <pougetou@cybercable.fr>
Subject: CPAN for perl 5.6
Message-Id: <8tnbqo$2hbs$1@news6.isdnet.net>

I installed RedHat 7.0 which include perl 5.6.0

I wasn't able to find appropriate modules for perl 5.6.
The ones I got doesn't install with perl 5.6.

Where could I find CPAN module that will run with RH7.0 and Perl 5.6 ?

Tks
Nicolas




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

Date: 31 Oct 2000 21:03:52 GMT
From: clay@panix.com (Clay Irving)
Subject: Re: CPAN for perl 5.6
Message-Id: <slrn8vucto.f4s.clay@panix6.panix.com>

On Tue, 31 Oct 2000 21:59:56 +0100, Nicolas <pougetou@cybercable.fr> wrote:

>I installed RedHat 7.0 which include perl 5.6.0
>
>I wasn't able to find appropriate modules for perl 5.6.
>The ones I got doesn't install with perl 5.6.
>
>Where could I find CPAN module that will run with RH7.0 and Perl 5.6 ?

The CPAN module is part of the standard Perl distribution -- From a 
command line type:

  perl -MCPAN -e shell

-- 
Clay Irving <clay@panix.com>
If you flattened out Wales, it would be bigger than killing everybody. 


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

Date: Tue, 31 Oct 2000 22:06:24 +0100
From: "Maarten" <maartenh@usa.net>
Subject: cutting / parsing URLS out of a live HTML document
Message-Id: <8tn5l1$35g$1@azure.nl.gxn.net>

Hello all,

I am trying to accomplish cutting html code out of a live Internet page and
pasting it into a new one, but it just won't work. I already know how to use
perl to get all of the html of a document on my screen:
-------
use LWP::Simple;
$stuff= get('http://www.hartsuijker.com/2000egypt_ses_index.html');
print "$stuff";
-------

and I also know how to get URL's or other text out of a HTML document on my
test machine:
-------
$stuff= "/home/maarten/2000egypt_ses_index.html";
print "$stuff";
open STUFF, $stuff;
while (<STUFF>) {
print "$1 \n" if /"(http.*)">/i;
}
-------

So if I want to get the URL's right out of a live document, the following
would seem logical to me:
-------
use LWP::Simple;
$stuff= get('http://www.hartsuijker.com/2000egypt_ses_index.html');
open STUFF, $stuff;
while (<STUFF>) {
print "$1 \n" if /"(http.*)">/i;
}

But perl just can't follow my logics and I was hoping someone could help me
out with this problem. First getting or using the document from my local
drive isn't an option for me, because I want to use the data from a server
which isn't the same host as the one perl is on.

thnx in advance, maarten
------------------
maarten@hartsuijker.com




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

Date: Tue, 31 Oct 2000 20:19:16 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: cutting / parsing URLS out of a live HTML document
Message-Id: <8PFL5.59$Bf7.170911232@news.frii.net>

In article <8tn5l1$35g$1@azure.nl.gxn.net>, Maarten <maartenh@usa.net> wrote:
>Hello all,
>
>So if I want to get the URL's right out of a live document, the following
>would seem logical to me:
>-------
>use LWP::Simple;
>$stuff= get('http://www.hartsuijker.com/2000egypt_ses_index.html');
>open STUFF, $stuff;
>while (<STUFF>) {

print "$1 \n" if ($stuff =~ /"(http.*)">/i);
                 ^^^^^^^^^^

>}
>

You forgot to apply your pattern to the variable containing your
data.  Below is a "cargo cult" approach that might also be of some
value.  This was lifted from the documentation so credit goes to
the module authors.

#!/usr/bin/perl -w
#
# getlinks
# return links from listed urls
#

use LWP::UserAgent;
use HTML::LinkExtor;
use URI::URL;
use strict;

my @anchors = ();

while (my $url = shift @ARGV){
    my $ua = new LWP::UserAgent;
    $ua->env_proxy();

    # Make the parser.  Unfortunately, we don't know the url base yet
    # (it might be diffent from $url)
    my $p = HTML::LinkExtor->new(\&callback);

    # Request document and parse it as it arrives
    my $res = $ua->request(HTTP::Request->new(GET => $url),
	sub {$p->parse($_[ 0])});

    # Expand all A URLs to absolute ones
    my $base = $res->base;
    @anchors = map { $_ = url($_, $base)->abs; } @anchors;

    # Print them out
    print join("\n", @anchors), "\n";
} 

# Set up a callback that collect image links
sub callback {
    my($tag, %attr) = @_;
    return if $tag ne 'a';  # we only look closer at <a ...>
    push(@anchors, values %attr);
}

-- 
    This space intentionally left blank


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

Date: Tue, 31 Oct 2000 11:51:56 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: equivalent to $DEBUG in ksh
Message-Id: <slrn8vtu5c.7sd.tadmc@magna.metronet.com>

On Tue, 31 Oct 2000 16:31:29 GMT, dthdutch@my-deja.com 
   <dthdutch@my-deja.com> wrote:
>Hello, I'm new to Perl and didn't find this in
>the FAQ. In shell scripting I set up my scripts
>to accept a parm "debug" and then set $DEBUG
>to "echo".  This way I could precede key commands
>with $DEBUG to print out what would have been
>executed.  Slightly different than running in
>debug mode.  Does anyone have a method similar to
>this for perl?


my $DEBUG = 0;             # default to no debugging output
if ( $ARGV[0] eq 'debug' ) {
   shift;                  # remove the command line argument from arg list
   $DEBUG = 1;             # turn on debugging output
}
 ...
print "some debugging stuff here\n" if $DEBUG;



-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 1 Nov 2000 10:57:57 +1300
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: equivalent to $DEBUG in ksh
Message-Id: <8tnffe$ris$1@hermes.nz.eds.com>


<dthdutch@my-deja.com> wrote in message news:8tms51$u9t$1@nnrp1.deja.com...
> Hello, I'm new to Perl and didn't find this in
> the FAQ. In shell scripting I set up my scripts
> to accept a parm "debug" and then set $DEBUG
> to "echo".  This way I could precede key commands
> with $DEBUG to print out what would have been
> executed.  Slightly different than running in
> debug mode.  Does anyone have a method similar to
> this for perl?

$DEBUG=1;

print "Debug line\n" if $DEBUG;




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

Date: Tue, 31 Oct 2000 15:18:43 -0500
From: jesus X <jesusx@who.net>
Subject: Re: FormMail.pl with file attachment support?
Message-Id: <39FF2923.B08769F7@who.net>

ISTERIN wrote:
> 
> Just use MIME::Lite to send attachments.  Read about different and
> supported encodings in the docs.

I have no idea what you're talking about. =-] If I need to do some changes, I
can probably muddle through, but I need some idea as to what to do...

--
jesus X  [ Booze-fueled paragon of pointless cruelty and wanton sadism. ]
 email   [ jesusx @ who.net ]
 web     [ http://www.burntelectrons.com/ ]
 tag     [ The Universe: It's everywhere you want to be. ]
 warning [ If at first you don't succeed, reload. ]


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

Date: Tue, 31 Oct 2000 15:00:17 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: FormMail.pl with file attachment support?
Message-Id: <39FF32E1.584FF27B@mail.uca.edu>

jesus X wrote:
> 
> ISTERIN wrote:
> >
> > Just use MIME::Lite to send attachments.  Read about different and
> > supported encodings in the docs.
> 
> I have no idea what you're talking about. =-] If I need to do some changes, I
> can probably muddle through, but I need some idea as to what to do...

What to do? Read the FAQ on mailing in the docs that come with Perl on
your hard drive. And throw out any script that reads "Author: Matt
Wright" and write your own (it's really simple). Check the archives of
this newsgroup at Deja and you'll see why.

Cameron

-- 
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu


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

Date: Tue, 31 Oct 2000 20:22:52 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Have I released all memory?
Message-Id: <39ff2a1c.3383$2ef@news.op.net>
Keywords: Britain, Melville, Swedish, steepen

In article <u9aebltk8g.fsf@wcl-l.bham.ac.uk>,  <nobull@mail.com> wrote:
>Perl does not release [memory] back to the OS.

Perl can be configured to use the local system's 'free' function
instead of its own built-in allocator.  If the system free function
returns the memory to the OS, then when Perl uses free, the memory is
returned to the OS.

This isn't a quibble, since the free() on my Slackware 7.1 system does
in fact do that.  It is probably similar on other recent Linux systems.

I was very surprised the first time I saw it happen.





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

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


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