Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added usage(), debug(), verbose(), output() to Tools.pm

expects %main::opts
  • Loading branch information...
commit 6e832ac7bb2b20feff98a2d118e79eec1cc6a2d4 1 parent a558735
Ivan Heffner authored codon committed
Showing with 28 additions and 0 deletions.
  1. +28 −0 Tools.pm
View
28 Tools.pm
@@ -13,6 +13,15 @@ use base 'Exporter';
our @EXPORT_OK = qw(
normalize_planet
+ usage
+ debug
+ verbose
+ output
+);
+
+our %EXPORT_TAGS = (
+ 'all' => \@EXPORT_OK,
+ 'messages' => [qw(usage debug verbose output)],
);
our $VERSION = '0.01';
@@ -25,4 +34,23 @@ sub normalize_planet {
return $planet_name;
}
+sub usage {
+ die $main::usage;
+}
+
+sub debug {
+ return unless ( grep { $main::opts{$_} } qw( debug d ) );
+ output(' ==== ',@_);
+}
+
+sub verbose {
+ return unless ( grep { $main::opts{$_} } qw( verbose v debug ) );
+ output(' -- ',@_);
+}
+
+sub output {
+ return if ( grep { $main::opts{$_} } qw( quiet q ) );
+ print scalar(localtime),': ',@_,"\n";
+}
+
1;
Please sign in to comment.
Something went wrong with that request. Please try again.