diff options
author | dakkar <dakkar@luxion> | 2005-11-09 17:14:54 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2005-11-09 17:14:54 +0000 |
commit | 27cff350e9e5fb832185bc14dee35b5b8f942a81 (patch) | |
tree | e89f9b5d457b711cce6d908ef0b33792cab20e75 /lib/Bookmarks/Utils.pm | |
parent | ora il BookmarksManager gestisce per bene i tag multipli, e i template sono f... (diff) | |
download | Bookmarks-27cff350e9e5fb832185bc14dee35b5b8f942a81.tar.gz Bookmarks-27cff350e9e5fb832185bc14dee35b5b8f942a81.tar.bz2 Bookmarks-27cff350e9e5fb832185bc14dee35b5b8f942a81.zip |
* passati i template a HTML4, altrimenti l'autocompletamento non va
* aggiunto autocompletamento per i nomi di tag
* migliorato il caricatore da YAML
* aggiunto un convertitore XBEL -> YAML
* aggiunto campo 'tipo icona'
* aggiunta funzionalità di edit e delete di link
* dopo ogni update di un link, i tag non più riferiti vengono cancellati
* migliorato il recupero favicon, con tipo
Diffstat (limited to 'lib/Bookmarks/Utils.pm')
-rw-r--r-- | lib/Bookmarks/Utils.pm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Bookmarks/Utils.pm b/lib/Bookmarks/Utils.pm index fd0b68d..a876340 100644 --- a/lib/Bookmarks/Utils.pm +++ b/lib/Bookmarks/Utils.pm @@ -1,15 +1,17 @@ package Bookmarks::Utils; use strict; use warnings; -use LWP::Simple; +use LWP::UserAgent; use URI::URL; +my $ua=LWP::UserAgent->new(); + 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); + return $ua->head($url)->is_success(); } sub get_site_icon { @@ -38,8 +40,14 @@ sub get_site_icon { print "Trovato: '$favicon'"; $favicon=URI::URL->new($favicon,$url)->abs->canonical->as_string; print ", ovvero '$favicon'\n"; - my $icon=get($favicon); - return $icon; + my $res=$ua->get($favicon); + + if ($res->is_success()) { + return ($res->decoded_content(),$res->header('Content-type')); + } + else { + return; + } } 1; |