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
File::Attributes::Base(3) User Contributed Perl Documentation File::Attributes::Base(3)

File::Attributes::Base - Base class for File::Attributes

Currently, this class works like a pragma. If something inherits from it, File::Attributes will assume it is trying to implement some sort of file attribute accessor.

   package File::Attributes::MyAccessMethod;
   use base 'File::Attributes::Base';

   sub priority { 5 }

   sub applicable {
     my $self = shift;
     my $file = shift;
     eval {
       $self->list($file);
     }
     return 1 if !$@;
     return 0;
   }

   sub list {
     my $self = shift;
     ...
   }
   ...
   1;

Creates an instance. You probably don't need to override this in your subclass.

Called to determine the order in which various subclasses should be used to get or set an attribute. Classes will be called from highest priority to lowest priority until an attribute is successfully accessed. The priority returned should be an integer between 0 and 10. 1 is reserved for access methods that will work on any system, like File::Attributes::Simple. 10 should be used for plugins that will work for any file on any filesystem for a specific OS. 5 should be used for plugins that may or may not work, like UNIX extended filesystem attributes on UNIX-like systems; see File::Attributes::Extended.

A priority of 0 indicates that the module should not be used at all.

Called to determine if this attribute access method works with $filename. Some systems have syscalls for attribute access that may be called on any file, but will fail if the "use attributes" option isn't set on that file's filesystem. In this case, "applicable" can return false so that an alternate access method is tried.

This method will return true (1) if the class can access attributes for $filename and false (0) otherwise.

... but aren't required to, because "$instance->can('method')" will tell whoever's using the module that you're not implementing that method.

Return the value of $attribute on $file. Throw an exception if something bad happens, like $file doesn't exist, or the filesystem doesn't support your type of attribute.

Set the attribute $key to $value on $file. Again, if something bad happpens, "croak"; don't return undef!

Unset the attribute called $attribute. You probably shouldn't throw an exception if $attribute is already undefined, but if it makes sense in your context, feel free to.

Return a list of all attributes that $file has.

Override this so you can return true, otherwise your module will be useless.

Jonathan Rockway "<jrockway@cpan.org>".

Report to RT; see "BUGS" in File::Attributes.
2007-02-04 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

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