Tag/xIMG.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 36 CC 2 SCAR 11.0
CC
2
Cov
0%
replace
6.0
Tag
2.0
BodyPermitted
2.0
CRAP 3.0
1 # $Id: xIMG.pm 284 2006-12-01 07:51:49Z chronos $
2 package BBCode::Tag::xIMG;
3 use base qw(BBCode::Tag::Inline);
4 use BBCode::Util qw(:parse :encode :text);
5 use strict;
6 use warnings;
7 our $VERSION = '0.34';
8  
9 sub Tag($):method {
10 return 'IMG';
11 }
12  
13 sub BodyPermitted($):method {
14 return 1;
15 }
16  
17 sub replace($):method {
18 my $this = shift;
19 my $text = $this->bodyHTML;
20 my $url = parseURL decodeHTML $text;
21  
22 if(defined $url) {
23 return BBCode::Tag->new(
24 $this->parser,
25 'IMG',
26 [ undef, $url->as_string ],
27 [ 'ALT', textALT($url) ],
28 );
29 } else {
30 return BBCode::Tag->new($this->parser, 'TEXT', [ undef, $text ]);
31 }
32 }
33  
34 1;