| 1 | package Tags::HTML::Element::A; | ||
| 2 | |||
| 3 | 3 | ▶ | use base qw(Tags::HTML); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 0 | ▶ | use Error::Pure qw(err); |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 8 | use Scalar::Util qw(blessed); | ||
| 9 | use Tags::HTML::Element::Utils qw(tags_data tags_value); | ||
| 10 | |||
| 11 | our $VERSION = 0.15; | ||
| 12 | |||
| 13 | sub _cleanup { | ||
| 14 | my $self = shift; | ||
| 15 | |||
| 16 | delete $self->{'_a'}; | ||
| 17 | |||
| 18 | return; | ||
| 19 | } | ||
| 20 | |||
| 21 | sub _init { | ||
| 22 | my ($self, $a) = @_; | ||
| 23 | |||
| 24 | # Check a. | ||
| 25 | if (! defined $a | ||
| 26 | || ! blessed($a) | ||
| 27 | || ! $a->isa('Data::HTML::Element::A')) { | ||
| 28 | |||
| 29 | err "Anchor object must be a 'Data::HTML::Element::A' instance."; | ||
| 30 | } | ||
| 31 | |||
| 32 | $self->{'_a'} = $a; | ||
| 33 | |||
| 34 | return; | ||
| 35 | } | ||
| 36 | |||
| 37 | # Process 'Tags'. | ||
| 38 | sub _process { | ||
| 39 | my $self = shift; | ||
| 40 | |||
| 41 | if (! exists $self->{'_a'}) { | ||
| 42 | return; | ||
| 43 | } | ||
| 44 | |||
| 45 | $self->{'tags'}->put( | ||
| 46 | ['b', 'a'], | ||
| 47 | tags_value($self, $self->{'_a'}, 'css_class', 'class'), | ||
| 48 | tags_value($self, $self->{'_a'}, 'id'), | ||
| 49 | tags_value($self, $self->{'_a'}, 'target'), | ||
| 50 | tags_value($self, $self->{'_a'}, 'url', 'href'), | ||
| 51 | ); | ||
| 52 | tags_data($self, $self->{'_a'}); | ||
| 53 | $self->{'tags'}->put( | ||
| 54 | ['e', 'a'], | ||
| 55 | ); | ||
| 56 | |||
| 57 | return; | ||
| 58 | } | ||
| 59 | |||
| 60 | sub _process_css { | ||
| 61 | my $self = shift; | ||
| 62 | |||
| 63 | return; | ||
| 64 | } | ||
| 65 | |||
| 66 | 1; | ||
| 67 | |||
| 68 | __END__ | ||