]>
Commit | Line | Data |
---|---|---|
1 | package Zeal::Document; | |
2 | ||
3 | use 5.014000; | |
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | our $VERSION = '0.001'; | |
8 | ||
9 | use parent qw/Class::Accessor::Fast/; | |
10 | __PACKAGE__->mk_accessors(qw/id name type path anchor docset/); | |
11 | ||
12 | sub fetch { | |
13 | my ($self) = @_; | |
14 | $self->docset->fetch($self->path) | |
15 | } | |
16 | ||
17 | 1; | |
18 | __END__ | |
19 | ||
20 | =encoding utf-8 | |
21 | ||
22 | =head1 NAME | |
23 | ||
24 | Zeal::Document - Class representing a Dash/Zeal document | |
25 | ||
26 | =head1 SYNOPSIS | |
27 | ||
28 | use Zeal::Document; | |
29 | my $doc = $ds->query('perlsec'); # $ds is a Zeal::Docset instance | |
30 | say $doc->name; # perlsec | |
31 | say $doc->type; # Module | |
32 | say $doc->path; # perldoc-html/perlsec.html | |
33 | my $html = $doc->fetch; # $html is now the HTML documentation for perlsec | |
34 | ||
35 | =head1 DESCRIPTION | |
36 | ||
37 | Dash is an offline API documentation browser. Zeal::Document is a class | |
38 | representing a Dash/Zeal document. | |
39 | ||
40 | Available methods: | |
41 | ||
42 | =over | |
43 | ||
44 | =item $doc->B<id> | |
45 | ||
46 | The ID of this document. Not typically interesting. | |
47 | ||
48 | =item $doc->B<name> | |
49 | ||
50 | The name of this document. | |
51 | ||
52 | =item $doc->B<type> | |
53 | ||
54 | The type of this document. The list of types is available on | |
55 | the Dash website: L<http://kapeli.com/docsets#supportedentrytypes> | |
56 | ||
57 | =item $doc->B<path> | |
58 | ||
59 | The path of this document, relative to | |
60 | F<docset_root/Contents/Resources/Documents/>. This can also be a HTTP | |
61 | URL. | |
62 | ||
63 | =item $doc->B<anchor> | |
64 | ||
65 | The URL anchor/fragment identifier of this document. | |
66 | ||
67 | =item $doc->B<fetch> | |
68 | ||
69 | The HTML content of this document, retrieved from the file system or | |
70 | via HTTP::Tiny. | |
71 | ||
72 | =back | |
73 | ||
74 | =head1 SEE ALSO | |
75 | ||
76 | L<Zeal>, L<http://kapeli.com/dash>, L<http://zealdocs.org> | |
77 | ||
78 | =head1 AUTHOR | |
79 | ||
80 | Marius Gavrilescu, E<lt>marius@ieval.roE<gt> | |
81 | ||
82 | =head1 COPYRIGHT AND LICENSE | |
83 | ||
84 | Copyright (C) 2014-2015 by Marius Gavrilescu | |
85 | ||
86 | This library is free software; you can redistribute it and/or modify | |
87 | it under the same terms as Perl itself, either Perl version 5.20.1 or, | |
88 | at your option, any later version of Perl 5 you may have available. | |
89 | ||
90 | ||
91 | =cut |