1 package WWW::Mechanize::Link;
8 WWW::Mechanize::Link - Link object for WWW::Mechanize
12 Link object to encapsulate all the stuff that Mech needs but nobody
13 wants to deal with as an array.
19 my $link = WWW::Mechanize::Link->new( {
28 For compatibility, this older interface is also supported:
30 new( $url, $text, $name, $tag, $base, $attr_href )
32 Creates and returns a new C<WWW::Mechanize::Link> object.
41 # The order of the first four must stay as they are for
42 # compatibility with older code.
43 if ( ref $_[0] eq 'HASH' ) {
44 $self = [ @{$_[0]}{ qw( url text name tag base attrs ) } ];
50 return bless $self, $class;
65 NAME attribute from the source tag, if any.
69 Tag name (one of: "a", "area", "frame", "iframe" or "meta").
73 Base URL to which the links are relative.
77 Returns hash ref of all the attributes and attribute values in the tag.
81 sub url { return ($_[0])->[0]; }
82 sub text { return ($_[0])->[1]; }
83 sub name { return ($_[0])->[2]; }
84 sub tag { return ($_[0])->[3]; }
85 sub base { return ($_[0])->[4]; }
86 sub attrs { return ($_[0])->[5]; }
90 Returns the URL as a L<URI::URL> object.
98 my $URI = URI::URL->new( $self->url, $self->base );
103 =head2 $link->url_abs()
105 Returns a URI::URL object for the absolute form of the string.
112 return $self->URI->abs;
117 Copyright (c) 2004-2007 Andy Lester. All rights reserved. This program is
118 free software; you can redistribute it and/or modify it under the same
119 terms as Perl itself.