1URI::Title(3) User Contributed Perl Documentation URI::Title(3)
2
3
4
6 URI::Title - get the titles of things on the web in a sensible way
7
9 use URI::Title qw( title );
10 my $title = title('http://microsoft.com');
11 print "Title is $title\n";
12
14 I keep having to find the title of things on the web. This seems like a
15 really simple request, just get() the object, parse for a title tag,
16 you're done. Ha, I wish. There are several problems with this approach:
17
18 What if the resource is on a very slow server? Do we wait for ever or
19 what?
20 What if the resource is a 900 gig file? You don't want to download
21 that.
22 What if the page title isn't in a title tag, but is buried in the HTML
23 somewhere?
24 What if the resource is an MP3 file, or a word document or something?
25 ...
26
27 So, let's solve these issues once.
28
30 only one, the title(url) method. Call it with an url, get the title if
31 possible, undef if it wasn't. Very simple.
32
34 Many, many, many things. Still unimplemented:
35
36 Get titles of MP3 files, Word Docs, PDFs, etc.
37 Configurable.. well, anything, in fact. Timeout would be a good start.
38 Better error reporting.
39
41 Tom Insam <tom@jerakeen.org>, original author, 2004-2012.
42
43 Philippe Bruhat (BooK) <book@cpan.org>, maintainer, 2014.
44
45 This program is free software; you can redistribute it and/or modify it
46 under the same terms as Perl itself.
47
49 Invented because of a conversation with rjp, who contributed some
50 eyeball-melting and as-yet-unused code to get titles from MP3s and
51 PDFs, and hex, who has also solved the problem, and got bits done in a
52 nicer way than I did.
53
54
55
56perl v5.28.0 2016-08-20 URI::Title(3)