lib/Fops.pm
changeset 0 21a87c5f86e4
child 1 9416fc33d2a0
equal deleted inserted replaced
-1:000000000000 0:21a87c5f86e4
       
     1 package Fops;
       
     2 use strict;
       
     3 use warnings;
       
     4 use Carp;
       
     5 
       
     6 sub new {
       
     7     my $class = ref $_[0] ? ref shift : shift;
       
     8     my $implementation = shift;
       
     9     eval "require Fops::$implementation";
       
    10     return "Fops::$implementation"->new(@_);
       
    11 }
       
    12 
       
    13 sub type { shift->{type} }
       
    14 
       
    15 sub cd {
       
    16     my $self = shift;
       
    17     croak "method `cd' needs implementation in ".ref $self;
       
    18 }
       
    19 
       
    20 
       
    21 1
       
    22 __END__
       
    23 
       
    24 =head1 NAME
       
    25     
       
    26     Fops - file operations
       
    27 
       
    28 =head1 SYNOPSIS
       
    29 
       
    30     use Fops;
       
    31 
       
    32     $fops = Fops->new(native => $root);
       
    33 
       
    34     $fops->cd("dir");
       
    35     $fops->put($src => $dst);
       
    36     $fops->rename($from => $to);
       
    37     $fops->stat($src);
       
    38     $fops->get($src => $dst);
       
    39 
       
    40     $src = $fops->get($src);
       
    41 
       
    42 =head1 DESCRIPTION
       
    43 
       
    44 A simple abstraction for some file operations.
       
    45 To be of real use, this module needs helpers.
       
    46 
       
    47 =head1 SEE ALSO
       
    48 
       
    49 L<Fops::native(3)>
       
    50 
       
    51 =cut