Badger::Filesystem::Base - common functionality for Badger::Filesystem modules
use base 'Badger::Filesystem::Base'
# now this module inherits the base class functionality
"Badger::Filesystem::Base" is a base class module that defines some
common functionality shared by Badger::Filesystem and Badger::Filesystem::Path
(which itself is the base class for Badger::Filesystem::Directory and
Initialisation method which examines the filesystem path specified as a
parameter and splits it into volume, directory and name.
Initialisation method which handles the "encoding" and
This method can be used to get or set the default encoding for a file.
The encoding will affect all operations that read data from, or write data to
The method can also be used to get or set the default encoding for a directory
or filesystem. In this case the option specifies the default encoding for file
$file = $directory->file('foo.txt'); # has :utf8 encoding set
This method can be used to get or set the codec used to serialise data to and
from a file via the data()
method. The codec should be specified by
name, using any of the names that Badger::Codecs recognises or can load.
# first save the data to file
# later... load the data back out
my $data = $file->data;
You can use chained codec specifications if you want to pass the data through
more than one codec.
See Badger::Codecs for further information on codecs.
As with encoding()
, this method can also be used to get or set the
default codec for a directory or filesystem.
$file = $directory->file('foo.json'); # has json codec set
Andy Wardley <http://wardley.org/>
Copyright (C) 2009 Andy Wardley. All rights reserved.
Badger::Filesystem, Badger::Filesystem::Path, Badger::Filesystem::Directory,