File::Attributes::Extended - Access UNIX extended filesystem


File-Attributes-Extended documentation Contained in the File-Attributes-Extended distribution.

Index


Code Index:

NAME

Top

File::Attributes::Extended - Access UNIX extended filesystem attributes with File::Attributes.

VERSION

Top

Version 0.01

SYNOPSIS

Top

    use File::Attributes ':all';
    set_attribute('filename', foo => 'bar');
    print get_attribute('filename', 'foo'); # bar

This module should not be used directly -- File::Attributes will automatically use it when possible.

If you're sure you don't want the File::Attributes API, see File::ExtAttr.

FUNCTIONS

Top

This module implements all of the functions File::Attributes expects. See File::Attributes::Base for more information.

get

set

unset

list

applicable

Applicable if the file's filesystem supports extended filesystem attributes.

priority

Priority 6 (medium)

AUTHOR

Top

Jonathan Rockway, <jrockway at cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-file-attributes-extended at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-Attributes-Extended. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc File::Attributes::Extended

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/File-Attributes-Extended

* CPAN Ratings

http://cpanratings.perl.org/d/File-Attributes-Extended

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Attributes-Extended

* Search CPAN

http://search.cpan.org/dist/File-Attributes-Extended

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


File-Attributes-Extended documentation Contained in the File-Attributes-Extended distribution.
package File::Attributes::Extended;

use warnings;
use strict;
use base 'File::Attributes::Base';
use File::ExtAttr ':all';
our $VERSION = '0.01';

sub priority { 6 };
sub applicable {
    my $self = shift;
    my $file = shift;
    
    eval { $self->get($file, 'perltest') };
    return if $@; # can't use
    return 1; # can use
}

sub get {
    my $self = shift;
    my $file = shift;
    my $attr = shift;
    # make warnings fatal
    local $SIG{__WARN__} = sub { die "$_[0] ($!)" };
    return getfattr($file, $attr);
}

sub set {
    my $self = shift;
    my $file = shift;
    my $attr = shift;
    my $value= shift;
    
    # make warnings fatal
    local $SIG{__WARN__} = sub { die "$_[0] ($!)" };
    setfattr($file, $attr, $value);
    return 1;
}

sub list {
    my $self = shift;
    my $file = shift;
    
    local $!;
    my @result = listfattr($file);
    die "Error listing attributes: $!" if !@result && $!;
    return @result;
}

sub unset {
    my $self = shift;
    my $file = shift;
    my $attr = shift;
    
    # make warnings fatal
    local $SIG{__WARN__} = sub { die "$_[0] ($!)" };

    return delfattr($file, "$attr");
}

1;
__END__
1; # End of File::Attributes::Extended