| 1 | # $Id: ENT.pm 284 2006-12-01 07:51:49Z chronos $ | ||||||||||
| 2 | package BBCode::Tag::ENT; | ||||||||||
| 3 | 1 | ▶ | use base qw(BBCode::Tag); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use BBCode::Util qw(:parse decodeHTML); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | our $VERSION = '0.34'; | |||||||||
| 8 | |||||||||||
| 9 | 2 | ▶ | sub Class($):method { | ||||||||
|
Subroutine
Class: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 10 | 2 | return qw(TEXT INLINE); | |||||||||
| 11 | } | ||||||||||
| 12 | |||||||||||
| 13 | 2 | ▶ | sub NamedParams($):method { | ||||||||
|
Subroutine
NamedParams: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 14 | 2 | return qw(VAL); | |||||||||
| 15 | } | ||||||||||
| 16 | |||||||||||
| 17 | 2 | ▶ | sub DefaultParam($):method { | ||||||||
|
Subroutine
DefaultParam: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 18 | 2 | return 'VAL'; | |||||||||
| 19 | } | ||||||||||
| 20 | |||||||||||
| 21 | 1 | ▶ | sub validateParam($$$):method { | ||||||||
|
Subroutine
validateParam: called CC=3 SCAR=12.3
Pod
documented
| |||||||||||
| 22 | 1 | my($this,$param,$val) = @_; | |||||||||
| 23 | 1 | ▶ | if($param eq 'VAL') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 1 | my $ent = parseEntity($val); | |||||||||
| 25 | 1 | ▶ | if(defined $ent) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 1 | return $ent; | |||||||||
| 27 | } else { | ||||||||||
| 28 | 0 | die qq(Invalid value "$val" for [ENT]); | |||||||||
| 29 | } | ||||||||||
| 30 | } | ||||||||||
| 31 | 0 | return $this->SUPER::validateParam($param,$val); | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 1 | ▶ | sub toHTML($):method { | ||||||||
|
Subroutine
toHTML: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||
| 35 | 1 | my $this = shift; | |||||||||
| 36 | 1 | my $ent = $this->param('VAL'); | |||||||||
| 37 | 1 | ▶ | return "&$ent;" if defined $ent; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 0 | return ""; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 0 | ▶ | sub toText($):method { | ||||||||
|
Subroutine
toText: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 42 | 0 | my $this = shift; | |||||||||
| 43 | 0 | my $ent = $this->param('VAL'); | |||||||||
| 44 | 0 | ▶ | return decodeHTML("&$ent;") if defined $ent; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | 0 | return ""; | |||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 1 | 1; | |||||||||