#!/usr/bin/perl
=begin metadata
Name: echo
Description: echo arguments
Author: Randy Yarger, randy.yarger@nextel.com
License: perl
=end metadata
=cut
package PerlPowerTools::echo;
use strict;
my ($VERSION) = '1.2';
__PACKAGE__->run( @ARGV ) unless caller();
sub run {
my ( $self, @args ) = @_;
unless (@args) {
print "\n";
exit 0;
}
if ($args[0] eq '-?') {
print <<EOF;
Usage: echo [-n] [arguments]
Displays the command line arguments, seperated by spaces.
Options:
-n: Do not print a newline after the arguments.
-?: Display usage information.
EOF
exit 0;
}
my $N = 1;
if ($args[0] eq '-n') {
$N = 0;
shift @args;
}
print join ' ', @args;
print "\n" if $N == 1;
exit 0;
}
1;
__END__
=pod
=head1 NAME
echo - echo arguments
=head1 SYNOPSIS
echo [-n] [arguments...]
=head1 DESCRIPTION
echo prints the command line arguments seperated by spaces. A newline is
printed at the end unless the '-n' option is given.
=head2 OPTIONS
I<echo> accepts the following options:
=over 4
=item -n
Do not print a newline after the arguments.
=item -?
Print out a short help message, then exit.
=back
=head1 ENVIRONMENT
The working of I<echo> is not influenced by any environment variables.
=head1 BUGS
I<echo> has no known bugs.
=head1 AUTHOR
The Perl implementation of I<echo>
was written by Randy Yarger, I<randy.yarger@nextel.com>.
=head1 COPYRIGHT and LICENSE
This program is copyright by Randy Yarger 1999.
This program is free and open software. You may use, modify, distribute
and sell this program (and any modified variants) in any way you wish,
provided you do not restrict others to do the same.
=cut