lib/Fops.pm
changeset 0 21a87c5f86e4
child 1 9416fc33d2a0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/Fops.pm	Tue Aug 02 00:21:00 2011 +0200
@@ -0,0 +1,51 @@
+package Fops;
+use strict;
+use warnings;
+use Carp;
+
+sub new {
+    my $class = ref $_[0] ? ref shift : shift;
+    my $implementation = shift;
+    eval "require Fops::$implementation";
+    return "Fops::$implementation"->new(@_);
+}
+
+sub type { shift->{type} }
+
+sub cd {
+    my $self = shift;
+    croak "method `cd' needs implementation in ".ref $self;
+}
+
+
+1
+__END__
+
+=head1 NAME
+    
+    Fops - file operations
+
+=head1 SYNOPSIS
+
+    use Fops;
+
+    $fops = Fops->new(native => $root);
+
+    $fops->cd("dir");
+    $fops->put($src => $dst);
+    $fops->rename($from => $to);
+    $fops->stat($src);
+    $fops->get($src => $dst);
+
+    $src = $fops->get($src);
+
+=head1 DESCRIPTION
+
+A simple abstraction for some file operations.
+To be of real use, this module needs helpers.
+
+=head1 SEE ALSO
+
+L<Fops::native(3)>
+
+=cut