| 1 | # $Id: Writer.pm 456 2009-04-15 12:20:59Z fil $ | ||||||||||
| 2 | package Data::Tabular::Dumper::Writer; | ||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | ########################################################### | ||||||||||
| 6 | sub open | ||||||||||
| 7 | 13 | ▶ | { | ||||||||
|
Subroutine
open: called CC=4 SCAR=14.6
Pod
undocumented
| |||||||||||
| 8 | 13 | my($package, $file )=@_; | |||||||||
| 9 | |||||||||||
| 10 | 13 | ▶ | $file = $file->[0] if 'ARRAY' eq ref $file; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 11 | |||||||||||
| 12 | 13 | my $fh; | |||||||||
| 13 | 13 | ▶ | if( ref $file ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 0 | $fh = $file; # assume it's a valid filehandle | |||||||||
| 15 | } | ||||||||||
| 16 | else { | ||||||||||
| 17 | 13 | $fh=eval { local *FH;}; | |||||||||
| 18 | 13 | ▶ | open $fh, ">$file" or die "Unable to open $file: $!\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | } | ||||||||||
| 20 | 13 | return bless { fh=>$fh, fields=>[] }, $package; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | |||||||||||
| 24 | ########################################################### | ||||||||||
| 25 | sub close | ||||||||||
| 26 | 0 | ▶ | { | ||||||||
|
Subroutine
close: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 27 | 0 | my($self)=@_; | |||||||||
| 28 | 0 | delete $self->{fh}; | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | ########################################################### | ||||||||||
| 32 | sub write | ||||||||||
| 33 | 0 | ▶ | { | ||||||||
|
Subroutine
write: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 34 | 0 | my($self, $data)=@_; | |||||||||
| 35 | 0 | die "You MUST overload ", ref($self), "->write"; | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | ########################################################### | ||||||||||
| 39 | sub fields | ||||||||||
| 40 | 0 | ▶ | { | ||||||||
|
Subroutine
fields: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 41 | 0 | my( $self, $data ) = @_; | |||||||||
| 42 | 0 | $self->write( $data ); | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | ########################################################### | ||||||||||
| 46 | sub page_start | ||||||||||
| 47 | 0 | ▶ | { | ||||||||
|
Subroutine
page_start: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 48 | 0 | return; | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | ########################################################### | ||||||||||
| 52 | sub page_end | ||||||||||
| 53 | 0 | ▶ | { | ||||||||
|
Subroutine
page_end: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 54 | 0 | return; | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | 4 | 1; | |||||||||
| 58 | |||||||||||
| 59 | __END__ | ||||||||||