| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package URI::Title::PDF; | 
| 2 |  |  |  |  |  |  | $URI::Title::PDF::VERSION = '1.904'; | 
| 3 | 2 |  |  | 2 |  | 3603 | use warnings; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 68 |  | 
| 4 | 2 |  |  | 2 |  | 10 | use strict; | 
|  | 2 |  |  |  |  | 15 |  | 
|  | 2 |  |  |  |  | 615 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | sub types {( | 
| 7 | 2 |  |  | 2 | 0 | 5 | 'application/pdf', | 
| 8 |  |  |  |  |  |  | )} | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | sub title { | 
| 11 | 0 |  |  | 0 | 0 |  | my ($class, $url, $data, $type) = @_; | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 0 |  |  |  |  |  | my %fields = (); | 
| 14 | 0 | 0 |  |  |  |  | my $content = URI::Title::_get_end($url) or return; | 
| 15 | 0 |  |  |  |  |  | foreach my $i (qw(Producer Creator CreationDate Author Title Subject)) { | 
| 16 | 0 |  |  |  |  |  | my @parts = $content =~ m#/$i \((.*?)\)#mgs; | 
| 17 | 0 |  |  |  |  |  | $fields{$i} = $parts[-1]; # grab the last one, hopefully right | 
| 18 |  |  |  |  |  |  | } | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 0 |  |  |  |  |  | my $title = ""; | 
| 21 | 0 |  |  |  |  |  | my @parts = (); | 
| 22 | 0 | 0 |  |  |  |  | if ($fields{Title}) { | 
| 23 | 0 |  |  |  |  |  | push @parts, "$fields{Title}"; | 
| 24 | 0 | 0 |  |  |  |  | if ($fields{Author}) { push @parts, "by $fields{Author}"; } | 
|  | 0 |  |  |  |  |  |  | 
| 25 | 0 | 0 |  |  |  |  | if ($fields{Subject}) { push @parts, "($fields{Subject})"; } | 
|  | 0 |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | } | 
| 27 | 0 | 0 | 0 |  |  |  | if ($fields{Creator} and $fields{Creator} ne 'Not Available') { | 
| 28 | 0 |  |  |  |  |  | push @parts, "creator: $fields{Creator}"; | 
| 29 |  |  |  |  |  |  | } | 
| 30 | 0 | 0 | 0 |  |  |  | if ($fields{Producer} and $fields{Producer} ne 'Not Available') { | 
| 31 | 0 |  |  |  |  |  | push @parts, "produced: $fields{Producer}"; | 
| 32 |  |  |  |  |  |  | } | 
| 33 | 0 |  |  |  |  |  | $title = join(' ', @parts); | 
| 34 | 0 |  |  |  |  |  | return $title; | 
| 35 |  |  |  |  |  |  | } | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | 1; | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | __END__ |