GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  BADGER::FILESYSTEM::BASE (3)

.ds Aq ’

NAME

Badger::Filesystem::Base - common functionality for Badger::Filesystem modules

CONTENTS

SYNOPSIS



    package Badger::Filesystem::SomeOtherModule;
    use base Badger::Filesystem::Base
    # now this module inherits the base class functionality



DESCRIPTION

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 Badger::Filesystem::File.

METHODS

    init_path(\%config)

Initialisation method which examines the filesystem path specified as a parameter and splits it into volume, directory and name.

    init_options(\%config)

Initialisation method which handles the encoding and codec options.

    encoding($enc)

This method can be used to get or set the default encoding for a file.



    $file->encoding(:utf8);



The encoding will affect all operations that read data from, or write data to the file.

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 contained therein.



    $directory->encoding(:utf8);
    $file = $directory->file(foo.txt);        # has :utf8 encoding set



codec()

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.



    $file->codec(storable);
   
    # first save the data to file
    $file->data($some_data_to_save);
   
    # 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.



    $file->code(storable+base64);



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.



    $directory->codec(json);
    $file = $directory->file(foo.json);       # has json codec set



AUTHOR

Andy Wardley <http://wardley.org/>

COPYRIGHT

Copyright (C) 2009 Andy Wardley. All rights reserved.

SEE ALSO

Badger::Filesystem, Badger::Filesystem::Path, Badger::Filesystem::Directory, Badger::Filesystem::File.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 BADGER::FILESYSTEM::BASE (3) 2010-02-20

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.