File Coverage

blib/lib/SOAP/Transport/IO.pm
Criterion Covered Total %
statement 21 45 46.6
branch 0 18 0.0
condition 0 6 0.0
subroutine 7 11 63.6
pod n/a
total 28 80 35.0


line stmt bran cond sub pod time code
1             # ======================================================================
2             #
3             # Copyright (C) 2000-2001 Paul Kulchenko (paulclinger@yahoo.com)
4             # SOAP::Lite is free software; you can redistribute it
5             # and/or modify it under the same terms as Perl itself.
6             #
7             # ======================================================================
8              
9             package SOAP::Transport::IO;
10              
11 1     1   846 use strict;
  1         2  
  1         46  
12              
13             our $VERSION = 1.12;
14              
15 1     1   487 use IO::File;
  1         1572  
  1         116  
16 1     1   7 use SOAP::Lite;
  1         2  
  1         9  
17             # ======================================================================
18              
19             package SOAP::Transport::IO::Server;
20              
21 1     1   4 use strict;
  1         1  
  1         30  
22 1     1   4 use Carp ();
  1         1  
  1         15  
23 1     1   4 use vars qw(@ISA);
  1         2  
  1         283  
24             @ISA = qw(SOAP::Server);
25              
26             sub new {
27 0     0     my $class = shift;
28              
29 0 0         return $class if ref $class;
30 0           my $self = $class->SUPER::new(@_);
31              
32 0           return $self;
33             }
34              
35             sub in {
36 0     0     my $self = shift;
37 0 0         $self = $self->new() if not ref $self;
38              
39 0 0         return $self->{ _in } if not @_;
40              
41 0           my $file = shift;
42 0 0 0       $self->{_in} = (defined $file && !ref $file && !defined fileno($file))
43             ? IO::File->new($file, 'r')
44             : $file;
45 0           return $self;
46             }
47              
48             sub out {
49 0     0     my $self = shift;
50 0 0         $self = $self->new() if not ref $self;
51              
52 0 0         return $self->{ _out } if not @_;
53              
54 0           my $file = shift;
55 0 0 0       $self->{_out} = (defined $file && !ref $file && !defined fileno($file))
56             ? IO::File->new($file, 'w')
57             : $file;
58 0           return $self;
59             }
60              
61             sub handle {
62 0     0     my $self = shift->new;
63              
64 0 0         $self->in(*STDIN)->out(*STDOUT) unless defined $self->in;
65 0           my $in = $self->in;
66 0           my $out = $self->out;
67              
68 0           my $result = $self->SUPER::handle(join '', <$in>);
69 1     1   5 no strict 'refs';
  1         1  
  1         49  
70 0 0         print {$out} $result
  0            
71             if defined $out;
72 0           return;
73             }
74              
75             # ======================================================================
76              
77             1;
78              
79             __END__