OpenShift/Parser.pm untested

filter: Statementstmt 0.0% 0 / 18 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 32 CC 4 SCAR 24.0
CC
4
Cov
0%
_handle_text
20.0
_handle_element_start
2.0
_handle_element_end
2.0
CRAP 11.0
1 #####################################################################################
2 #
3 # Copyright (c) 2012, Alexander Todorov <atodorov()otb.bg>. See POD section.
4 #
5 #####################################################################################
6  
7 package App::Difio::OpenShift::Parser;
8  
9 use Pod::Simple;
10 @ISA = qw(Pod::Simple);
11 use strict;
12  
13 my $parser_state = "";
14  
15 sub _handle_element_start {
16 my($self, $element_name, $attr_hash_r) = @_;
17 $parser_state = $element_name;
18 }
19  
20 sub _handle_element_end {
21 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 $parser_state = "";
29 }
30  
31 sub _handle_text {
32 my($self, $text) = @_;
33 my $FH = $_[0]{'output_fh'};
34  
35 if ($parser_state eq "L") {
36 print $FH $text;
37 } elsif ($parser_state eq "C") {
38 if ($text =~ m/^VERSION: (.*)/) {
39 print $FH " $1\n";
40 }
41 }
42 }
43 1;