aboutsummaryrefslogtreecommitdiff
path: root/test.pl
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@openmailbox.org>2016-02-21 20:31:39 -0300
committerMatias Linares <matiaslina@openmailbox.org>2016-02-21 20:31:39 -0300
commite1ec346da17585737f16be9f8f71425b5fe51662 (patch)
tree4ac098101e950a15b5f1f70bf6a07d68a0f93f9b /test.pl
downloadssg-e1ec346da17585737f16be9f8f71425b5fe51662.tar.gz
Initial commit
Diffstat (limited to 'test.pl')
-rwxr-xr-xtest.pl35
1 files changed, 35 insertions, 0 deletions
diff --git a/test.pl b/test.pl
new file mode 100755
index 0000000..363f870
--- /dev/null
+++ b/test.pl
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use Path::Class;
+
+sub trans {
+ my ($dir, $cb) = @_;
+
+ while(my $file = $dir->next) {
+ my $outfile = $file->stringify;
+
+ # Some conditions
+ next if $outfile =~ /(\.|\.\.)$/;
+ next if $outfile eq $dir;
+
+ if($file->is_dir()) {
+ # make a directory
+ trans($file, $cb);
+ next;
+ }
+
+ $cb->($file);
+ }
+}
+
+sub some {
+ my ($f) = @_;
+
+ die "f is empty" if !$f;
+
+ print "Inside some: $f\n";
+}
+
+trans dir("in"), \&some;