[30126] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1369 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 18 15:09:10 2008

Date: Mon, 17 Mar 2008 18:09:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 17 Mar 2008     Volume: 11 Number: 1369

Today's topics:
    Re: cannot post message to perl beginners <abigail@abigail.be>
    Re: cannot post message to perl beginners <someone@example.com>
    Re: cannot post message to perl beginners <tadmc@seesig.invalid>
    Re: decrease MAC <ben@morrow.me.uk>
    Re: decrease MAC <jameslockie@mail.com>
    Re: decrease MAC <tadmc@seesig.invalid>
    Re: decrease MAC <jurgenex@hotmail.com>
    Re: decrease MAC <ben@morrow.me.uk>
    Re: decrease MAC <jurgenex@hotmail.com>
        Difference between log timestamps <rssv99@gmail.com>
    Re: FAQ 5.39 Why do I get weird spaces when I print an  <bik.mido@tiscalinet.it>
    Re: Inside-out objects are slow! (or how to accelerate  <tzz@lifelogs.com>
    Re: Inside-out objects are slow! (or how to accelerate  xhoster@gmail.com
        Installing a perl module manually on windows <nospam@nospam.com>
        LWP::Simple yields "protocol" error (was Re: Need Perl  (J.D. Baldwin)
        Need Perl module to get <TITLE> tag of a web page (J.D. Baldwin)
    Re: Need Perl module to get <TITLE> tag of a web page <koszalekopalek@interia.pl>
    Re: Need Perl module to get <TITLE> tag of a web page <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: Need Perl module to get <TITLE> tag of a web page <noreply@gunnar.cc>
    Re: Need Perl module to get <TITLE> tag of a web page (J.D. Baldwin)
    Re: Need Perl module to get <TITLE> tag of a web page <tadmc@seesig.invalid>
    Re: Need Perl module to get <TITLE> tag of a web page <d@perlnow.com>
    Re: test <abigail@abigail.be>
    Re: why is return always 0? sandy_saydakov@yahoo.com
    Re: why is return always 0? xhoster@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 17 Mar 2008 20:34:49 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: cannot post message to perl beginners
Message-Id: <slrnfttlf8.onm.abigail@alexandra.abigail.be>

                                   _
John (john1949@yahoo.com) wrote on VCCCXII September MCMXCIII in
<URL:news:frmg3e$1pk$1@news.albasani.net>:
~~  This is odd.  I can post to this newsgroup but not to perl.beginners.
~~  
~~  Anyone any idea why this is so?


Are you using Net::NNTP? If so, what error message do you get?
Are you sure it's a Perl problem? Do you really think this is
the place to complain, and not your provider?



Abigail
-- 
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))


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

Date: Mon, 17 Mar 2008 22:40:44 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: cannot post message to perl beginners
Message-Id: <MrCDj.113257$C61.73619@edtnps89>

John wrote:
> This is odd.  I can post to this newsgroup but not to perl.beginners.
> 
> Anyone any idea why this is so?

This is a Usenet newsgroup.  perl.beginners is a mailing list.  Go to 
this URL to subscribe:

http://lists.cpan.org/showlist.cgi?name=beginners



John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall


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

Date: Mon, 17 Mar 2008 18:17:31 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: cannot post message to perl beginners
Message-Id: <slrnfttv0b.kip.tadmc@tadmc30.sbcglobal.net>

John <john1949@yahoo.com> wrote:

> This is odd.  I can post to this newsgroup but not to perl.beginners.


perl.beginners is not a newsgroup, it is a mailing list (with, perhaps,
a mail-to-news gateway?).


> Anyone any idea why this is so?


You will need to ask your ISP how to treat it as a newsgroup, 
or use it in a mailing list fashion.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Mon, 17 Mar 2008 20:06:40 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: decrease MAC
Message-Id: <gjv2b5-0ao.ln1@osiris.mauzo.dyndns.org>


Quoth jammer <jameslockie@mail.com>:
> I have a hex number which is actually a MAC address and I want to find
> the MAC immediately before.
> 0000AAAA9999
> 
> Is there a way to treat it as a hex number and do -1 one on it?

my $MAC = '0000AAAA9999';
printf "%x\n", hex($MAC) - 1;

Ben



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

Date: Mon, 17 Mar 2008 13:37:02 -0700 (PDT)
From: jammer <jameslockie@mail.com>
Subject: Re: decrease MAC
Message-Id: <88ffa7b5-2041-4b97-bb55-9041f9659538@i7g2000prf.googlegroups.com>

On Mar 17, 4:06 pm, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth jammer <jamesloc...@mail.com>:
>
> > I have a hex number which is actually a MAC address and I want to find
> > the MAC immediately before.
> > 0000AAAA9999
>
> > Is there a way to treat it as a hex number and do -1 one on it?
>
> my $MAC = '0000AAAA9999';
> printf "%x\n", hex($MAC) - 1;
>
> Ben

What if there are not 4 leading 0s.
my $MAC = '000BAAAA9999';
printf "%x\n", hex($MAC) - 1;
Integer overflow in hexadecimal number


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

Date: Mon, 17 Mar 2008 18:38:35 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: decrease MAC
Message-Id: <slrnftu07r.kip.tadmc@tadmc30.sbcglobal.net>

jammer <jameslockie@mail.com> wrote:
> On Mar 17, 4:06 pm, Ben Morrow <b...@morrow.me.uk> wrote:
>> Quoth jammer <jamesloc...@mail.com>:
>>
>> > I have a hex number which is actually a MAC address and I want to find
>> > the MAC immediately before.
>> > 0000AAAA9999
>>
>> > Is there a way to treat it as a hex number and do -1 one on it?
>>
>> my $MAC = '0000AAAA9999';
>> printf "%x\n", hex($MAC) - 1;
>>
>> Ben
>
> What if there are not 4 leading 0s.


You have completely missed the cause of the effect.


> my $MAC = '000BAAAA9999';


What _is_ significant is the number of bits required to represent the number.

ie. 32 bits required for Ben's number, but 36 bits are required
for your number.


> printf "%x\n", hex($MAC) - 1;
> Integer overflow in hexadecimal number


What do you know? 

The message is exactly right, assuming you are on a 32-bit processor.  :-)


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Mon, 17 Mar 2008 23:33:21 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: decrease MAC
Message-Id: <ghvtt31d4rngmu8nmnescn9cnfbp9jq5rr@4ax.com>

jammer <jameslockie@mail.com> wrote:
>I have a hex number which is actually a MAC address and I want to find
>the MAC immediately before.
>0000AAAA9999
>
>Is there a way to treat it as a hex number and do -1 one on it?

"God made the natural numbers, all else is men's work"
There is no such thing as a hex(adezimal) number. You got numbers and that
is what Perl knows about and where you can add and subtract and do other
fancy stuff with.
 
And then you can input as well as print those numbers in different
representations, e.g. as a hexadecimal representation of a number. 
- to convert the hex representation of a number into a number use hex()
- to print the hexadezimal representation of a number use printf

jue 


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

Date: Mon, 17 Mar 2008 23:36:55 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: decrease MAC
Message-Id: <ntb3b5-rqp.ln1@osiris.mauzo.dyndns.org>


Quoth Tad J McClellan <tadmc@seesig.invalid>:
> jammer <jameslockie@mail.com> wrote:
> 
> > my $MAC = '000BAAAA9999';
> 
> What _is_ significant is the number of bits required to represent the number.
> 
> ie. 32 bits required for Ben's number, but 36 bits are required
> for your number.
> 
> > printf "%x\n", hex($MAC) - 1;
> > Integer overflow in hexadecimal number
> 
> What do you know? 
> 
> The message is exactly right, assuming you are on a 32-bit processor.  :-)

And there are two solutions: use a perl built for 64-bit integers
(practically every processor nowadays has a 64-bit integral type, and
perl can usually use these if asked to); or use 'bigint', which will
allow arbitrary-sized integers at the expense of some speed.

Ben



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

Date: Mon, 17 Mar 2008 23:57:39 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: decrease MAC
Message-Id: <c01ut3581oban6jhs1hl84i73ocqfvjho0@4ax.com>

jammer <jameslockie@mail.com> wrote:
>On Mar 17, 4:06 pm, Ben Morrow <b...@morrow.me.uk> wrote:
>> Quoth jammer <jamesloc...@mail.com>:
>> > 0000AAAA9999
>> > Is there a way to treat it as a hex number and do -1 one on it?
>>
>> my $MAC = '0000AAAA9999';
>> printf "%x\n", hex($MAC) - 1;
>
>What if there are not 4 leading 0s.

So what? Doesn't matter.

>my $MAC = '000BAAAA9999';
>printf "%x\n", hex($MAC) - 1;
>Integer overflow in hexadecimal number

That error message simply indicates that the numerical value exceeds the
largest possible number in this version of the perl interpreter.
What is the output of 'perl -V' on your system?

Maybe the bigint module will help on systems with a low maxint, but that is
just a guess.

jue


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

Date: Mon, 17 Mar 2008 18:08:35 -0700 (PDT)
From: R C V <rssv99@gmail.com>
Subject: Difference between log timestamps
Message-Id: <7b364ad5-228b-479e-b762-170ac5cc4bf7@z38g2000hsc.googlegroups.com>

Hi,
    Can someone tell if they know of any perl modules which can
find the difference between 2 timestamps in a log file..

The timestamp format is as follows:
20080317 130146543
20080317 130156581

So the difference here is 38 msec.

Thanks !
R C


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

Date: Mon, 17 Mar 2008 23:08:27 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: FAQ 5.39 Why do I get weird spaces when I print an array of lines?
Message-Id: <qqqtt31amg7dp5tr9m3q9sj2rrv1kg7kmf@4ax.com>

On Mon, 17 Mar 2008 09:46:28 -0500, Ted Zlatanov <tzz@lifelogs.com>
wrote:

>UG> technically you are correct but $" is rarely changed by newbies. its
>UG> default value is space so the FAQ addresses that issue. it could be
>UG> expanded to mention $" and perlvar but that may be too much info for a
>UG> simple FAQ answer.
>
>The problem is that the simple FAQ answer is wrong exactly when people
>may be looking for reasons why there are weird separators in a list.

Seconded.

>Note also that it doesn't just 'join' the elements but it also prints
>them, which is obvious but still incorrect in the FAQ.

What is "it"? It's not clear from the context, because print() does
print them, but it's up to the double quotes a.k.a. qq() to join
interpolated arrays.

  my $s = "@{[qw/foo bar baz/]}";
  print $s;


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Mon, 17 Mar 2008 15:20:14 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Inside-out objects are slow! (or how to accelerate OO Perl?)
Message-Id: <86myox85mp.fsf@lifelogs.com>

On Mon, 17 Mar 2008 11:18:47 -0700 (PDT) Koszalek Opalek <koszalekopalek@interia.pl> wrote: 

KO> Actually, I've been entertaining the idea of rewriting the module in
KO> C/C++ for some time. Chances are it would make it blindingly fast,
KO> but the ease and convenience of Perl (and the ability to hack/extend
KO> it by anyone) is not something I want to give up lightly.

Try Inline::C.  It's a very good compromise between C and Perl.

Ted


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

Date: 17 Mar 2008 21:28:09 GMT
From: xhoster@gmail.com
Subject: Re: Inside-out objects are slow! (or how to accelerate OO Perl?)
Message-Id: <20080317172811.873$rm@newsreader.com>

Ted Zlatanov <tzz@lifelogs.com> wrote:
> On Mon, 17 Mar 2008 11:18:47 -0700 (PDT) Koszalek Opalek
> <koszalekopalek@interia.pl> wrote:
>
> KO> Actually, I've been entertaining the idea of rewriting the module in
> KO> C/C++ for some time. Chances are it would make it blindingly fast,
> KO> but the ease and convenience of Perl (and the ability to hack/extend
> KO> it by anyone) is not something I want to give up lightly.
>
> Try Inline::C.  It's a very good compromise between C and Perl.

I'm a fan of Inline::C, but I don't see it being very good for this type of
OO, where you have a very large number of very light-weight objects.  To
get good benefits, you would probably have to push the container of the
objects--not just the objects themselves--plus all operations operating on
the container, down into C.


Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

Date: Mon, 17 Mar 2008 23:34:04 -0000
From: "Nospam" <nospam@nospam.com>
Subject: Installing a perl module manually on windows
Message-Id: <frmv6h$g5v$1@north.jnrs.ja.net>

does anyone know how I might be able to manually install an activeperl 
module, for some reason I cannot install any module via activeperl perl 
package manager, how can I manually install an activeperl module after 
downloading the  tar file? 




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

Date: Tue, 18 Mar 2008 00:19:40 +0000 (UTC)
From: INVALID_SEE_SIG@example.com.invalid (J.D. Baldwin)
Subject: LWP::Simple yields "protocol" error (was Re: Need Perl module to get <TITLE> tag of a web page)
Message-Id: <frn1qr$6ds$1@reader2.panix.com>



The other replies to my post suggested LWP with other tools.  Now I
cannot get LWP to work with a valid proxy setting.  My script will
work with the http_proxy variable unset ... but I'm still curious why
this should be so (perl 5.8.8, LWP::Simple 1.4.1):

$ http_proxy='' perl -MLWP::Simple -e 'getprint "http://www.sn.no"' | head
<!--Cookien sier:1000004--><!--Cookien sier:1000004--><!--Cookien sier:1000004--><!--Cookien sier:1000004--><!--Cookien sier:1000004--><!--Cookien sier:1000004--><!--Cookien sier:1000004--><!--Cookien sier:1000004--><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

[...]

$ http_proxy='valid_host' perl -MLWP::Simple -e 'getprint "http://www.sn.no"' | head
501 Protocol scheme '' is not supported <URL:http://www.sn.no>
$

Googling is no help, examining the RC is no help.  Any suggestions?
-- 
  _+_ From the catapult of |If anyone disagrees with any statement I make, I
_|70|___:)=}- J.D. Baldwin |am quite prepared not only to retract it, but also
\      /  baldwin@panix.com|to deny under oath that I ever made it. -T. Lehrer
***~~~~-----------------------------------------------------------------------


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

Date: Mon, 17 Mar 2008 20:32:56 +0000 (UTC)
From: INVALID_SEE_SIG@example.com.invalid (J.D. Baldwin)
Subject: Need Perl module to get <TITLE> tag of a web page
Message-Id: <frmkho$iht$1@reader2.panix.com>



I've spent an hour searching on CPAN and there are simply too many
web-related modules and no good way (that I can think of) to search
for this in terms that aren't so broad that pretty much all of them
are returned as hits.  So here I am asking.

Simple problem.  Given a URL http://www.example.com/some/file/here.html,
retrieve and extract the title of the web page -- i.e., the content
of the <title> tag.  Is there an equally simple solution?  Thanks in
advance for any advice.
-- 
  _+_ From the catapult of |If anyone disagrees with any statement I make, I
_|70|___:)=}- J.D. Baldwin |am quite prepared not only to retract it, but also
\      /  baldwin@panix.com|to deny under oath that I ever made it. -T. Lehrer
***~~~~-----------------------------------------------------------------------


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

Date: Mon, 17 Mar 2008 14:02:42 -0700 (PDT)
From: Koszalek Opalek <koszalekopalek@interia.pl>
Subject: Re: Need Perl module to get <TITLE> tag of a web page
Message-Id: <6614e486-0492-4d8a-a4ac-72c0c3b6ea53@n77g2000hse.googlegroups.com>

On Mar 17, 12:32=A0pm, INVALID_SEE_...@example.com.invalid (J.D.
Baldwin) wrote:
> Simple problem. =A0Given a URLhttp://www.example.com/some/file/here.html,
> retrieve and extract the title of the web page -- i.e., the content
> of the <title> tag. =A0Is there an equally simple solution? =A0Thanks in
> advance for any advice.

#!/usr/bin/perl

use strict;
use LWP::Simple;

my $url =3D $ARGV[0] || die "Specify URL on the cmd line";
my $html =3D get ($url);
$html =3D~ m{<TITLE>(.*?)</TITLE>}gism;

print "$1\n";

Koszalek


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

Date: Mon, 17 Mar 2008 14:10:59 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Need Perl module to get <TITLE> tag of a web page
Message-Id: <4c33b5x4he.ln2@goaway.wombat.san-francisco.ca.us>

On 2008-03-17, J.D. Baldwin <INVALID_SEE_SIG@example.com.invalid> wrote:
>
> Simple problem.  Given a URL http://www.example.com/some/file/here.html,
> retrieve and extract the title of the web page -- i.e., the content
> of the <title> tag.  Is there an equally simple solution?  Thanks in
> advance for any advice.

Use LWP to retrieve the page, HTML::TreeBuilder to build a syntax tree,
and HTML::Element's find_by_tag_name method to find the element with the
title tag.  It sounds like more work than it is.

--keith

-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information



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

Date: Mon, 17 Mar 2008 23:18:14 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Need Perl module to get <TITLE> tag of a web page
Message-Id: <64891dF2a65raU1@mid.individual.net>

Koszalek Opalek wrote:
> On Mar 17, 12:32 pm, INVALID_SEE_...@example.com.invalid (J.D.
> Baldwin) wrote:
>> Simple problem.  Given a URLhttp://www.example.com/some/file/here.html,
>> retrieve and extract the title of the web page -- i.e., the content
>> of the <title> tag.  Is there an equally simple solution?  Thanks in
>> advance for any advice.
> 
> #!/usr/bin/perl
> 
> use strict;
> use LWP::Simple;
> 
> my $url = $ARGV[0] || die "Specify URL on the cmd line";
> my $html = get ($url);
> $html =~ m{<TITLE>(.*?)</TITLE>}gism;
> 
> print "$1\n";

Why the /g and /m modifiers?
What if the <title> element contains attributes?

Improved (I hope) code:

     $html =~ m{<TITLE.*?>(.*?)</TITLE>}is;

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Mon, 17 Mar 2008 22:33:06 +0000 (UTC)
From: INVALID_SEE_SIG@example.com.invalid (J.D. Baldwin)
Subject: Re: Need Perl module to get <TITLE> tag of a web page
Message-Id: <frmrj2$ceu$1@reader2.panix.com>


In the previous article, Keith Keller
<kkeller-usenet@wombat.san-francisco.ca.us> wrote, quoting me:
> > Simple problem.  Given a URL http://www.example.com/some/file/here.html,
> > retrieve and extract the title of the web page -- i.e., the content
> > of the <title> tag.  Is there an equally simple solution?  Thanks in
> > advance for any advice.
> 
> Use LWP to retrieve the page, HTML::TreeBuilder to build a syntax
> tree, and HTML::Element's find_by_tag_name method to find the
> element with the title tag.  It sounds like more work than it is.

Oh, my, "TreeBuilder" is *exactly* what I needed.  Thank you!

And thanks also to Koszalek Opalek for his answer elsethread.
-- 
  _+_ From the catapult of |If anyone disagrees with any statement I make, I
_|70|___:)=}- J.D. Baldwin |am quite prepared not only to retract it, but also
\      /  baldwin@panix.com|to deny under oath that I ever made it. -T. Lehrer
***~~~~-----------------------------------------------------------------------


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

Date: Mon, 17 Mar 2008 18:40:52 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Need Perl module to get <TITLE> tag of a web page
Message-Id: <slrnftu0c4.kip.tadmc@tadmc30.sbcglobal.net>

Koszalek Opalek <koszalekopalek@interia.pl> wrote:
> On Mar 17, 12:32 pm, INVALID_SEE_...@example.com.invalid (J.D.
> Baldwin) wrote:
>> Simple problem.  Given a URLhttp://www.example.com/some/file/here.html,
>> retrieve and extract the title of the web page -- i.e., the content
>> of the <title> tag.  Is there an equally simple solution?  Thanks in
>> advance for any advice.
>
> #!/usr/bin/perl
>
> use strict;
> use LWP::Simple;
>
> my $url = $ARGV[0] || die "Specify URL on the cmd line";
> my $html = get ($url);
> $html =~ m{<TITLE>(.*?)</TITLE>}gism;


the //m option is a no-op when there are no anchors in the pattern.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Mon, 17 Mar 2008 16:11:20 -0700 (PDT)
From: malec <d@perlnow.com>
Subject: Re: Need Perl module to get <TITLE> tag of a web page
Message-Id: <fdd6cb17-9764-47d1-baf9-7b4d6eb8216d@u10g2000prn.googlegroups.com>

http://www.perlnow.com/cgi-bin/l.CGI?file=getitle.cgi

On Mar 17, 4:32 pm, INVALID_SEE_...@example.com.invalid (J.D. Baldwin)
wrote:
> I've spent an hour searching on CPAN and there are simply too many
> web-related modules and no good way (that I can think of) to search
> for this in terms that aren't so broad that pretty much all of them
> are returned as hits.  So here I am asking.
>
> Simple problem.  Given a URLhttp://www.example.com/some/file/here.html,
> retrieve and extract the title of the web page -- i.e., the content
> of the <title> tag.  Is there an equally simple solution?  Thanks in
> advance for any advice.
> --
>   _+_ From the catapult of |If anyone disagrees with any statement I make, I
> _|70|___:)=}- J.D. Baldwin |am quite prepared not only to retract it, but also
> \      /  bald...@panix.com|to deny under oath that I ever made it. -T. Lehrer
> ***~~~~-----------------------------------------------------------------------


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

Date: 17 Mar 2008 20:35:23 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: test
Message-Id: <slrnfttlgb.onm.abigail@alexandra.abigail.be>

                                   _
John (john1949@yahoo.com) wrote on VCCCXII September MCMXCIII in
<URL:news:frmfvd$1jl$1@news.albasani.net>:
][  please ignore 


Will do.


*PLONK*


Johm1949 will now be ignored. For ever.



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: Mon, 17 Mar 2008 13:49:54 -0700 (PDT)
From: sandy_saydakov@yahoo.com
Subject: Re: why is return always 0?
Message-Id: <289bd725-11b8-467a-ae6f-9794051c560a@e6g2000prf.googlegroups.com>

On Mar 17, 12:56 pm, jammer <jamesloc...@mail.com> wrote:
> > Make sure the binary returns non-zero on failure. Try that command on
> > the command line and do "echo $?" right after.
>
> It prints an error when run interactively.
> tftp does run, it just can't find the host.
> It returns  0 because it ran, didn't work but it ran. :-(

So there must be a bug in tftp then. It makes no sense to have a clean
exit code on failure.

For example, try it with 'ls':
> ls nonexistent
ls: nonexistent: No such file or directory
> echo $?
1
This makes perfect sense, doesn't it?

I would suggest trying a native TFTP Perl module:
http://search.cpan.org/~gsm/TFTP-1.0b3/TFTP.pm

/sandy
http://myperlquiz.com/


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

Date: 17 Mar 2008 21:21:13 GMT
From: xhoster@gmail.com
Subject: Re: why is return always 0?
Message-Id: <20080317172115.421$Z6@newsreader.com>

jammer <jameslockie@mail.com> wrote:
> On Mar 16, 9:10 pm, sandy_sayda...@yahoo.com wrote:
> > On 16 Mar, 17:45, jammer <jamesloc...@mail.com> wrote:
> >
> > > How do I make tftp fail if the host is bad?

It seems that that is a question for the authors of tftp, not
a Perl question.  But there may be a Perl work-a-round.

> >
> > >         my $rc = system( "/usr/bin/tftp bad$host < $tempFile 2>&1
> > >         >/dev/null" ); if ( $rc != 0 ) {
> > >                 print "unable to tftp to '$host'\n";
> > >                 exit 1;
> > >         } else {
> > >                 print "success: $rc\n";
> > >         }
> >
> > Make sure the binary returns non-zero on failure. Try that command on
> > the command line and do "echo $?" right after.
> >
> > -sandyhttp://myperlquiz.com/
>
> It prints an error when run interactively.

Does it do that when run noninteractively?  You could try capturing and
parsing its stderr.  IPC::Run might be a good way.  (I think it might also
help you trick tftp into thinking it is running interactively, if that is
necessary.)

> tftp does run, it just can't find the host.
> It returns  0 because it ran, didn't work but it ran. :-(

Well, that was probably a poor design decision.  By that criterion, nothing
should ever exit with anything but 0.  If it ran, it ran.  If it didn't
run, it can't exit with anything at all.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

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


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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

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

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


------------------------------
End of Perl-Users Digest V11 Issue 1369
***************************************


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