NAME

CPAN::Access::AdHoc::Archive::Null - Archive-like wrapper for un-archived data.

SYNOPSIS

use CPAN::Access::AdHoc::Archive::Null;
use LWP::UserAgent;

my $ua = LWP::UserAgent->new();
my $resp = $ua->get( ... );
my $tar = CPAN::Access::AdHoc::Archive::Null->new(
    content => \( $resp->content() ),
    encoding => $resp->header( 'Content-Encoding' ),
);

DESCRIPTION

This class wraps an un-archived file or text block, providing a CPAN::Access::AdHoc::Archive-compliant interface. It is private to the CPAN-Access-AdHoc package.

METHODS

This class supports the following public methods:

new

This static method instantiates the object, and possibly loads it. The supported arguments are:

content

This is the content to be loaded into the object. A scalar reference is assumed to be the literal content. A non-reference is assumed to be the file name. Any other value is unsupported.

If this argument is a scalar reference, the file name is set to 'unknown', and the contents are accessed under that name.

encoding

This is the MIME encoding of the content. It is ignored if the content is not present.

mtime

This is the modification time of the content. If the content is not a reference, it is taken as a file name, so this argument is ignored and the modification time of the file is used instead.

path

This is intended to be a path to the content. If not specified, and the content argument is a file name (i.e. not a reference), this defaults to the content argument.

get_item_content

This method returns the content of the named item in the archive. Because there can only ever be one file in the pseudo-archive, if the argument is undef, the content of that file is returned.

list_contents

This method lists the contents of the archive. It always returns exactly one name, which will be 'unknown' if the the object was initialized with content => \$scalar.

SUPPORT

Support is by the author. Please file bug reports at http://rt.cpan.org, or in electronic mail to the author.

AUTHOR

Thomas R. Wyant, III wyant at cpan dot org

COPYRIGHT AND LICENSE

Copyright (C) 2012 by Thomas R. Wyant, III

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.