M: Added currentDepth() method.

The getDepth() method will return the default (or user-specified) directory traversel depth. Calling the setDepth method with a negative value will make the method die.
This commit is contained in:
Jens Luedicke
2013-03-09 12:17:40 +01:00
parent 7c0e8dfa92
commit ff77f66d82
2 changed files with 23 additions and 2 deletions

6
t/1.t
View File

@@ -11,6 +11,12 @@ $dw = new File::DirWalk();
ok( ref($dw) eq 'File::DirWalk' );
is ($dw->getDepth(), 0);
dies_ok { $dw->setDepth(-1) };
is ($dw->getDepth(), 0);
ok ($dw->setDepth(1));
is ($dw->getDepth(), 1);
ok ($dw->setHandler(onBeginWalk => sub { SUCCESS }));
ok ($dw->setHandler(onLink => sub { SUCCESS }));
ok ($dw->setHandler(onFile => sub { SUCCESS }));