1AnyData::Storage::File(U3s)er Contributed Perl DocumentatAinoynData::Storage::File(3)
2
3
4

NAME

6        AnyData::Storage::File -- manipulate files with rich warnings
7

DESCRIPTION

9        Opens, reads from, writes to, creates and destroys files with numerous
10        options for error handling, flocking, binmode, etc.
11
12        The simplest form is the equivalent of
13
14              my $f    = AnyData::Storage::File->new(dirs=>\@dirs,flock=>1);
15              my $str1 = $f->adSlurp($file);
16
17              for( @dirs ) {
18                  open(IN,$file) or die $!;
19              }
20              sub slurp {
21                  local *IN;
22                  local $/ = undef;
23              }
24
25        But, depending on how you set the default behaviour
26

SYNOPSIS

28        use AnyData;
29        my $f = AnyData::Storage::File->new;
30        $f->set('binmode',1⎪0);
31        $f->set('PrintError',1⎪0);
32        $f->set('RaiseError',1⎪0);
33        $f->set('Trace',1⎪0);
34        $f->set('f_dir',$dir⎪$dir_array)
35
36       <  input, fail if doesn't exist >  output, truncate if exists, create
37       if doesn't >> append, create if doesn't exist +< read/write, fail if
38       doesn't exist
39
40       r  = < r+ =
41

new()

43        my $f = AnyData::Storage::File->new;
44
45        or
46
47        my $f = AnyData::Storage::File->new( %flags );
48
49        %flags is a hash which can contain any or all of:
50
51            f_dir      => $directory,   # defaults to './' (
52            binmode    => $binmode,     # defaults to 0 (doesn't binmode files)
53            printError => $warnings,    # defaults to 1 (print warning on errors)
54

open_local_file( $fname, $mode );

56        Mode is one of
57
58        a = append     open for reading & writing, create if doesn't exist
59        r = read       open for reading, fail if doesn't exist
60        u = open       open for reading & writing, fail if doesn't exist
61        c = create     open for reading & writing, fail if it already exists
62        o = overwrite  open for reading & writing, overwrite if it already exists
63
64        Additionally, all modes fail if the file can't be opened.  On systems
65        that support flock, 'r' fails if a shared lock can not be obtained; the
66        other modes fail if an exclusive lock can't be obtained.
67
68
69
70perl v5.8.8                       2001-07-17         AnyData::Storage::File(3)
Impressum