[16171] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3583 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 10 18:03:35 2000

Date: Mon, 10 Jul 2000 15:03: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: <963266601-v9-i3583@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 10 Jul 2000     Volume: 9 Number: 3583

Today's topics:
        Net::Ping, with RedHat 6.1 stock install (Hugh Lawson)
    Re: Net::Ping, with RedHat 6.1 stock install (David Efflandt)
    Re: Net::Ping, with RedHat 6.1 stock install (Hugh Lawson)
    Re: Net::Ping, with RedHat 6.1 stock install (David Efflandt)
        Net::SMTP question yong321@yahoo.com
    Re: Net::SMTP question <care227@attglobal.net>
        New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
        new to perl...got a question about ActivePerl Release 6 johnnswccd@my-deja.com
    Re: new to perl...got a question about ActivePerl Relea <phrxy@csv.warwick.ac.uk>
    Re: new to perl...got a question about ActivePerl Relea (Malcolm Dew-Jones)
        Newbie HTML Parse campcompguy@my-deja.com
    Re: Newbie HTML Parse (Eric Bohlman)
    Re: Newbie HTML Parse <debjit@oyeindia.com>
    Re: Newbie HTML Parse <gellyfish@gellyfish.com>
        newbie perl setup problem -- please help <lmits@btinternet.com>
    Re: newbie perl setup problem -- please help <nnickee@nnickee.com>
    Re: newbie perl setup problem -- please help (Tad McClellan)
    Re: newbie perl setup problem -- please help <d98_rli@telge.kth.se>
        Newbie problem with forms <emeier@lucent.com>
        newbie Q- how to find date difference <someguy@nospamland.com>
    Re: newbie Q- how to find date difference <adetalabi@clara.co.uk>
    Re: newbie Q- how to find date difference <lr@hpl.hp.com>
    Re: Newbie question: Sorting a list-of-hashes <dr_retribution@hotmail.com>
    Re: Newbie question: Sorting a list-of-hashes <tony_curtis32@yahoo.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 08 Jul 2000 17:44:21 GMT
From: hlawson@triad.rr.com (Hugh Lawson)
Subject: Net::Ping, with RedHat 6.1 stock install
Message-Id: <slrn8mer7m.tb.hlawson@localhost.localdomain>

Is something wrong with RedHat 6.1 setup with respect to Net::Ping?

I've not managed to get Net::Ping to work on my stock RH 6.1 setup.  This
is not a vital matter to me (I'm a hobbyist), but it bothers me that
following the models in the documentation I couldn't make it work.

I made a deja.news search, and saw several other complaints about this,
but I couldn't find a resolution.

Have others who use RH 6.1 managed this?


-- 
Hugh Lawson
Greensboro, North Carolina
hlawson@triad.rr.com



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

Date: 8 Jul 2000 22:46:20 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Net::Ping, with RedHat 6.1 stock install
Message-Id: <slrn8mfbph.qrn.efflandt@efflandt.xnet.com>

On Sat, 08 Jul 2000 17:44:21 GMT, Hugh Lawson <hlawson@triad.rr.com> wrote:
>Is something wrong with RedHat 6.1 setup with respect to Net::Ping?
>
>I've not managed to get Net::Ping to work on my stock RH 6.1 setup.  This
>is not a vital matter to me (I'm a hobbyist), but it bothers me that
>following the models in the documentation I couldn't make it work.
>
>I made a deja.news search, and saw several other complaints about this,
>but I couldn't find a resolution.
>
>Have others who use RH 6.1 managed this?

The default, tcp and udp methods are apparently broken in RH 6.1.  
Perhaps downloading and installing an updated Net::Ping would help.  I
wonder if I had trouble using this on Solaris before, because now that I
look at that script, I was parsing the output of the unix ping command.
The icmp method works, but only as root:

#!/usr/bin/perl -w
my $host = shift || 'localhost';
open(RH,"/etc/redhat-release") || die "$!";
my $rh = <RH>; chomp $rh;
close RH;
print "Pinging $host from $rh\n";
use Net::Ping;
$p = Net::Ping->new("icmp");
print "$host is ";
print "NOT " unless $p->ping($host);
print "reachable.\n";
$p->close();

As root gives me:

# ./mytest
Pinging localhost from Red Hat Linux release 6.1 (Cartman)
localhost is reachable.
# ./mytest linux.bogus
Pinging linux.bogus from Red Hat Linux release 6.1 (Cartman)
linux.bogus is NOT reachable.


-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Sun, 09 Jul 2000 00:50:57 GMT
From: hlawson@triad.rr.com (Hugh Lawson)
Subject: Re: Net::Ping, with RedHat 6.1 stock install
Message-Id: <slrn8mfk7l.16r.hlawson@localhost.localdomain>

On 8 Jul 2000 22:46:20 GMT, David Efflandt <efflandt@xnet.com> wrote:
>The default, tcp and udp methods are apparently broken in RH 6.1.  
>Perhaps downloading and installing an updated Net::Ping would help. 

Dear David,

Many thanks for the tip.  I changed your program a little to make it
something I could understand :-). It seems to work.

#!/usr/bin/perl -w  #run this as root
use Net::Ping;

foreach $host (@ARGV) {
print "Pinging $host ";
$p = Net::Ping->new("icmp");
print "$host is ";
print "NOT " unless $p->ping($host);
print "reachable.\n";
$p->close();
}
if (! @ARGV){
    print "\nUsage: ping.pl host.\n"
    }

This problem was bothering me because it was my first effort to use a
module, and I couldn't tell whether I had the syntax wrong or what.
-- 
Hugh Lawson
Greensboro, North Carolina
hlawson@triad.rr.com



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

Date: 9 Jul 2000 09:34:29 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Net::Ping, with RedHat 6.1 stock install
Message-Id: <slrn8mghoq.s78.efflandt@efflandt.xnet.com>

On Sun, 09 Jul 2000 00:50:57 GMT, Hugh Lawson <hlawson@triad.rr.com> wrote:
>On 8 Jul 2000 22:46:20 GMT, David Efflandt <efflandt@xnet.com> wrote:
>>The default, tcp and udp methods are apparently broken in RH 6.1.  
>>Perhaps downloading and installing an updated Net::Ping would help. 
>
>Dear David,
>
>Many thanks for the tip.  I changed your program a little to make it
>something I could understand :-). It seems to work.
>
>#!/usr/bin/perl -w  #run this as root
>use Net::Ping;
>
>foreach $host (@ARGV) {
>print "Pinging $host ";
>$p = Net::Ping->new("icmp");
>print "$host is ";
>print "NOT " unless $p->ping($host);
>print "reachable.\n";
>$p->close();
>}
>if (! @ARGV){
>    print "\nUsage: ping.pl host.\n"
>    }
>
>This problem was bothering me because it was my first effort to use a
>module, and I couldn't tell whether I had the syntax wrong or what.
>-- 
>Hugh Lawson
>Greensboro, North Carolina
>hlawson@triad.rr.com

I tried it in Mandrake and 'tcp' and 'udp' did not work there either, but
it is the same old Net::Ping version 2.02 that is on CPAN.  Maybe
something changed in Socket.pm and Ping.pm is not passing parameters to it
properly, since the error comes from Socket.pm (example using 'udp'):

Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16
at /usr/lib/perl5/5.00503/i386-linux/Socket.pm line 295.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Mon, 10 Jul 2000 18:13:24 GMT
From: yong321@yahoo.com
Subject: Net::SMTP question
Message-Id: <8kd3nk$sn$1@nnrp1.deja.com>

My program loops for each person and sends email like this:

$smtp=Net::SMTP->new($mailserver);
foreach $person (@person) {
$smtp->mail("$return_address");
#do other stuff like $smtp->datasend(), ->dataend(), etc.
}
$smtp->quit;

My question is, do I also need to put the first and last lines shown
above in the foreach block? I don't think I need to create the $smtp
object, destroy it, and recreate it for the next person, but not sure.
Thanks for a reply.

--
Yong Huang

(yong321@yahoo.com)


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


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

Date: Mon, 10 Jul 2000 14:22:08 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Net::SMTP question
Message-Id: <396A1450.15684EC4@attglobal.net>

yong321@yahoo.com wrote:
> 
> My question is, do I also need to put the first and last lines shown
> above in the foreach block? I don't think I need to create the $smtp
> object, destroy it, and recreate it for the next person, but not sure.
> Thanks for a reply.
> 

What happened when you tried it?


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

Date: Mon, 10 Jul 2000 14:27:55 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <smjnbb1mnu34@corp.supernews.com>

Following is a summary of articles from new posters spanning a 7 day
period, beginning at 03 Jul 2000 15:22:43 GMT and ending at
10 Jul 2000 14:27:54 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" email address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Find the News-Scan distribution on the CPAN!
      <URL:http://www.perl.com/CPAN/modules/by-module/News/>
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
    - Copyright (c) 2000 Greg Bacon.
      Verbatim copying and redistribution is permitted without royalty;
      alteration is not permitted.  Redistribution and/or use for any
      commercial purpose is prohibited.

Totals
======

Posters:  248 (52.1% of all posters)
Articles: 458 (31.0% of all articles)
Volume generated: 850.3 kb (32.2% of total volume)
    - headers:    369.4 kb (7,328 lines)
    - bodies:     466.5 kb (15,514 lines)
    - original:   325.5 kb (11,496 lines)
    - signatures: 13.9 kb (369 lines)

Original Content Rating: 0.698

Averages
========

Posts per poster: 1.8
    median: 1.0 post
    mode:   1 post - 172 posters
    s:      2.3 posts
Message size: 1901.0 bytes
    - header:     825.9 bytes (16.0 lines)
    - body:       1043.0 bytes (33.9 lines)
    - original:   727.8 bytes (25.1 lines)
    - signature:  31.0 bytes (0.8 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

   19    49.0 ( 26.8/ 17.3/ 10.7)  Keith Calvert Ivey <kcivey@cpcug.org>
   13    28.0 ( 13.5/ 12.9/  6.3)  Magic <Magic@mattnet.freeserve.co.uk>
   13    16.4 (  8.7/  7.6/  7.1)  zawy <zawy@yahoo.com>
   11    20.0 (  9.7/  8.9/  1.8)  Ade Talabi <adetalabi@clara.co.uk>
   11    15.5 (  9.5/  6.0/  2.6)  Bacbalabby <user@host.com>
    9    12.2 (  6.4/  5.8/  3.0)  "Paul Taylor" <pap@sotonians.org.uk>
    9    14.3 (  6.8/  7.4/  3.7)  "Brendon Caligari" <bcaligari@shipreg.com>
    8    12.3 (  6.8/  5.5/  3.0)  "Jim Kauzlarich" <o1technospam@skyenet.nospam.net>
    7     8.2 (  4.4/  3.8/  3.8)  Kirill Miazine <news@fido.workone.com>
    7    10.6 (  5.6/  4.9/  1.8)  Rafael Garcia-Suarez <rgarciasuarez@free.fr>

These posters accounted for 7.2% of all articles.

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

  51.5 (  1.7/ 49.8/ 22.3)      2  Ariel Lia <Ariellia@garden.com>
  49.0 ( 26.8/ 17.3/ 10.7)     19  Keith Calvert Ivey <kcivey@cpcug.org>
  29.2 (  1.9/ 27.3/ 23.7)      3  melorama@nospam.gov
  28.0 ( 13.5/ 12.9/  6.3)     13  Magic <Magic@mattnet.freeserve.co.uk>
  20.0 (  9.7/  8.9/  1.8)     11  Ade Talabi <adetalabi@clara.co.uk>
  16.8 (  6.5/ 10.3/  5.7)      6  "Kenny Lim" <kennylim@techie.net>
  16.4 (  8.7/  7.6/  7.1)     13  zawy <zawy@yahoo.com>
  15.8 (  3.3/ 12.6/  9.3)      4  Taurean <jaurangNOjaSPAM@crosswinds.net.invalid>
  15.5 (  9.5/  6.0/  2.6)     11  Bacbalabby <user@host.com>
  14.3 (  6.8/  7.4/  3.7)      9  "Brendon Caligari" <bcaligari@shipreg.com>

These posters accounted for 9.7% of the total volume.

Top 10 Posters by OCR (minimum of three posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

1.000  (  3.3 /  3.3)      4  gevens@my-deja.com
1.000  (  3.8 /  3.8)      7  Kirill Miazine <news@fido.workone.com>
0.967  (  1.0 /  1.1)      5  ufssin@my-deja.com
0.965  (  2.3 /  2.4)      3  "James Nelson" <james@kcnet.com>
0.961  (  2.1 /  2.2)      4  Synpax <senatorpalpatineNOseSPAM@dereth.net.invalid>
0.932  (  7.1 /  7.6)     13  zawy <zawy@yahoo.com>
0.932  (  1.7 /  1.8)      3  Sven Rudolph <sven@rheingau.netsurf.de>
0.878  (  5.8 /  6.6)      4  Joe Brenner <doom@kzsu.stanford.edu>
0.868  ( 23.7 / 27.3)      3  melorama@nospam.gov
0.757  (  1.7 /  2.2)      4  "Brendon Caligari" <brendon@shipreg.com>

Bottom 10 Posters by OCR (minimum of three posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.497  (  3.7 /  7.4)      9  "Brendon Caligari" <bcaligari@shipreg.com>
0.492  (  6.3 / 12.9)     13  Magic <Magic@mattnet.freeserve.co.uk>
0.490  (  0.8 /  1.6)      4  Ilmari Karonen <usenet11147@itz.pp.sci.fi>
0.430  (  2.6 /  6.0)     11  Bacbalabby <user@host.com>
0.419  (  2.1 /  5.1)      6  "John Coke" <astro@shell.athenet.net>
0.373  (  1.8 /  4.9)      7  Rafael Garcia-Suarez <rgarciasuarez@free.fr>
0.367  (  0.8 /  2.2)      4  "Peter Sundstrom" <peter.sundstrom@eds.com>
0.354  (  0.9 /  2.7)      4  jerome.oneil@360.com
0.253  (  1.0 /  4.1)      4  "daggins" <m@daggins.com>
0.205  (  1.8 /  8.9)     11  Ade Talabi <adetalabi@clara.co.uk>

33 posters (13%) had at least three posts.

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      39  alt.perl
      31  comp.lang.perl.modules
      31  comp.lang.perl
      11  comp.lang.perl.moderated
       7  comp.lang.perl.tk
       7  alt.perl.sockets
       7  alt.comp.perlcgi.freelance
       7  comp.security.unix
       6  alt.comp.lang.superlang
       5  uk.comp.os.linux

Top 10 Crossposters
===================

Articles  Address
--------  -------

       8  "Kenny Lim" <kennylim@techie.net>
       6  "James Nelson" <james@kcnet.com>
       6  "Treku" <Treku@w.pl>
       4  "daggins" <m@daggins.com>
       4  Joseph Ziegler <joseph@denalii.com>
       4  "nicolas" <webmaster@archiTacTic.com>
       3  Jim Moore <jmoore@image.kodak.com>
       3  JWJ van der Drift <jvddrift@aaa.nl>
       2  S P Arif Sahari Wibowo <arifsaha@yahoo.com>
       2  Secret Squirrel <squirrel@echelon.alias.net>


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

Date: Fri, 07 Jul 2000 19:30:27 GMT
From: johnnswccd@my-deja.com
Subject: new to perl...got a question about ActivePerl Release 631 errors
Message-Id: <8k5b4j$326$1@nnrp1.deja.com>

i just got ActivePerl Release 631, and i started writing a counter for
a web page. it works locally, and on the web server, but when i
run "perl -w counter.cgi" i get an error and i'm not sure what it
means.

Error (x5): "Use of uninitialized value in concatenation (.) at
counter.cgi line 23."

it's giving me grief with this print command...

foreach $key (keys %track) {
  print TRACK "$key: $track{$key}\n";
}

am i doing something wrong? counter.cgi follows below.

john

#!/usr/bin/perl

$countingfile = "data/count.dat";
$trackingfile = "data/track.dat";

open (COUNT, $countingfile);
$counter=<COUNT>;
close (COUNT);

open (COUNT, ">$countingfile");
$counter +=1;
print COUNT $counter;
close (COUNT);

%track = ( DATE_LOCAL =>      $ENV{'DATE_LOCAL'},
           REMOTE_ADDR =>     $ENV{'REMOTE_ADDR'},
           REMOTE_HOST =>     $ENV{'REMOTE_HOST'},
           HTTP_USER_AGENT => $ENV{'HTTP_USER_AGENT'},
           HTTP_REFERER =>    $ENV{'HTTP_REFERER'}     );

open (TRACK, ">>$trackingfile");
foreach $key (keys %track) {
  print TRACK "$key: $track{$key}\n";
}
close (TRACK);


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


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

Date: Fri, 7 Jul 2000 21:06:23 +0100
From: "John J. Lee" <phrxy@csv.warwick.ac.uk>
Subject: Re: new to perl...got a question about ActivePerl Release 631 errors
Message-Id: <Pine.SOL.4.21.0007072101320.28875-100000@mimosa.csv.warwick.ac.uk>

On Fri, 7 Jul 2000 johnnswccd@my-deja.com wrote:

> i just got ActivePerl Release 631, and i started writing a counter for
> a web page. it works locally, and on the web server, but when i
> run "perl -w counter.cgi" i get an error and i'm not sure what it
> means.
> 
> Error (x5): "Use of uninitialized value in concatenation (.) at
> counter.cgi line 23."
> 
> it's giving me grief with this print command...
> 
> foreach $key (keys %track) {
>   print TRACK "$key: $track{$key}\n";
> }

Well, I think it pretty much means what it says: you haven't initialised a
value that you're using - presumably $track{$key} has not been initialised
for some $key because $ENV{'WHATEVER'} was undefined.  Because you used
the -w switch, you get a warning about it.

> am i doing something wrong? counter.cgi follows below.
[...]
> #!/usr/bin/perl
[...]
> %track = ( DATE_LOCAL =>      $ENV{'DATE_LOCAL'},
>            REMOTE_ADDR =>     $ENV{'REMOTE_ADDR'},
>            REMOTE_HOST =>     $ENV{'REMOTE_HOST'},
>            HTTP_USER_AGENT => $ENV{'HTTP_USER_AGENT'},
>            HTTP_REFERER =>    $ENV{'HTTP_REFERER'}     );
> 
> open (TRACK, ">>$trackingfile");
> foreach $key (keys %track) {
>   print TRACK "$key: $track{$key}\n";
> }
[...]


John



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

Date: 7 Jul 2000 21:26:22 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: new to perl...got a question about ActivePerl Release 631 errors
Message-Id: <3966ad6e@news.victoria.tc.ca>

John J. Lee (phrxy@csv.warwick.ac.uk) wrote:
: On Fri, 7 Jul 2000 johnnswccd@my-deja.com wrote:

: > i just got ActivePerl Release 631, and i started writing a counter for
: > a web page. it works locally, and on the web server, but when i
: > run "perl -w counter.cgi" i get an error and i'm not sure what it
: > means.
: > 
: > foreach $key (keys %track) {
: >   print TRACK "$key: $track{$key}\n";
: > }

: Well, I think it pretty much means what it says: you haven't initialised a
: value that you're using - presumably $track{$key} has not been initialised
: for some $key because $ENV{'WHATEVER'} was undefined.  Because you used

In other words one of the $ENV{xxx} is not defined.

: > #!/usr/bin/perl
: [...]
: > %track = ( DATE_LOCAL =>      $ENV{'DATE_LOCAL'},
: >            REMOTE_ADDR =>     $ENV{'REMOTE_ADDR'},
: >            REMOTE_HOST =>     $ENV{'REMOTE_HOST'},
: >            HTTP_USER_AGENT => $ENV{'HTTP_USER_AGENT'},
: >            HTTP_REFERER =>    $ENV{'HTTP_REFERER'}     );
: > 

The real reason I'm writing is that you probably need to use flock to
ensure that your counter works correctly.

If two people run your script at the same time then the counter may not
get updated correctly.



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

Date: Thu, 06 Jul 2000 20:07:53 GMT
From: campcompguy@my-deja.com
Subject: Newbie HTML Parse
Message-Id: <8k2ouh$enm$1@nnrp1.deja.com>

I have a simple webpage which I would like to parse with perl. I
have the html::parse modules installed, but because I am
unfamiliar with OOP, I can't figure out how to get the module
working properly. If you could please direct me towards a cut and
dried way of extracting text from HTML, I would grealty appreciate it.
Thank you.


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


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

Date: 6 Jul 2000 23:41:43 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Newbie HTML Parse
Message-Id: <8k35fn$9ls$4@slb7.atl.mindspring.net>

campcompguy@my-deja.com wrote:
: I have a simple webpage which I would like to parse with perl. I
: have the html::parse modules installed, but because I am
: unfamiliar with OOP, I can't figure out how to get the module
: working properly. If you could please direct me towards a cut and
: dried way of extracting text from HTML, I would grealty appreciate it.

You'll probably find HTML::TokeParser easier to use than the "raw" 
HTML::Parser interface.  You might also want to check out Matt Sergeant's 
XML::Pyx, whose latest version includes an HTML-to-PYX parser.  PYX is a 
very simple line-oriented representation of an XML or HTML document, 
where each line can be a start tag, attribute name/value pair, end tag, 
or chunk of text, with the first character indicating which one it is.



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

Date: Fri, 7 Jul 2000 10:53:46 +0530
From: "Debjit" <debjit@oyeindia.com>
Subject: Re: Newbie HTML Parse
Message-Id: <8k4uds$eik$1@news.vsnl.net.in>

SEE How do I remove HTML from a string?
in perlfaq9
campcompguy@my-deja.com wrote in message <8k2ouh$enm$1@nnrp1.deja.com>...
>I have a simple webpage which I would like to parse with perl. I
>have the html::parse modules installed, but because I am
>unfamiliar with OOP, I can't figure out how to get the module
>working properly. If you could please direct me towards a cut and
>dried way of extracting text from HTML, I would grealty appreciate it.
>Thank you.
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.




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

Date: Fri, 07 Jul 2000 16:24:19 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Newbie HTML Parse
Message-Id: <Tun95.1631$iP2.153255@news.dircon.co.uk>

On Thu, 06 Jul 2000 20:07:53 GMT, campcompguy@my-deja.com Wrote:
> I have a simple webpage which I would like to parse with perl. I
> have the html::parse modules installed, but because I am
> unfamiliar with OOP, I can't figure out how to get the module
> working properly. If you could please direct me towards a cut and
> dried way of extracting text from HTML, I would grealty appreciate it.


<http://www.gellyfish.com/htexamples/>


/J\


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

Date: Mon, 10 Jul 2000 13:45:05 +0100
From: "OrganZium" <lmits@btinternet.com>
Subject: newbie perl setup problem -- please help
Message-Id: <8kcgoo$eu5$1@uranium.btinternet.com>

Hi, I am a perl newbie. Recently I bought a book teaching perl but I can
hardly find a free web provider that supports Perl. Therefore I downloaded
the program ACTIVE PERL from www.activestate.com and tried to test my perl
scripts out offline on my local computer (Win98) but I have experienced
difficulties setting up Perl on windows. I use Microsoft Personal Web server
and Active perl is installed on C:\perl. I don't know how to set up the
virtual directories and how to put the perl location at the top of my perl
script. I try to test the script by using IE4.0 without the header
(#!usr/local/bin/perl):

print "Content-type: text/html\n\n";
print "Hello, testing testing";

the browser says

HTTP 500 - Internal server error and the page can not be displayed

What is wrong??? How do I execute the script??? how do I set up perl
correctly?
please help


-Hans




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

Date: Mon, 10 Jul 2000 08:24:15 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: newbie perl setup problem -- please help
Message-Id: <751B8190306A0CDD.C1DCC3F5302A8A99.83A7EBBA0C3922BF@lp.airnews.net>

On Mon, 10 Jul 2000 13:45:05 +0100, someone claiming to be "OrganZium"
<lmits@btinternet.com> said:

>Hi, I am a perl newbie. Recently I bought a book teaching perl but I can
>hardly find a free web provider that supports Perl. Therefore I downloaded
>the program ACTIVE PERL from www.activestate.com and tried to test my perl
>scripts out offline on my local computer (Win98) but I have experienced
>difficulties setting up Perl on windows. I use Microsoft Personal Web server
>and Active perl is installed on C:\perl. I don't know how to set up the
>virtual directories and how to put the perl location at the top of my perl
>script. I try to test the script by using IE4.0 without the header
>(#!usr/local/bin/perl):

#!perl -w
will work for you as long as ActiveState's Perl (not PERL) is
installed correctly.

>print "Content-type: text/html\n\n";
>print "Hello, testing testing";

instead of trying this from your browser, try it in the dos command
window (Start -> Run -> (type) command (hit enter)

cd (change directory) to the directory where you saved that script and
type:  perl nameofthescript.pl (hit enter)

does it print what you expected it to print?

>the browser says

>HTTP 500 - Internal server error and the page can not be displayed

>What is wrong??? How do I execute the script??? how do I set up perl
>correctly? please help

This is in the Perl documentation which is installed right there on
your system:  Start -> Programs -> Active Perl -> Online
Documentation.  Scroll down the Contents to ActivePerl FAQ -> Web
Server Config.  (Read the page on Web programming, too)

HTH
Nnickee



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

Date: Mon, 10 Jul 2000 08:32:35 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: newbie perl setup problem -- please help
Message-Id: <slrn8mjgj3.tj2.tadmc@magna.metronet.com>

On Mon, 10 Jul 2000 13:45:05 +0100, OrganZium <lmits@btinternet.com> wrote:

>Therefore I downloaded
>the program ACTIVE PERL from www.activestate.com and tried to test my perl
>scripts out offline on my local computer (Win98) but I have experienced
>difficulties setting up Perl on windows. 


Does Perl work from the command line?

It should.


>I use Microsoft Personal Web server
>and Active perl is installed on C:\perl. I don't know how to set up the
>virtual directories and how to put the perl location at the top of my perl
>script.


Server setup issues are off-topic in this newsgroup.

There are other newsgroups for that:

      comp.infosystems.www.servers.ms-windows


>HTTP 500 - Internal server error and the page can not be displayed
>
>What is wrong??? 


   perldoc -q 500


>How do I execute the script??? how do I set up perl
>correctly?


Get perl working from the command line before you try to use
it in a CGI environment.


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


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

Date: Mon, 10 Jul 2000 15:22:53 +0200
From: Rikard Lindstrom <d98_rli@telge.kth.se>
To: OrganZium <lmits@btinternet.com>
Subject: Re: newbie perl setup problem -- please help
Message-Id: <3969CE2D.EB800642@telge.kth.se>

OrganZium wrote:

> Hi, I am a perl newbie. Recently I bought a book teaching perl but I can
> hardly find a free web provider that supports Perl. Therefore I downloaded
> the program ACTIVE PERL from www.activestate.com and tried to test my perl
> scripts out offline on my local computer (Win98) but I have experienced
> difficulties setting up Perl on windows. I use Microsoft Personal Web server
> and Active perl is installed on C:\perl. I don't know how to set up the
> virtual directories and how to put the perl location at the top of my perl
> script. I try to test the script by using IE4.0 without the header
> (#!usr/local/bin/perl):
>
> print "Content-type: text/html\n\n";
> print "Hello, testing testing";
>
> the browser says
>
> HTTP 500 - Internal server error and the page can not be displayed
>
> What is wrong??? How do I execute the script??? how do I set up perl
> correctly?
> please help
>
> -Hans

Hi!
I am a newbie too, but I guess u have to add some html tags, inorder to display
it on the web.
try this :

print "Content-type: text/html\n\n";
print <<endofhtml;
<html>
<head><title>testing</title></head>
<body>
endofhtml
;
print "testing some perl!!!\n";
print "</body>\n";
print "</html>";




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

Date: Thu, 06 Jul 2000 14:11:37 -0500
From: Elizabeth Meier <emeier@lucent.com>
Subject: Newbie problem with forms
Message-Id: <3964D9E9.56B67279@lucent.com>

Hello, I am trying to create something of a nested form.  What I have now is an
html file which calls a perl file.  That perl file needs to read in the input
from the html and ask questions for security or printing purposes.  

Here is my code.  When I run it I set $output = "todir" and $dataflow = "with". 
So what I what it to do is set of the data fields and labels and then wait for
user input and then find out if the user is valid ($user = "beth" and $password
= "ciao").  

This is what it prints out instead:

You have chosen bound 1 to be printed to a directory with data flow diagrams.

Please enter your user name

(text field)

Please enter your user password

(text field)

good job!
("submit query" and "reset" buttons)


when I hit "submit" no matter what I type it it responds "oh well.."  (which it
should no hit because of the if/else statement!).

here's my code!

Thanks for your help!


#!/opt/x11r6/bin/perl
#cgi script with CGI.pm

use CGI param, header, p;

#use_named_parameters();

$query = CGI::new();
$query2 = CGI::new();
$output = param("output");
$dataflow = param("dataflow");
$bound = param("bound");

print header();

if (("$output"eq"todir")&&("$dataflow"eq"with")) {
        print p("You have chosen bound $bound to be printed to a directory with
data flow diagrams.");

        print $query->start_multipart_form();

        print p("Please enter your user name");
        print $query->textfield(-name=>'user');
        print p("Please enter your user password");
        print $query->password_field(-name=>'password');

        #$user = $query2->param("user");
        #$password = $query2->param("password");

        print $query->submit(-onClick=>nameCheck($query2));
        print $query->reset;
}
else {
print p("oh well..");
}
        sub nameCheck {

        if(($query2->param("user")eq"beth")&& ($query2->param("password")
eq"ciao")) {
        print p("good job!");
        }
        else{
        print p("incorrect user name and password!");
        }
}
exit(0);


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

Date: Wed, 5 Jul 2000 11:36:00 +0800
From: "Tony" <someguy@nospamland.com>
Subject: newbie Q- how to find date difference
Message-Id: <3962aced@news02.imsbiz.com>

Hi,

I need to calculate someone's age after they input their date of birth.  All
I need to do is subtract their DOB and subtract it from the current date to
give me their age.  I've been doing it the wrong way by subtracting day,
month and year separately, so the age comes out incorrect at times.  Is
there a simply way using some sort of PERL date function thingy?

Thanks,

Tony.





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

Date: Wed, 05 Jul 2000 10:37:19 +0100
From: Ade Talabi <adetalabi@clara.co.uk>
Subject: Re: newbie Q- how to find date difference
Message-Id: <396301CF.473A7595@clara.co.uk>

Tony wrote:
> 
> Hi,
> 
> I need to calculate someone's age after they input their date of birth.  All
> I need to do is subtract their DOB and subtract it from the current date to
> give me their age.  I've been doing it the wrong way by subtracting day,
> month and year separately, so the age comes out incorrect at times.  Is
> there a simply way using some sort of PERL date function thingy?
> 
> Thanks,
> 
> Tony.
quick and dirty convert it to time() which calculates the number of
seconds since 1 Jan 1900 (I think) divide the difference against the
number of seconds in a year to get the age..

Integer var = (time() - time(DOB))/NoOfSecondInAYear

-- 
We see, whatever we want to see, whether visible or not 
- AT. June 2000.


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

Date: Wed, 5 Jul 2000 10:45:44 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: newbie Q- how to find date difference
Message-Id: <MPG.13cd1427c5588f0398aba9@nntp.hpl.hp.com>

In article <396301CF.473A7595@clara.co.uk> on Wed, 05 Jul 2000 10:37:19 
+0100, Ade Talabi <adetalabi@clara.co.uk> says...
> Tony wrote:
> > I need to calculate someone's age after they input their date of birth.  All
> > I need to do is subtract their DOB and subtract it from the current date to
> > give me their age.  I've been doing it the wrong way by subtracting day,
> > month and year separately, so the age comes out incorrect at times.  Is
> > there a simply way using some sort of PERL date function thingy?
> > 
> quick and dirty convert it to time() which calculates the number of
> seconds since 1 Jan 1900 (I think) divide the difference against the
                            ^^^^^^^
> number of seconds in a year to get the age..
> 
> Integer var = (time() - time(DOB))/NoOfSecondInAYear

Too quick and too dirty.  Had you taken the trouble to look at the 
documentation for time() before posting your conjecture about what its 
epoch might be, you would have discovered that the time()function takes 
no arguments, which makes your proposed approach inadequate, to say the 
least.

The correct way to do what you propose is found in perlfaq4: "How can I 
take a string and turn it into epoch seconds?"

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Mon, 3 Jul 2000 12:19:29 -0400
From: "Dr. Retribution" <dr_retribution@hotmail.com>
Subject: Re: Newbie question: Sorting a list-of-hashes
Message-Id: <8jqe3d019h1@enews3.newsguy.com>


"Stephen Kloder" <stephen.kloder@gtri.gatech.edu> wrote in message
news:395D072F.D30DE042@gtri.gatech.edu...
> "Dr. Retribution" wrote:
>
> > Given the following structure:
> >
> > %scoredatabase = (
> >         [
> >         player => "Joe",
> >         frame1 => "5",
> >         frame2 => "8" ,
> >         frame3 => "1" ,
> >         total => "14"
> >         ]
> >     ... more players ...
> > ) ;
> >
> >     How can I sort the list on the contents of the "TOTAL" element of
each
> > individual hash?
> >
> >     TIA
>
> perldoc -f sort

Perhaps I should mention that I'm not in possession of a shell account.




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

Date: 03 Jul 2000 11:54:58 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Newbie question: Sorting a list-of-hashes
Message-Id: <87ya3j17dp.fsf@limey.hpcc.uh.edu>

>> On Mon, 3 Jul 2000 12:19:29 -0400,
>> "Dr. Retribution" <dr_retribution@hotmail.com> said:

>> perldoc -f sort

> Perhaps I should mention that I'm not in possession of a
> shell account.

So?  Install perl on your local machine...or read the doc.
on the web:

  http://www.perl.com/pub/v/documentation

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

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


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