X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FZeal%2FDocset.pm;h=1ac98e2341240ea3da48ca6dac9c541cf05e58fe;hb=fb9b7e9f161c44464fc8890644f72599195a195f;hp=3a54621a2cade5ea3c9be240f58116e8a4fa1355;hpb=9f3addb587e04de3fdace8ff2e373cc241297d84;p=zeal.git diff --git a/lib/Zeal/Docset.pm b/lib/Zeal/Docset.pm index 3a54621..1ac98e2 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_003'; use parent qw/Class::Accessor::Fast/; __PACKAGE__->mk_ro_accessors(qw/path plist dbh name id family/); @@ -40,7 +40,11 @@ sub new { sub _blessdocs { my ($self, $docsref) = @_; - map { Zeal::Document->new(+{%$_, docset => $self}) } @$docsref; + map { + my %hash = (%$_, docset => $self); + ($hash{path}, $hash{anchor}) = split /#/s, $hash{path}; + Zeal::Document->new(\%hash); + } @$docsref; } sub fetch { @@ -83,6 +87,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 @@ -162,7 +177,7 @@ Marius Gavrilescu, Emarius@ieval.roE =head1 COPYRIGHT AND LICENSE -Copyright (C) 2014 by Marius Gavrilescu +Copyright (C) 2014-2015 by Marius Gavrilescu This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.20.1 or,