Solstice::ContentTypeService - Provides mappings between content-types and icons, MIMEExtensions, etc.
use Solstice::ContentTypeService; my $filename = 'filename.txt'; my $service = Solstice::ContentTypeService->new(); my $content_type = $service->getContentTypeByFilename($filename); # returns 'text/plain'; my $description = $service->getContentDescriptionByContentType($content_type); # returns 'Plain text file' my $extension = $service->getExtensionByContentType($content_type); # returns 'txt'
Solstice::ContentTypeService is a service for identifying and depicting a file's content-type in various ways. How is this service useful? Let's say that you have identified a file's content type as 'text/plain'. A view might wish to display an appropriate icon for this content type (see Solstice::IconService), as well as a 'human-readable' description, both of which can be returned by this service.
Solstice::Service::Memory
No symbols exported.
Creates a new Solstice::ContentTypeService object.
Returns a content-type for the passed filehandle, based on magic numbers.
Returns a content-type for the passed filename, or undef if a file extension cannot be discerned.
Returns an array ref of content-type synonyms for the passed type. The list includes the passed type.
Returns a content-type suitable for placing into a download header. If the passed $type is a synonym, its parent type is returned.
Returns TRUE if the passed $type is a vague content type as returned by File::MMagic::checktype_contents().
Returns TRUE if the passed $type is a web-viewable text type or synonym, FALSE otherwise.
checks if the type passed includes a charset declaration
Returns TRUE if the passed $type is a web-viewable image type or synonym, FALSE otherwise.
Return the class name. Overridden to avoid a ref() in the superclass.
Solstice::Service::Memory.
Catalyst Group, <catalyst@u.washington.edu>
$Revision: 2257 $
Copyright 1998-2007 Office of Learning Technologies, University of Washington
Licensed under the Educational Community License, Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.opensource.org/licenses/ecl1.php
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
To install Solstice, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Solstice
CPAN shell
perl -MCPAN -e shell install Solstice
For more information on module installation, please visit the detailed CPAN module installation guide.