Horris
view release on metacpan or search on metacpan
lib/Horris/Connection/Plugin/PeekURL.pm view on Meta::CPAN
my ($headers) = @_;
if ($headers->{Status} ne '200') {
undef $guard;
$self->connection->irc_notice({
channel => $msg->channel,
message => "Request failed: $headers->{Reason} ($headers->{Status})",
});
return;
}
@ct = split(/\s*,\s*/, $headers->{'content-type'});
if (grep { /^image\/.+$/i } @ct) {
$ct = 1;
} elsif ( grep { !/^text\/.+$/i } @ct) {
# otherwise it's something we don't know about.
# don't spend the time and memory to load this guy
undef $guard;
$ct = 2;
$self->connection->irc_notice({
channel => $msg->channel,
message => sprintf( "%s [%s]%s", $uri, $ct[0], $shorten_url)
( run in 0.584 second using v1.01-cache-2.11-cpan-d7f47b0818f )