Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
AnyData::Storage::FileUser Contributed Perl DocumentaAnyData::Storage::File(3)

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

	Opens, reads from, writes to, creates and destroys files with numerous
	options	for error handling, flocking, binmode, etc.

	The simplest form is the equivalent of

	      my $f    = AnyData::Storage::File->new(dirs=>\@dirs,flock=>1);
	      my $str1 = $f->adSlurp($file);

	      for( @dirs ) {
		  open(IN,$file) or die	$!;
	      sub slurp	{
		  local	*IN;
		  local	$/ = undef;

	But, depending on how you set the default behaviour

	use AnyData;
	my $f =	AnyData::Storage::File->new;

       <  input, fail if doesn't exist >  output, truncate if exists, create
       if doesn't >> append, create if doesn't exist +<	read/write, fail if
       doesn't exist

       r  = < r+ =

	my $f =	AnyData::Storage::File->new;


	my $f =	AnyData::Storage::File->new( %flags );

	%flags is a hash which can contain any or all of:

	    f_dir      => $directory,	# defaults to './' (
	    binmode    => $binmode,	# defaults to 0	(doesn't binmode files)
	    printError => $warnings,	# defaults to 1	(print warning on errors)

open_local_file( $fname, $mode );
	Mode is	one of

	a = append     open for	reading	& writing, create if doesn't exist
	r = read       open for	reading, fail if doesn't exist
	u = open       open for	reading	& writing, fail	if doesn't exist
	c = create     open for	reading	& writing, fail	if it already exists
	o = overwrite  open for	reading	& writing, overwrite if	it already exists

	Additionally, all modes	fail if	the file can't be opened.  On systems
	that support flock, 'r'	fails if a shared lock can not be obtained; the
	other modes fail if an exclusive lock can't be obtained.

perl v5.32.0			  2014-10-27	     AnyData::Storage::File(3)

NAME | DESCRIPTION | SYNOPSIS | new() | open_local_file( $fname, $mode );

Want to link to this manual page? Use this URL:

home | help