Why not adopt me?
NAME
MooseX::Role::WithWorkingDirectory - Syntactic sugar for running a method while in a directory
VERSION
version 0.02
SYNOPSIS
package MyObject;
use Moose;
with 'MooseX::Role::WithWorkingDirectory';
sub list_files {
system 'ls';
}
# later...
my $object = MyObject->new;
$object->with_wd('/tmp/something')->list_files; # lists files in /tmp/something
$object->list_files; # lists files in original CWD
DESCRIPTION
Use this Moose role to add the with_wd
method to your classes.
METHODS
$object->with_wd($directory)
Changes the current working directory to $directory
, and runs methods in that directory. When those methods return, your application will be back in its original working directory.
AUTHOR
Rob Hoelz <rob@hoelz.ro>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Rob Hoelz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
BUGS
Please report any bugs or feature requests on the bugtracker website http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-Role-WithWorkingDirec tory
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.