X-Git-Url: http://git.ieval.ro/?p=zeal.git;a=blobdiff_plain;f=lib%2FZeal%2FDocset.pm;h=c3f2f36a3decf4f7bb6f0dd4deb5bb376d24eb62;hp=d280a505e303fb7177a6109e38e571d5d6011c11;hb=refs%2Ftags%2F0.000_002;hpb=c1c9c8170efd62dddd10a2c8e5defd545e48c42b diff --git a/lib/Zeal/Docset.pm b/lib/Zeal/Docset.pm index d280a50..c3f2f36 100644 --- a/lib/Zeal/Docset.pm +++ b/lib/Zeal/Docset.pm @@ -4,7 +4,7 @@ use 5.014000; use strict; use warnings; -our $VERSION = '0.000_001'; +our $VERSION = '0.000_002'; use parent qw/Class::Accessor::Fast/; __PACKAGE__->mk_ro_accessors(qw/path plist dbh name id family/); @@ -45,7 +45,7 @@ sub _blessdocs { sub fetch { my ($self, $path) = @_; - return HTTP::Tiny->new->get($path) if $path =~ /^http:/s; + return HTTP::Tiny->new->get($path)->{content} if $path =~ /^http:/s; my $docroot = catdir $self->path, 'Contents', 'Resources', 'Documents'; $path = rel2abs $path, $docroot; scalar read_file $path @@ -83,6 +83,17 @@ Zeal::Docset - Class representing a Dash/Zeal docset =head1 SYNOPSIS use Zeal::Docset; + my $ds = Zeal::Docset->new('/home/mgv/docsets/Perl.docset'); + say $ds->$path; # /home/mgv/docsets/Perl.docset + say $ds->name; # Perl + say $ds->id; # perl + say $ds->family; # perl + + # In SQL LIKE, % is .* and _ is . + my @matches = $ds->query('perlopen%'); # finds perlopenbsd and perlopentut + my $doc = $ds->query('perlsec'); # A Zeal::Document object for perlsec + my $html = $ds->get('perls_c'); # HTML documentation of perlsec + my @docs = $ds->list; # all documents =head1 DESCRIPTION