| 1 | package HTML::Template::ESCAPE::URL; | ||||||||||
| 2 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 4 | ▶ | use warnings FATAL => 'all'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use base qw(HTML::Template::ESCAPE); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use vars qw(%MAP); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 4 | our $VERSION = '2.9'; | |||||||||
| 7 | |||||||||||
| 8 | 24 | ▶ | sub output { | ||||||||
|
Subroutine
output: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||
| 9 | 24 | my $self = shift; | |||||||||
| 10 | 24 | ▶ | $_ = shift if (@_ > 0); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 11 | |||||||||||
| 12 | # Build a char->hex map if one isn't already available | ||||||||||
| 13 | 24 | ▶ | unless (exists($MAP{chr(1)})) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 2 | for (0..255) { $MAP{chr($_)} = sprintf('%%%02X', $_); } | |||||||||
| 15 | } | ||||||||||
| 16 | |||||||||||
| 17 | # do the translation (RFC 2396 ^uric) | ||||||||||
| 18 | 24 | s!([^a-zA-Z0-9_.\-])!$MAP{$1}!g; | |||||||||
| 19 | |||||||||||
| 20 | 24 | $_; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 4 | 1; | |||||||||