12 |
{ |
{ |
13 |
my $self = shift; |
my $self = shift; |
14 |
my $name = shift; |
my $name = shift; |
15 |
|
my $location = shift; |
16 |
|
|
17 |
$self->name($name); |
$self->name($name); |
18 |
$self->{ATTRS} = {}; |
$self->attributes(@_); |
19 |
$self->SUPER::init(@_); |
$self->SUPER::init($location); |
20 |
$DEBUG = $main::DEBUG; |
$DEBUG = $main::DEBUG; |
21 |
} |
} |
22 |
|
|
51 |
sub attributes |
sub attributes |
52 |
{ |
{ |
53 |
my $self = shift; |
my $self = shift; |
54 |
|
|
55 |
|
$self->{ATTRS} = {} |
56 |
|
unless exists $self->{ATTRS}; |
57 |
|
|
58 |
$self->{ATTRS} = { @_ } |
$self->{ATTRS} = { @_ } |
59 |
if (@_); |
if (@_); |
60 |
|
|
61 |
return %{$self->{ATTRS}}; |
return %{$self->{ATTRS}}; |
62 |
} |
} |
63 |
|
|
64 |
|
sub delete |
65 |
|
{ |
66 |
|
my $self = shift; |
67 |
|
my $attr = shift; |
68 |
|
|
69 |
|
return delete $self->{ATTRS}->{$attr}; |
70 |
|
} |
71 |
|
|
72 |
sub canonical |
sub canonical |
73 |
{ |
{ |
74 |
my $self = shift; |
my $self = shift; |
117 |
my %h = $self->attributes; |
my %h = $self->attributes; |
118 |
my $code = ''; |
my $code = ''; |
119 |
|
|
120 |
$code .= "# Tag::code_start:\n\t" if ($DEBUG); |
$code .= ' 'x60 . "### Tag::code_start (" . $self->url . ")\n" if ($DEBUG); |
121 |
$code .= '$OUTPUT .= "<' . $self->name; |
$code .= '$OUTPUT .= "<' . $self->name; |
122 |
|
|
123 |
foreach (sort $attr_sorter keys %h) |
foreach (sort $attr_sorter keys %h) |
132 |
} |
} |
133 |
} |
} |
134 |
|
|
135 |
$code .= ">\";"; |
$code .= ">\";\n"; |
|
$code .= "\# Tag::code_start" if ($DEBUG); |
|
|
$code .= "\n"; |
|
136 |
|
|
137 |
return $code; |
return $code; |
138 |
} |
} |
149 |
my $self = shift; |
my $self = shift; |
150 |
my $code = ''; |
my $code = ''; |
151 |
|
|
|
$code .= "# Tag::code_end\n\t" if ($DEBUG); |
|
152 |
$code .= sprintf ("\$OUTPUT .= \"%s\";\n", $self->canonical_end); |
$code .= sprintf ("\$OUTPUT .= \"%s\";\n", $self->canonical_end); |
153 |
|
$code .= ' 'x60 . "### Tag::code_end (" . $self->url . ")\n" if ($DEBUG); |
154 |
|
|
155 |
return $code; |
return $code; |
156 |
} |
} |