| Filename | /usr/lib/perl5/site_perl/5.14/Archive/Zip/StringMember.pm |
| Statements | Executed 9 statements in 824µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 258µs | 267µs | Archive::Zip::StringMember::BEGIN@3 |
| 1 | 1 | 1 | 25µs | 25µs | Archive::Zip::StringMember::BEGIN@6 |
| 1 | 1 | 1 | 15µs | 422µs | Archive::Zip::StringMember::BEGIN@11 |
| 1 | 1 | 1 | 14µs | 90µs | Archive::Zip::StringMember::BEGIN@4 |
| 0 | 0 | 0 | 0s | 0s | Archive::Zip::StringMember::_become |
| 0 | 0 | 0 | 0s | 0s | Archive::Zip::StringMember::_newFromString |
| 0 | 0 | 0 | 0s | 0s | Archive::Zip::StringMember::_readRawChunk |
| 0 | 0 | 0 | 0s | 0s | Archive::Zip::StringMember::contents |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Archive::Zip::StringMember; | ||||
| 2 | |||||
| 3 | 2 | 69µs | 2 | 276µs | # spent 267µs (258+9) within Archive::Zip::StringMember::BEGIN@3 which was called:
# once (258µs+9µs) by installer::archivefiles::BEGIN@30 at line 3 # spent 267µs making 1 call to Archive::Zip::StringMember::BEGIN@3
# spent 9µs making 1 call to strict::import |
| 4 | 2 | 86µs | 2 | 166µs | # spent 90µs (14+76) within Archive::Zip::StringMember::BEGIN@4 which was called:
# once (14µs+76µs) by installer::archivefiles::BEGIN@30 at line 4 # spent 90µs making 1 call to Archive::Zip::StringMember::BEGIN@4
# spent 76µs making 1 call to vars::import |
| 5 | |||||
| 6 | # spent 25µs within Archive::Zip::StringMember::BEGIN@6 which was called:
# once (25µs+0s) by installer::archivefiles::BEGIN@30 at line 9 | ||||
| 7 | 2 | 23µs | $VERSION = '1.30'; | ||
| 8 | @ISA = qw( Archive::Zip::Member ); | ||||
| 9 | 1 | 60µs | 1 | 25µs | } # spent 25µs making 1 call to Archive::Zip::StringMember::BEGIN@6 |
| 10 | |||||
| 11 | 1 | 407µs | # spent 422µs (15+407) within Archive::Zip::StringMember::BEGIN@11 which was called:
# once (15µs+407µs) by installer::archivefiles::BEGIN@30 at line 14 # spent 407µs making 1 call to Exporter::import | ||
| 12 | :CONSTANTS | ||||
| 13 | :ERROR_CODES | ||||
| 14 | 2 | 579µs | 1 | 422µs | ); # spent 422µs making 1 call to Archive::Zip::StringMember::BEGIN@11 |
| 15 | |||||
| 16 | # Create a new string member. Default is COMPRESSION_STORED. | ||||
| 17 | # Can take a ref to a string as well. | ||||
| 18 | sub _newFromString { | ||||
| 19 | my $class = shift; | ||||
| 20 | my $string = shift; | ||||
| 21 | my $name = shift; | ||||
| 22 | my $self = $class->new(@_); | ||||
| 23 | $self->contents($string); | ||||
| 24 | $self->fileName($name) if defined($name); | ||||
| 25 | |||||
| 26 | # Set the file date to now | ||||
| 27 | $self->setLastModFileDateTimeFromUnix( time() ); | ||||
| 28 | $self->unixFileAttributes( $self->DEFAULT_FILE_PERMISSIONS ); | ||||
| 29 | return $self; | ||||
| 30 | } | ||||
| 31 | |||||
| 32 | sub _become { | ||||
| 33 | my $self = shift; | ||||
| 34 | my $newClass = shift; | ||||
| 35 | return $self if ref($self) eq $newClass; | ||||
| 36 | delete( $self->{'contents'} ); | ||||
| 37 | return $self->SUPER::_become($newClass); | ||||
| 38 | } | ||||
| 39 | |||||
| 40 | # Get or set my contents. Note that we do not call the superclass | ||||
| 41 | # version of this, because it calls us. | ||||
| 42 | sub contents { | ||||
| 43 | my $self = shift; | ||||
| 44 | my $string = shift; | ||||
| 45 | if ( defined($string) ) { | ||||
| 46 | $self->{'contents'} = | ||||
| 47 | pack( 'C0a*', ( ref($string) eq 'SCALAR' ) ? $$string : $string ); | ||||
| 48 | $self->{'uncompressedSize'} = $self->{'compressedSize'} = | ||||
| 49 | length( $self->{'contents'} ); | ||||
| 50 | $self->{'compressionMethod'} = COMPRESSION_STORED; | ||||
| 51 | } | ||||
| 52 | return $self->{'contents'}; | ||||
| 53 | } | ||||
| 54 | |||||
| 55 | # Return bytes read. Note that first parameter is a ref to a buffer. | ||||
| 56 | # my $data; | ||||
| 57 | # my ( $bytesRead, $status) = $self->readRawChunk( \$data, $chunkSize ); | ||||
| 58 | sub _readRawChunk { | ||||
| 59 | my ( $self, $dataRef, $chunkSize ) = @_; | ||||
| 60 | $$dataRef = substr( $self->contents(), $self->_readOffset(), $chunkSize ); | ||||
| 61 | return ( length($$dataRef), AZ_OK ); | ||||
| 62 | } | ||||
| 63 | |||||
| 64 | 1 | 8µs | 1; |