Alvis::Document::Type - Perl extension for guessing and checking the type


Alvis-Convert documentation  | view source Contained in the Alvis-Convert distribution.

Index


NAME

Top

Alvis::Document::Type - Perl extension for guessing and checking the type of a document (an extension of MIME types).

SYNOPSIS

Top

 use Alvis::Document::Type;

 # Create a new instance
 my $t=Alvis::Document::Type->new(defaultType=>'text',
                                  defaultSubType=>'html');
 if (!defined($t))
 {
    die('Ugh!');
 }

 my ($doc_type,$doc_sub_type)=$t->guess($doc_text);
 if (!(defined($doc_type) && defined($doc_sub_type)))
 {
    die("Guess what? " . $t->errmsg()); 
 }

DESCRIPTION

Top

Tries to guess the type of a document similarly to MIME types (type and a subtype).

Adds subtypes 'rss' and 'html' to MIME type 'text'.

METHODS

Top

new()

Options:

    defaultType       The default type (text).
    defaultSubType    The default subtype (plain).

guess($text)

Tries to guess the type of $text.

errmsg()

Returns a stack of error messages, if any. Empty string otherwise.

SEE ALSO

Top

AUTHOR

Top

Kimmo Valtonen, <kimmo.valtonen@hiit.fi>

COPYRIGHT AND LICENSE

Top


Alvis-Convert documentation  | view source Contained in the Alvis-Convert distribution.