summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-06-24 15:18:31 -0400
committerJesse Luehrs <doy@tozt.net>2013-06-24 15:18:31 -0400
commit87725010882774876b8497204659d502213aa3e3 (patch)
treecb721b52252f11f2db2c1efbd0488cc0794ca97d
parent6f052e89933cc543f3b54bf183c0f0a55bf01f6f (diff)
downloadreply-87725010882774876b8497204659d502213aa3e3.tar.gz
reply-87725010882774876b8497204659d502213aa3e3.zip
usage information should go to stderr on error
-rw-r--r--lib/Reply/App.pm16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Reply/App.pm b/lib/Reply/App.pm
index beddf84..d8bd52c 100644
--- a/lib/Reply/App.pm
+++ b/lib/Reply/App.pm
@@ -80,24 +80,28 @@ sub run {
return 0;
}
-=method usage
+=method usage($exitcode)
-Prints usage information to the screen.
+Prints usage information to the screen. If C<$exitcode> is 0, it will be
+printed to C<STDOUT>, otherwise it will be printed to C<STDERR>.
=cut
sub usage {
- print " reply [--version] [--help] [--cfg file]\n";
+ my $fh = $_[0] ? *STDERR : *STDOUT;
+ print $fh " reply [--version] [--help] [--cfg file]\n";
}
-=method version
+=method version($exitcode)
-Prints version information to the screen.
+Prints version information to the screen. If C<$exitcode> is 0, it will be
+printed to C<STDOUT>, otherwise it will be printed to C<STDERR>.
=cut
sub version {
- print "Reply version $Reply::VERSION\n";
+ my $fh = $_[0] ? *STDERR : *STDOUT;
+ print $fh "Reply version $Reply::VERSION\n";
}
1;