| 1 | ##################################################################################### | ||||||||||||||
| 2 | # | ||||||||||||||
| 3 | # Copyright (c) 2012, Alexander Todorov <atodorov()otb.bg>. See POD section. | ||||||||||||||
| 4 | # | ||||||||||||||
| 5 | ##################################################################################### | ||||||||||||||
| 6 | |||||||||||||||
| 7 | package App::Difio::dotCloud::Parser; | ||||||||||||||
| 8 | |||||||||||||||
| 9 | 1 | ▶ | use Pod::Simple; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 10 | 1 | @ISA = qw(Pod::Simple); | |||||||||||||
| 11 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 12 | |||||||||||||||
| 13 | 1 | my $parser_state = ""; | |||||||||||||
| 14 | |||||||||||||||
| 15 | 0 | ▶ | sub _handle_element_start { | ||||||||||||
|
Subroutine
_handle_element_start: not called CC=1 SCAR=6.9
| |||||||||||||||
| 16 | 0 | my($self, $element_name, $attr_hash_r) = @_; | |||||||||||||
| 17 | 0 | $parser_state = $element_name; | |||||||||||||
| 18 | } | ||||||||||||||
| 19 | |||||||||||||||
| 20 | 0 | ▶ | sub _handle_element_end { | ||||||||||||
|
Subroutine
_handle_element_end: not called CC=1 SCAR=6.9
| |||||||||||||||
| 21 | 0 | my($self, $element_name, $attr_hash_r) = @_; | |||||||||||||
| 22 | |||||||||||||||
| 23 | # NOTE: $attr_hash_r is only present when $element_name is "over" or "begin" | ||||||||||||||
| 24 | # The remaining code excerpts will mostly ignore this $attr_hash_r, as it is | ||||||||||||||
| 25 | # mostly useless. It is documented where "over-*" and "begin" events are | ||||||||||||||
| 26 | # documented. | ||||||||||||||
| 27 | |||||||||||||||
| 28 | 0 | $parser_state = ""; | |||||||||||||
| 29 | } | ||||||||||||||
| 30 | |||||||||||||||
| 31 | 0 | ▶ | sub _handle_text { | ||||||||||||
|
Subroutine
_handle_text: not called CC=4 SCAR=30.0
| |||||||||||||||
| 32 | 0 | my($self, $text) = @_; | |||||||||||||
| 33 | 0 | my $FH = $_[0]{'output_fh'}; | |||||||||||||
| 34 | |||||||||||||||
| 35 | 0 | ▶ | if ($parser_state eq "L") { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 36 | 0 | print $FH $text; | |||||||||||||
| 37 | } elsif ($parser_state eq "C") { | ||||||||||||||
| 38 | 0 | ▶ | if ($text =~ m/^VERSION: (.*)/) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 39 | 0 | print $FH " $1\n"; | |||||||||||||
| 40 | } | ||||||||||||||
| 41 | } | ||||||||||||||
| 42 | } | ||||||||||||||
| 43 | 1 | 1; | |||||||||||||