| Filename | /usr/lib/perl5/XML/SAX/ExpatXS/Encoding.pm |
| Statements | Executed 23 statements in 1.59ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 11 | 1 | 1 | 52µs | 52µs | XML::SAX::ExpatXS::Encoding::CORE:ftdir (opcode) |
| 1 | 1 | 1 | 30µs | 110µs | XML::SAX::ExpatXS::ContentModel::BEGIN@74 |
| 1 | 1 | 1 | 22µs | 28µs | XML::SAX::ExpatXS::Encoding::BEGIN@4 |
| 1 | 1 | 1 | 19µs | 92µs | XML::SAX::ExpatXS::Encoding::BEGIN@7 |
| 1 | 1 | 1 | 14µs | 141µs | XML::SAX::ExpatXS::Encoding::BEGIN@5 |
| 1 | 1 | 1 | 14µs | 14µs | XML::SAX::ExpatXS::Encoding::BEGIN@6 |
| 0 | 0 | 0 | 0s | 0s | XML::SAX::ExpatXS::ContentModel::asString |
| 0 | 0 | 0 | 0s | 0s | XML::SAX::ExpatXS::ContentModel::children |
| 0 | 0 | 0 | 0s | 0s | XML::SAX::ExpatXS::ContentModel::isany |
| 0 | 0 | 0 | 0s | 0s | XML::SAX::ExpatXS::ContentModel::ischoice |
| 0 | 0 | 0 | 0s | 0s | XML::SAX::ExpatXS::ContentModel::isempty |
| 0 | 0 | 0 | 0s | 0s | XML::SAX::ExpatXS::ContentModel::ismixed |
| 0 | 0 | 0 | 0s | 0s | XML::SAX::ExpatXS::ContentModel::isname |
| 0 | 0 | 0 | 0s | 0s | XML::SAX::ExpatXS::ContentModel::isseq |
| 0 | 0 | 0 | 0s | 0s | XML::SAX::ExpatXS::ContentModel::name |
| 0 | 0 | 0 | 0s | 0s | XML::SAX::ExpatXS::ContentModel::quant |
| 0 | 0 | 0 | 0s | 0s | XML::SAX::ExpatXS::ContentModel::thiseq |
| 0 | 0 | 0 | 0s | 0s | XML::SAX::ExpatXS::Encinfo::DESTROY |
| 0 | 0 | 0 | 0s | 0s | XML::SAX::ExpatXS::Encoding::load_encoding |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package XML::SAX::ExpatXS::Encoding; | ||||
| 2 | 1 | 68µs | require 5.004; | ||
| 3 | |||||
| 4 | 3 | 45µs | 2 | 34µs | # spent 28µs (22+6) within XML::SAX::ExpatXS::Encoding::BEGIN@4 which was called:
# once (22µs+6µs) by XML::SAX::ExpatXS::BEGIN@5 at line 4 # spent 28µs making 1 call to XML::SAX::ExpatXS::Encoding::BEGIN@4
# spent 6µs making 1 call to strict::import |
| 5 | 3 | 41µs | 2 | 268µs | # spent 141µs (14+127) within XML::SAX::ExpatXS::Encoding::BEGIN@5 which was called:
# once (14µs+127µs) by XML::SAX::ExpatXS::BEGIN@5 at line 5 # spent 141µs making 1 call to XML::SAX::ExpatXS::Encoding::BEGIN@5
# spent 127µs making 1 call to vars::import |
| 6 | 3 | 48µs | 1 | 14µs | # spent 14µs within XML::SAX::ExpatXS::Encoding::BEGIN@6 which was called:
# once (14µs+0s) by XML::SAX::ExpatXS::BEGIN@5 at line 6 # spent 14µs making 1 call to XML::SAX::ExpatXS::Encoding::BEGIN@6 |
| 7 | 3 | 540µs | 2 | 165µs | # spent 92µs (19+73) within XML::SAX::ExpatXS::Encoding::BEGIN@7 which was called:
# once (19µs+73µs) by XML::SAX::ExpatXS::BEGIN@5 at line 7 # spent 92µs making 1 call to XML::SAX::ExpatXS::Encoding::BEGIN@7
# spent 73µs making 1 call to Exporter::import |
| 8 | |||||
| 9 | 1 | 1µs | require DynaLoader; | ||
| 10 | |||||
| 11 | 1 | 9µs | @ISA = qw(DynaLoader); | ||
| 12 | |||||
| 13 | |||||
| 14 | 1 | 2µs | $have_File_Spec = $INC{'File/Spec.pm'} || do 'File/Spec.pm'; | ||
| 15 | |||||
| 16 | 1 | 1µs | %Encoding_Table = (); | ||
| 17 | 2 | 153µs | if ($have_File_Spec) { | ||
| 18 | 23 | 598µs | @Encoding_Path = (grep(-d $_, # spent 544µs making 11 calls to File::Spec::Unix::catdir, avg 49µs/call
# spent 52µs making 11 calls to XML::SAX::ExpatXS::Encoding::CORE:ftdir, avg 5µs/call
# spent 2µs making 1 call to File::Spec::Unix::curdir | ||
| 19 | map(File::Spec->catdir($_, qw(XML SAX ExpatXS Encodings)), | ||||
| 20 | @INC)), | ||||
| 21 | File::Spec->curdir); | ||||
| 22 | } | ||||
| 23 | else { | ||||
| 24 | @Encoding_Path = (grep(-d $_, map($_ . '/XML/SAX/ExpatXS/Encodings', @INC)), '.'); | ||||
| 25 | } | ||||
| 26 | |||||
| 27 | sub load_encoding { | ||||
| 28 | my ($file) = @_; | ||||
| 29 | |||||
| 30 | $file =~ s!([^/]+)$!\L$1\E!; | ||||
| 31 | $file .= '.enc' unless $file =~ /\.enc$/; | ||||
| 32 | unless ($file =~ m!^/!) { | ||||
| 33 | foreach (@Encoding_Path) { | ||||
| 34 | my $tmp = ($have_File_Spec | ||||
| 35 | ? File::Spec->catfile($_, $file) | ||||
| 36 | : "$_/$file"); | ||||
| 37 | if (-e $tmp) { | ||||
| 38 | $file = $tmp; | ||||
| 39 | last; | ||||
| 40 | } | ||||
| 41 | } | ||||
| 42 | } | ||||
| 43 | |||||
| 44 | local(*ENC); | ||||
| 45 | open(ENC, $file) or croak("Couldn't open encmap $file:\n$!\n"); | ||||
| 46 | binmode(ENC); | ||||
| 47 | my $data; | ||||
| 48 | my $br = sysread(ENC, $data, -s $file); | ||||
| 49 | croak("Trouble reading $file:\n$!\n") | ||||
| 50 | unless defined($br); | ||||
| 51 | close(ENC); | ||||
| 52 | |||||
| 53 | my $name = XML::SAX::ExpatXS::LoadEncoding($data, $br); | ||||
| 54 | croak("$file isn't an encmap file") | ||||
| 55 | unless defined($name); | ||||
| 56 | |||||
| 57 | $name; | ||||
| 58 | } # End load_encoding | ||||
| 59 | |||||
| 60 | |||||
| 61 | ################################################################ | ||||
| 62 | |||||
| 63 | package XML::SAX::ExpatXS::Encinfo; | ||||
| 64 | |||||
| 65 | sub DESTROY { | ||||
| 66 | my $self = shift; | ||||
| 67 | XML::SAX::ExpatXS::FreeEncoding($self); | ||||
| 68 | } | ||||
| 69 | |||||
| 70 | |||||
| 71 | ################################################################ | ||||
| 72 | |||||
| 73 | package XML::SAX::ExpatXS::ContentModel; | ||||
| 74 | 3 | 664µs | 2 | 190µs | # spent 110µs (30+80) within XML::SAX::ExpatXS::ContentModel::BEGIN@74 which was called:
# once (30µs+80µs) by XML::SAX::ExpatXS::BEGIN@5 at line 74 # spent 110µs making 1 call to XML::SAX::ExpatXS::ContentModel::BEGIN@74
# spent 80µs making 1 call to overload::import |
| 75 | |||||
| 76 | sub EMPTY () {1} | ||||
| 77 | sub ANY () {2} | ||||
| 78 | sub MIXED () {3} | ||||
| 79 | sub NAME () {4} | ||||
| 80 | sub CHOICE () {5} | ||||
| 81 | sub SEQ () {6} | ||||
| 82 | |||||
| 83 | sub isempty { | ||||
| 84 | return $_[0]->{Type} == EMPTY; | ||||
| 85 | } | ||||
| 86 | |||||
| 87 | sub isany { | ||||
| 88 | return $_[0]->{Type} == ANY; | ||||
| 89 | } | ||||
| 90 | |||||
| 91 | sub ismixed { | ||||
| 92 | return $_[0]->{Type} == MIXED; | ||||
| 93 | } | ||||
| 94 | |||||
| 95 | sub isname { | ||||
| 96 | return $_[0]->{Type} == NAME; | ||||
| 97 | } | ||||
| 98 | |||||
| 99 | sub name { | ||||
| 100 | return $_[0]->{Tag}; | ||||
| 101 | } | ||||
| 102 | |||||
| 103 | sub ischoice { | ||||
| 104 | return $_[0]->{Type} == CHOICE; | ||||
| 105 | } | ||||
| 106 | |||||
| 107 | sub isseq { | ||||
| 108 | return $_[0]->{Type} == SEQ; | ||||
| 109 | } | ||||
| 110 | |||||
| 111 | sub quant { | ||||
| 112 | return $_[0]->{Quant}; | ||||
| 113 | } | ||||
| 114 | |||||
| 115 | sub children { | ||||
| 116 | my $children = $_[0]->{Children}; | ||||
| 117 | if (defined $children) { | ||||
| 118 | return @$children; | ||||
| 119 | } | ||||
| 120 | return undef; | ||||
| 121 | } | ||||
| 122 | |||||
| 123 | sub asString { | ||||
| 124 | my ($self) = @_; | ||||
| 125 | my $ret; | ||||
| 126 | |||||
| 127 | if ($self->{Type} == NAME) { | ||||
| 128 | $ret = $self->{Tag}; | ||||
| 129 | } | ||||
| 130 | elsif ($self->{Type} == EMPTY) { | ||||
| 131 | return "EMPTY"; | ||||
| 132 | } | ||||
| 133 | elsif ($self->{Type} == ANY) { | ||||
| 134 | return "ANY"; | ||||
| 135 | } | ||||
| 136 | elsif ($self->{Type} == MIXED) { | ||||
| 137 | $ret = '(#PCDATA'; | ||||
| 138 | foreach (@{$self->{Children}}) { | ||||
| 139 | $ret .= '|' . $_; | ||||
| 140 | } | ||||
| 141 | $ret .= ')'; | ||||
| 142 | } | ||||
| 143 | else { | ||||
| 144 | my $sep = $self->{Type} == CHOICE ? '|' : ','; | ||||
| 145 | $ret = '(' . join($sep, map { $_->asString } @{$self->{Children}}) . ')'; | ||||
| 146 | } | ||||
| 147 | |||||
| 148 | $ret .= $self->{Quant} if $self->{Quant}; | ||||
| 149 | return $ret; | ||||
| 150 | } | ||||
| 151 | |||||
| 152 | sub thiseq { | ||||
| 153 | my $self = shift; | ||||
| 154 | |||||
| 155 | return $self->asString eq $_[0]; | ||||
| 156 | } | ||||
| 157 | |||||
| 158 | |||||
| 159 | 1 | 22µs | 1; | ||
| 160 | |||||
| 161 | __END__ | ||||
# spent 52µs within XML::SAX::ExpatXS::Encoding::CORE:ftdir which was called 11 times, avg 5µs/call:
# 11 times (52µs+0s) by XML::SAX::ExpatXS::BEGIN@5 at line 18, avg 5µs/call |