blib/lib/Devel/Trepan/IO/NullOutput.pm untested

filter: Statementstmt 0.0% 0 / 41 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 66 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
close
2.0
is_closed
2.0
CRAP 2.0
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2011 Rocky Bernstein <rocky@cpan.org>
3  
4 # Nukes output. Used for example in sourcing where you don't want
5 # to see output.
6 #
7  
8 # require_relative 'base_io'
9  
10 use warnings; use strict;
11 use Exporter;
12  
13 package Devel::Trepan::IO::NullOutput;
14 use rlib '../../..';
15 use Devel::Trepan::Util qw(hash_merge);
16 use Devel::Trepan::IO;
17  
18 use vars qw(@EXPORT @ISA);
19 @ISA = qw(Devel::Trepan::IO::OutputBase Exporter);
20  
21 sub new($;$$) {
22 my ($class, $out, $opts) = @_;
23 $opts ||= {};
24 my $self = {closed => 0};
25 Devel::Trepan::IO::OutputBase->new($out, $opts);
26 bless ($self, $class);
27 return $self;
28 }
29  
30 sub close($) {
31 my($self) = @_;
32 $self->{closed} = 1;
33 }
34  
35 sub is_closed($) {
36 my($self) = @_;
37 $self->{closed};
38 }
39  
40 sub flush($) {;}
41  
42 # Use this to set where to write to. output can be a
43 # file object or a string. This code raises IOError on error.
44 sub write($) {;}
45  
46 # used to write to a debugger that is connected to this
47 # `str' written will have a newline added to it
48 #
49 sub writeline($$) { ; }
50  
51 # Demo it
52 if( __FILE__ eq $0) {
53 my $output = Devel::Trepan::IO::NullOutput->new(*STDOUT);
54 require Data::Dumper;
55 import Data::Dumper;
56 print Dumper($output);
57 $output->write("Invisible");
58 $output->writeline("Invisible");
59 }
60  
61 1;