| KiokuDB documentation | Contained in the KiokuDB distribution. |
KiokuDB::Role::Verbosity - A role for printing diagnosis to STDERR
$self->v("blah blah\n"); # only printed if $self->verbose is true
This role provides the verbose attribute and a v method that you can use
to emit verbose output to STDERR.
| KiokuDB documentation | Contained in the KiokuDB distribution. |
#!/usr/bin/perl package KiokuDB::Role::Verbosity; use Moose::Role; use namespace::clean -except => 'meta'; has verbose => ( isa => "Bool", is => "ro", ); sub BUILD { my $self = shift; STDERR->autoflush(1) if $self->verbose; } sub v { my $self = shift; return unless $self->verbose; STDERR->print(@_); } __PACKAGE__ __END__