File Coverage

lib/IO/Tokenized/Scalar.pm
Criterion Covered Total %
statement 20 20 100.0
branch 1 2 50.0
condition n/a
subroutine 6 6 100.0
pod 2 2 100.0
total 29 30 96.6


line stmt bran cond sub pod time code
1             package IO::Tokenized::Scalar;
2 3     3   20 use strict;
  3         6  
  3         166  
3 3     3   28 use base qw(IO::Scalar IO::Tokenized);
  3         7  
  3         3212  
4 3     3   19309 use vars qw($VERSION);
  3         7  
  3         107  
5              
6 3     3   16 use Carp;
  3         5  
  3         576  
7              
8             $VERSION = '0.05';
9              
10             # new has the following synopsis:
11             # IO::Tokenized::Scalar->new([$tokens [,$filename]])
12              
13             sub new {
14 1     1 1 3 my $class = shift;
15 1         2 my ($filename,@tokens) = @_;
16 1 50       10 my $self = defined $filename ? IO::Scalar->new($filename): IO::Scalar->new();
17 1         166 $self = IO::Tokenized->new($self,@tokens);
18 1         45 bless $self,$class;
19             }
20              
21             # redefine so that only opening for input is allowed
22             sub open {
23 1     1 1 2 my $self = shift;
24 1         2 my ($filename) = @_; #silently ignore other parameters
25 1         8 $self->SUPER::open($filename,"r");
26             }
27              
28             1;
29              
30             __END__