From 86a26a896db925d5d3ee8e0d6ed226a565214912 Mon Sep 17 00:00:00 2001 From: dakkar Date: Thu, 20 Oct 2005 11:27:13 +0000 Subject: =?UTF-8?q?comincia=20a=20far=20finta=20di=20andare.=20le=20icone?= =?UTF-8?q?=20non=20vengono=20caricate,=20non=20so=20perch=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Bookmarks/Utils.pm | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 lib/Bookmarks/Utils.pm (limited to 'lib/Bookmarks/Utils.pm') diff --git a/lib/Bookmarks/Utils.pm b/lib/Bookmarks/Utils.pm new file mode 100644 index 0000000..fd0b68d --- /dev/null +++ b/lib/Bookmarks/Utils.pm @@ -0,0 +1,45 @@ +package Bookmarks::Utils; +use strict; +use warnings; +use LWP::Simple; +use URI::URL; + +sub check_link { + my ($url)=@_; + return 1 if $url!~/^http:/; + #my ($type,$length,$update,$expires,$server)=head($url); + #return defined $type; + return scalar head($url); +} + +sub get_site_icon { + my ($url)=@_; + + return if $url!~/^http:/; + + print "Provo nella pagina\n"; + my $page=get($url); + my ($favicon)= grep {defined $_ and $_ ne ''} + ($page =~ + m{new($favicon,$url)->abs->canonical->as_string; + print ", ovvero '$favicon'\n"; + my $icon=get($favicon); + return $icon; +} + +1; -- cgit v1.2.3