NAME

Meta::Utils::Chdir - change current working directories.

COPYRIGHT

Copyright (C) 2001, 2002 Mark Veltzer; All rights reserved.

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.

DETAILS

MANIFEST: Chdir.pm
PROJECT: meta
VERSION: 0.00

SYNOPSIS

package foo;
use Meta::Utils::Chdir qw();
# get the current working directory
my($cwd)=Meta::Utils::Chdir::get_cwd();
# change to some directory
Meta::Utils::Chdir::chdir("/tmp/foo");
# now return to the place where you were
Meta::Utils::Chdir::popd();

DESCRIPTION

This package aids you in finding out and changing the current working directory. The package also enables you to return to directories you were in without the need to save them. The package stores a stack of the visited directories and you can pop up as many directories as you like.

FUNCTIONS

BEGIN()
get_cwd()
get_system_cwd()
chdir($)
system_chdir($)
topd()
popd()
popup($)
TEST($)

FUNCTION DOCUMENTATION

BEGIN()

Bootstrap method which initializes the stack and puts the current working directory on top of it.

get_cwd()

Get the current working directory based on package knowledge (no system interaction). This method simply looks at the top of the stack.

get_system_cwd()

Get the system working directory. No implementation details yet.

chdir($)

Change working directory using the package. It will add the directory to the top of the stack (pushing it). This way you can pop back without remembering where you were. This method will throw an exception if the directory is not valid.

system_chdir($)

Perform a system level chdir without the knowledge of the package. This means that the stack remains oblivious of the directory you're going to. This method will throw an exception if the directory is not valid.

topd()

This method will chdir to the top of the stack. You should use it in case you wander off.

popd()

This method will return to last directory you were in. The method will raise an exception if you try to popd before going anywhere.

popup($)

This method receives the number of levels to go up in the stack. This means that popup(1) and popd() are equivalent calls. This method, much like the popd method, will raise an exception if you try to pop up too many levels.

TEST($)

This is a testing suite for the Meta::Utils::Chdir module. This test is should be run by a higher level management system at integration or release time or just as a regular routine to check that all is well. Currently this method prints the current directory data, chdirs, prints again, pops and print again.

SUPER CLASSES

None.

BUGS

None.

AUTHOR

Name: Mark Veltzer
Email: mailto:veltzer@cpan.org
WWW: http://www.veltzer.org
CPAN id: VELTZER

HISTORY

0.00 MV md5 issues

SEE ALSO

Cwd(3), Error(3), Meta::Ds::Stack(3), Meta::Utils::Output(3), strict(3)

TODO

Nothing.