Meta
view release on metacpan or search on metacpan
Meta/Utils/Chdir.pm view on Meta::CPAN
$VERSION="0.00";
@ISA=qw();
#sub BEGIN();
#sub get_cwd();
#sub get_system_cwd();
#sub chdir($);
#sub system_chdir($);
#sub topd();
#sub popd();
#sub popup($);
#sub TEST($);
#__DATA__
our($stack);
sub BEGIN() {
$stack=Meta::Ds::Stack->new();
# put current directory on stack
$stack->push(Cwd::cwd());
Meta/Utils/Chdir.pm view on Meta::CPAN
sub topd() {
my($directory)=$stack->top();
system_chdir($directory);
}
sub popd() {
$stack->pop();
topd();
}
sub popup($) {
my($num)=@_;
$stack->popup($num);
topd();
}
sub TEST($) {
my($context)=@_;
Meta::Utils::Output::print("cwd is [".get_cwd()."]\n");
Meta::Utils::Output::print("system_cwd is [".get_system_cwd()."]\n");
&chdir("/tmp");
Meta::Utils::Output::print("cwd is [".get_cwd()."]\n");
Meta::Utils::Output::print("system_cwd is [".get_system_cwd()."]\n");
Meta/Utils/Chdir.pm view on Meta::CPAN
=head1 FUNCTIONS
BEGIN()
get_cwd()
get_system_cwd()
chdir($)
system_chdir($)
topd()
popd()
popup($)
TEST($)
=head1 FUNCTION DOCUMENTATION
=over 4
=item B<BEGIN()>
Bootstrap method which initializes the stack and puts the current working directory
on top of it.
Meta/Utils/Chdir.pm view on Meta::CPAN
=item B<topd()>
This method will chdir to the top of the stack. You should use it in case
you wander off.
=item B<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.
=item B<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.
=item B<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.
( run in 2.086 seconds using v1.01-cache-2.11-cpan-364913b4093 )