MIME-Types

 view release on metacpan or  search on metacpan

lib/MIME/Types.pm  view on Meta::CPAN

	$spec       = 'text/plain' if $spec eq 'text';   # old mailers

	$spec =~ m!^(?:x\-)?([^/]+)/(?:x-)?(.*)!
		or return;

	my $section = $typedb{$1}    or return;
	my $record  = $section->{$2} or return;
	return $record if ref $record;   # already extended

	my $simple   = $2;
	my ($type, $ext, $enc, $char) = split m/\;/, $record;
	my $os       = undef;   # XXX TODO

	$section->{$simple} = MIME::Type->new(
		type       => $type,
		extensions => [split /\,/, $ext],
		encoding   => $enc,
		system     => $os,
		charset    => $char,
	);
}

lib/MIME/Types.pm  view on Meta::CPAN

	}

	undef;
}


sub addType(@)
{	my $self = shift;

	foreach my $type (@_)
	{	my ($major, $minor) = split m!/!, $type->simplified;
		$typedb{$major}{$minor} = $type;
		$typedb{EXTENSIONS}{$_} = $type for $type->extensions;
	}
	$self;
}


sub types()
{	my $self  = shift;
	my @types;



( run in 0.619 second using v1.01-cache-2.11-cpan-71847e10f99 )