Tom Wyant > CPAN-Access-AdHoc > CPAN::Access::AdHoc::Util



Annotate this POD

Module Version: 0.000_194   Source  


CPAN::Access::AdHoc::Util - Utility functions for CPAN::Access::AdHoc


 use CPAN::Access::AdHoc::Util;

 say 'The CPAN default plugins are ',
     join ', ', CPAN::Access::AdHoc::Util::plugins(
         'CPAN::Access::AdHoc::Default::CPAN' );


This module provides utility functions to CPAN::Access::AdHoc. It is private to the CPAN-Access-AdHoc distribution. Documentation is for the benefit of the author only.


This module provides the following public subroutines (which are nonetheless private to the CPAN-Access-AdHoc distribution):


This subroutine/method returns the hash element of its argument which is named after the caller's name space. This element is initialized to an empty hash if necessary.


This subroutine takes as its argument a putative distribution path relative to the authors/id/ directory. If it does not begin with the two levels of directory that are derived from the author name, these are added. The expanded path is returned.


 __guess_media_type( $resp, $path );

This subroutine guesses the media type and encoding.

The first argument is an HTTP::Response object such as would have been returned by a successful fetch of the data.

The second argument is optional, and is the URL or path used to fetch the data. If the second argument is defined, it sets the Content-Location header in $resp. If $path is not defined, it defaults to $resp->header( 'Content-Location' ), and an exception is thrown if there is none.

The method loads the Content-Type and Content-Encoding headers of the $resp object with its best guess at what they are. Nothing is returned.

Note that the arguments are reversed from LWP::MediaTypes::guess_media_type().


This subroutine takes as its arguments one or more module names, and loads them.


This subroutine loads Carp, and then passes its arguments to carp().


This subroutine loads Carp, and then passes its arguments to croak().


This subroutine loads Carp, and then passes its arguments to confess(), prefixed by the text 'Programming Error - '.


Support is by the author. Please file bug reports at, or in electronic mail to the author.


Thomas R. Wyant, III wyant at cpan dot org


Copyright (C) 2012-2014 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.

syntax highlighting: