#!/usr/bin/perl
=begin metadata
Name: pwd
Description: working directory name
Author: Kevin Meltzer, perlguy@perlguy.com
License: perl
=end metadata
=cut
use strict;
use Cwd;
my ($VERSION) = '1.3';
my $dir;
my $opt = pop @ARGV;
if (not defined $opt)
{
$dir = getcwd;
}
elsif ($opt eq '-L')
{
$dir = cwd;
}
elsif ($opt eq '-P')
{
$dir = getcwd;
}
else
{
die "Usage: pwd [-L|-P]\n";
}
# Account for / and \ on Win32 and non-Win32 systems
($^O=~/Win32/) ? ($dir) =~s/\//\\/g : ($dir);
print $dir . "\n";
exit;
__END__
=pod
=head1 NAME
pwd - working directory name
=head1 SYNOPSIS
pwd
=head1 DESCRIPTION
Pwd prints the pathname of the working (current) directory.
=head2 OPTIONS
I<pwd> takes no options.
=head1 ENVIRONMENT
The working of I<pwd> is not influenced by any environment variables.
=head1 BUGS
I<pwd> has no known bugs.
=head1 AUTHOR
The Perl implementation of I<pwd>
was written by Kevin Meltzer, I<perlguy@perlguy.com>.
=head1 COPYRIGHT and LICENSE
This program is copyright by Kevin Meltzer 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