package OOTest::Out; use warnings; use feature qw(switch); use experimental 'switch'; use English '-no_match_vars'; use strict; use Carp; require Exporter; use Exporter qw(import); use base qw(Exporter); our @EXPORT_OK = qw(out); use vars qw($VERSION); use Data::Dumper; $VERSION = '0.01'; sub new { my ($class,$args) = @_; my $self = { debug => '0', }; bless $self, $class; return $self; } my $o = OOTest::Out->new(); sub out { my $txt = shift ; if ( $o->{'debug'} eq '1' ) { print {*STDOUT} "[DEBUG][out]$txt\n" or carp $ERRNO; } else { print {*STDOUT} "[out]$txt\n" or carp $ERRNO; } return ; } sub out2 { my ( $self , $txt ) = @_; if ( $self->{'debug'} eq '1' ) { print {*STDOUT} "[DEBUG][out2]$txt\n" or carp $ERRNO; } else { print {*STDOUT} "[out2]$txt\n" or carp $ERRNO; } return ; } sub setopt { my ( $arg,$val ) = @_; $o->{ $arg } = $val ; return ; } 1;