← Index
Performance Profile   « block view • line view • sub view »
For t/test-parsing
  Run on Sun Nov 14 09:49:57 2010
Reported on Sun Nov 14 09:50:09 2010

File /home/tamil/util/marc-moose/lib/MARC/Moose/Parser/MarcxmlSax.pm
Statements Executed 21
Total Time 0.0006878 seconds
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
0000s0sMARC::Moose::Parser::MarcxmlSax::::BEGINMARC::Moose::Parser::MarcxmlSax::BEGIN
0000s0sMARC::Moose::Parser::MarcxmlSax::::__ANON__[:13]MARC::Moose::Parser::MarcxmlSax::__ANON__[:13]
0000s0sMARC::Moose::Parser::MarcxmlSax::::__ANON__[:41]MARC::Moose::Parser::MarcxmlSax::__ANON__[:41]
LineStmts.Exclusive
Time
Avg.Code
1package MARC::Moose::Parser::MarcxmlSax;
2# ABSTRACT: Parser for MARXML records using SAX parser
3
4331µs10µsuse namespace::autoclean;
# spent 65µs making 1 call to namespace::autoclean::import
5359µs20µsuse Moose;
6
717µs7µsextends 'MARC::Moose::Parser';
# spent 1.47ms making 1 call to Moose::extends
8
9328µs9µsuse MARC::Moose::Field::Control;
# spent 5µs making 1 call to import
10327µs9µsuse MARC::Moose::Field::Std;
# spent 4µs making 1 call to import
113442µs147µsuse XML::Simple;
# spent 16µs making 1 call to XML::Simple::import
12
13110µs10µshas 'xs' => ( is => 'rw', default => sub { XML::Simple->new() } );
# spent 2.30ms making 1 call to Moose::has
14
15
16override 'parse' => sub {
17 my ($self, $raw) = @_;
18
19 return unless $raw;
20
21 my $ref = eval { $self->xs->XMLin($raw, forcearray => [ 'subfield' ] ) };
22 return undef if $@;
23
24 my $record = MARC::Moose::Record->new();
25 $record->_leader( $ref->{leader} );
26 my @fields_control = map {
27 MARC::Moose::Field::Control->new( tag => $_->{tag}, value => $_->{content} );
28 } @{$ref->{controlfield}};
29 my @fields_std = map {
30 my @sf = map { [ $_->{code}, $_->{content} ] } @{$_->{subfield}};
31 MARC::Moose::Field::Std->new(
32 tag => $_->{tag},
33 ind1 => $_->{ind1},
34 ind2 => $_->{ind2},
35 subf => \@sf,
36 );
37 } @{$ref->{datafield}};
38 $record->fields( [ @fields_control, @fields_std ] );
39
40 return $record;
41121µs21µs};
# spent 505µs making 1 call to Moose::override
42
43117µs17µs__PACKAGE__->meta->make_immutable;
# spent 3.95ms making 1 call to Class::MOP::Class::make_immutable # spent 24µs making 1 call to MARC::Moose::Parser::MarcxmlSax::meta
44
45134µs34µs1;
46
47=head1 SEE ALSO
48
49=for :list
50* L<MARC::Moose>
51* L<MARC::Moose::Parser>
52112µs12µs* L<MARC::Moose::Parser::Marcxml>