| 1 | package Text::MicroMason::PLP; | ||||||||||||||||||||||
| 2 | # Trick PAUSE into indexing us properly: Old versions of PAUSE used | ||||||||||||||||||||||
| 3 | # Text::MicroMason::Commands::VERSION for Text::MicroMason::PL because | ||||||||||||||||||||||
| 4 | # they're in the same file, so PLP gained version 1.9 on PAUSE, and new | ||||||||||||||||||||||
| 5 | # versions won't be reindexed unless they have a greater version. | ||||||||||||||||||||||
| 6 | 1 | our $VERSION = "2.18"; | |||||||||||||||||||||
| 7 | |||||||||||||||||||||||
| 8 | 1 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 9 | 1 | ▶ | use Carp; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 10 | |||||||||||||||||||||||
| 11 | 1 | ▶ | use Safe; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 12 | |||||||||||||||||||||||
| 13 | ###################################################################### | ||||||||||||||||||||||
| 14 | |||||||||||||||||||||||
| 15 | 51 | ▶ | sub lex_token { | ||||||||||||||||||||
|
Subroutine
lex_token: called CC=5 SCAR=16.6
Pod
documented
| |||||||||||||||||||||||
| 16 | # Blocks in <: ... :> tags. | ||||||||||||||||||||||
| 17 | 51 | ▶ | /\G \< \: (\=)? ( .*? ) \: \> /gcxs ? ( ($1 ? 'expr' : 'perl') => $2 ) : | ||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||
| 18 | |||||||||||||||||||||||
| 19 | # Blocks in <( ... )> tags. | ||||||||||||||||||||||
| 20 | /\G \< \( ( .*? ) \) \> /gcxs ? ( 'include' => $1 ) : | ||||||||||||||||||||||
| 21 | |||||||||||||||||||||||
| 22 | # Things that don't match the above | ||||||||||||||||||||||
| 23 | /\G ( (?: [^\<]+ | \<(?![\:\(]) )? ) /gcxs ? ( 'text' => $1 ) : | ||||||||||||||||||||||
| 24 | |||||||||||||||||||||||
| 25 | # Lexer error | ||||||||||||||||||||||
| 26 | () | ||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||
| 28 | |||||||||||||||||||||||
| 29 | # $perl_code = $mason->assemble( @tokens ); | ||||||||||||||||||||||
| 30 | 8 | ▶ | sub assemble { | ||||||||||||||||||||
|
Subroutine
assemble: called CC=3 SCAR=11.6
Pod
documented
| |||||||||||||||||||||||
| 31 | 8 | my $self = shift; | |||||||||||||||||||||
| 32 | 8 | my @tokens = @_; | |||||||||||||||||||||
| 33 | |||||||||||||||||||||||
| 34 | 8 | ▶ | for ( my $position = 0; $position <= int( $#tokens / 2 ); $position ++ ) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 35 | 51 | ▶ | if ( $tokens[$position * 2] eq 'include' ) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 36 | 0 | my $token = $tokens[$position * 2 + 1]; | |||||||||||||||||||||
| 37 | 0 | splice @tokens, $position * 2, 2, $self->lex( $self->read_file( $token ) ) | |||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||
| 40 | |||||||||||||||||||||||
| 41 | 8 | $self->NEXT('assemble', @tokens ); | |||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||
| 43 | |||||||||||||||||||||||
| 44 | ###################################################################### | ||||||||||||||||||||||
| 45 | |||||||||||||||||||||||
| 46 | package Text::MicroMason::Commands; | ||||||||||||||||||||||
| 47 | |||||||||||||||||||||||
| 48 | # Trick PAUSE into indexing us properly: this package used to be in | ||||||||||||||||||||||
| 49 | # MicroMason.pm, so it gained version 1.07 on PAUSE, and the new ones | ||||||||||||||||||||||
| 50 | # won't be reindexed unless they have a greater version. | ||||||||||||||||||||||
| 51 | 1 | our $VERSION = "1.9"; | |||||||||||||||||||||
| 52 | |||||||||||||||||||||||
| 53 | 1 | ▶ | use vars qw( $m ); | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 54 | 0 | ▶ | sub include { | ||||||||||||||||||||
|
Subroutine
include: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||
| 55 | 0 | $m->execute( file => @_ ) | |||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||
| 57 | |||||||||||||||||||||||
| 58 | 0 | ▶ | sub Include { | ||||||||||||||||||||
|
Subroutine
Include: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||
| 59 | 0 | $m->execute( file => @_ ) | |||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||
| 61 | |||||||||||||||||||||||
| 62 | 0 | ▶ | sub ReadFile { | ||||||||||||||||||||
|
Subroutine
ReadFile: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||
| 63 | 0 | $m->read_file( @_ ) | |||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||
| 65 | |||||||||||||||||||||||
| 66 | 0 | ▶ | sub Entity { | ||||||||||||||||||||
|
Subroutine
Entity: not called CC=2 SCAR=10.9
| |||||||||||||||||||||||
| 67 | 0 | ▶ | eval { require HTML::Entities; no strict; *Entity = \&HTML::Entities::encode } | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.2
Branch: 1 branch
| |||||||||||||||||||||||
| 68 | ? goto &HTML::Entities::encode : die "Can't load HTML::Entities"; | ||||||||||||||||||||||
| 69 | |||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||
| 71 | |||||||||||||||||||||||
| 72 | 0 | ▶ | sub EncodeURI { | ||||||||||||||||||||
|
Subroutine
EncodeURI: not called CC=2 SCAR=10.9
| |||||||||||||||||||||||
| 73 | 0 | ▶ | eval { require URI::Escape; no strict; *Entity = \&URI::Escape::uri_escape } | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=2.2
Branch: 1 branch
| |||||||||||||||||||||||
| 74 | ? goto &URI::Escape::uri_escape : die "Can't load HTML::Entities"; | ||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||
| 76 | |||||||||||||||||||||||
| 77 | |||||||||||||||||||||||
| 78 | ###################################################################### | ||||||||||||||||||||||
| 79 | |||||||||||||||||||||||
| 80 | 1 | 1; | |||||||||||||||||||||
| 81 | |||||||||||||||||||||||
| 82 | __END__ | ||||||||||||||||||||||