[25989] in Perl-Users-Digest
Perl-Users Digest, Issue: 8208 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 28 00:05:31 2005
Date: Mon, 27 Jun 2005 21:05:04 -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, 27 Jun 2005 Volume: 10 Number: 8208
Today's topics:
Re: Simple Structure Question <newsAT@screenlightDOT.com>
Re: Simple Structure Question <pilkowsk@informatik.uni-marburg.de>
Typeglob Qs <socyl@987jk.com.invalid>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 27 Jun 2005 22:54:16 GMT
From: one man army <newsAT@screenlightDOT.com>
Subject: Re: Simple Structure Question
Message-Id: <newsAT-190005.15531727062005@newssvr13-ext.news.prodigy.com>
ok, so it looked like perhaps HTML::LinkExtractor was going to be easier
to use. So I run a simple loop, as per the examples. I get a Hash? Hash
ref? back in each iteration. DataDumper shows something like (below). By
Reading the Manual, I infer to choose only a $ThisLink with an 'href'
entry, I use
if ( exists $ThisLink{ href } ) { ... }
But I always get back an UNDEF for every iteration... I tried
@$ThisLink{ href} just for kicks, but that doesn't work either... Any
insights to get me past this sticking point?
thanks in advance
##--
my $LX = new HTML::LinkExtractor();
$LX->parse( $FileName);
for $ThisLink( @{ $LX->links } ) {
print "ThisLink = " . Dumper( $ThisLink );
if ( exists $ThisLink{ href } ) {
print "LinkInner = " . $ThisLink{ href } . "\n";
}
}
ThisLink = $VAR1 = {
'content' => 'text/html; charset=iso-8859-1',
'tag' => 'meta',
'http-equiv' => 'Content-Type'
};
ThisLink = $VAR1 = {
'content' => 'Weeds Lawn Lawn Care',
'tag' => 'meta',
'name' => 'keywords'
};
ThisLink = $VAR1 = {
'alt' => '',
'src' => '/images/ERHeader.jpg',
'border' => '0',
'width' => '780',
'tag' => 'img',
'height' => '185',
'usemap' => '#header'
};
ThisLink = $VAR1 = {
'_TEXT' => '<a name="1" href="http://www.Ortho.com/Registration/OrgLocationList.aspx?id=20822">1A Plenty Grow</a>',
'href' =>
'http://www.Ortho.com/Registration/OrgLocationList.aspx?id=20822',
'tag' => 'a',
'name' => '1'
};
------------------------------
Date: Tue, 28 Jun 2005 01:59:37 +0200
From: Fabian Pilkowski <pilkowsk@informatik.uni-marburg.de>
Subject: Re: Simple Structure Question
Message-Id: <3ibi4tFkae0nU1@individual.net>
* one man army schrieb:
>
> ok, so it looked like perhaps HTML::LinkExtractor was going to be easier
> to use.
Please quote a bit of context like all others do.
> So I run a simple loop, as per the examples. I get a Hash? Hash
> ref? back in each iteration. DataDumper shows something like (below).
You get a hash ref.
> By
> Reading the Manual, I infer to choose only a $ThisLink with an 'href'
> entry, I use
> if ( exists $ThisLink{ href } ) { ... }
You're trying to access the value for 'href' in the hash %ThisLink. But
there is no hash like this. You have to try Perl's dereference operator.
if ( exists $ThisLink->{href} ) { ... }
Btw, if you're using "use strict" in your skripts, Perl will tell you
whenever you try to use a non-existent var. This is what everyone should
use. Nevertheless, you have to know how to access data structures you
could print with Data::Dumper. And that's why others have pointed you to
the manual where this is actually described (in `perldoc perlreftut` as
well as in `perldoc perlref`).
regards,
fabian
------------------------------
Date: Tue, 28 Jun 2005 02:34:47 +0000 (UTC)
From: kj <socyl@987jk.com.invalid>
Subject: Typeglob Qs
Message-Id: <d9qd07$hu$1@reader1.panix.com>
What is the connection, if any, between typeglobs and references
to package variables? The following debugger interaction suggests
that they are very similar:
DB<1> $x = 'foobar'
DB<2> $y = *::x
DB<3> p $$y
foobar
DB<4> $z = \$::x
DB<5> p $$z
foobar
Is this similarity of behavior superficial?
Also, how can one retrieve the dirhandle, socket, and format items
from a typeglob. I'm aware of the *x{THING} syntax, but it's not
clear to me what value to use inside the curlies to access the
items listed.
Thanks!
kj
kj
------------------------------
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 V10 Issue 8208
***************************************