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