File | /home/tamil/util/marc-moose/lib/MARC/Moose/Parser/Marcxml.pm |
Statements Executed | 290017 |
Total Time | 0.362805800000671 seconds |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1000 | 1 | 1 | 322ms | 858ms | __ANON__[:62] | MARC::Moose::Parser::Marcxml::
0 | 0 | 0 | 0s | 0s | BEGIN | MARC::Moose::Parser::Marcxml::
Line | Stmts. | Exclusive Time | Avg. | Code |
---|---|---|---|---|
1 | package MARC::Moose::Parser::Marcxml; | |||
2 | # ABSTRACT: Parser for MARXML records | |||
3 | ||||
4 | 3 | 30µs | 10µs | use namespace::autoclean; # spent 70µs making 1 call to namespace::autoclean::import |
5 | 3 | 64µs | 21µs | use Moose; # spent 5.90ms making 1 call to Moose::Exporter::__ANON__[/usr/local/lib/perl/5.10.0/Moose/Exporter.pm:425] |
6 | ||||
7 | 1 | 8µs | 8µs | extends 'MARC::Moose::Parser'; # spent 12.5ms making 1 call to Moose::extends |
8 | ||||
9 | 3 | 139µs | 46µs | use MARC::Moose::Field::Control; # spent 4µs making 1 call to import |
10 | 3 | 585µs | 195µs | use MARC::Moose::Field::Std; # spent 4µs making 1 call to import |
11 | ||||
12 | ||||
13 | # spent 858ms (322+536) within MARC::Moose::Parser::Marcxml::__ANON__[/home/tamil/util/marc-moose/lib/MARC/Moose/Parser/Marcxml.pm:62] which was called 1000 times, avg 858µs/call:
# 1000 times (322ms+536ms) by Moose::Meta::Method::Overridden::new or Moose::Meta::Method::Overridden::__ANON__[/usr/local/lib/perl/5.10.0/Moose/Meta/Method/Overridden.pm:37] at line 36 of /usr/local/lib/perl/5.10.0/Moose/Meta/Method/Overridden.pm, avg 858µs/call | |||
14 | 290000 | 362ms | 1µs | my ($self, $raw) = @_; |
15 | ||||
16 | return unless $raw; | |||
17 | return undef unless $raw =~ /<record/; | |||
18 | ||||
19 | my @parts = split />/, $raw; | |||
20 | my ($tag, $code, $ind1, $ind2); | |||
21 | my $record = MARC::Moose::Record->new(); # spent 32.0ms making 1000 calls to MARC::Moose::Record::new, avg 32µs/call | |||
22 | my @fields; | |||
23 | while ( @parts ) { | |||
24 | $_ = shift @parts; | |||
25 | $_ = shift @parts if /<record/; | |||
26 | if ( /<leader/ ) { | |||
27 | $_ = shift @parts; | |||
28 | /(.*)<\/leader/; | |||
29 | $record->_leader($1); # spent 10.7ms making 1000 calls to MARC::Moose::Record::_leader, avg 11µs/call | |||
30 | next; | |||
31 | } | |||
32 | if ( /<controlfield\s*tag="(.*)"/ ) { | |||
33 | my $tag = $1; | |||
34 | $_ = shift @parts; | |||
35 | s/<\/controlfield//; | |||
36 | push @fields, MARC::Moose::Field::Control->new( tag => $tag, value => $_ ); # spent 89.4ms making 4000 calls to MARC::Moose::Field::Control::new, avg 22µs/call | |||
37 | next; | |||
38 | } | |||
39 | if ( /<datafield\s*tag="(.*?)"\s*ind1="(.*?)"\s*ind2="(.*)"/ ) { | |||
40 | my ($tag, $ind1, $ind2) = ($1, $2, $3); | |||
41 | my @subf; | |||
42 | while ( @parts && $parts[0] =~ /<subfield.*code="(.*)"/ ) { | |||
43 | my $letter = $1; | |||
44 | shift @parts; | |||
45 | $_ = shift @parts; | |||
46 | s/<\/subfield//; | |||
47 | push @subf, [ $letter => $_ ]; | |||
48 | } | |||
49 | push @fields, MARC::Moose::Field::Std->new( # spent 394ms making 11000 calls to MARC::Moose::Field::Std::new, avg 36µs/call | |||
50 | tag => $tag, | |||
51 | ind1 => $ind1, | |||
52 | ind2 => $ind2, | |||
53 | subf => \@subf ); | |||
54 | shift @parts; | |||
55 | next; | |||
56 | } | |||
57 | last; | |||
58 | } | |||
59 | $record->fields( \@fields ); # spent 9.75ms making 1000 calls to MARC::Moose::Record::fields, avg 10µs/call | |||
60 | ||||
61 | return $record; | |||
62 | 1 | 20µs | 20µs | }; # spent 752µs making 1 call to Moose::override |
63 | ||||
64 | 1 | 16µs | 16µs | __PACKAGE__->meta->make_immutable; # spent 3.54ms making 1 call to Class::MOP::Class::make_immutable
# spent 26µs making 1 call to MARC::Moose::Parser::Marcxml::meta |
65 | ||||
66 | 1 | 23µs | 23µs | 1; |
67 | ||||
68 | =head1 SEE ALSO | |||
69 | =for :list | |||
70 | * L<MARC::Moose> | |||
71 | 1 | 12µs | 12µs | * L<MARC::Moose::Parser> |