Venus::Data
Data Class
Data Class for Perl 5
method: count method: data method: docs method: find method: search method: string method: text
package main;
use Venus::Data;
my $data = Venus::Data->new('t/data/sections');
# $data->find(undef, 'name');
This package provides methods for extracting DATA sections and POD blocks from any file or package. The package can be configured to parse either POD or DATA blocks, and it defaults to being configured for POD blocks.
+=head2 DATA syntax
__DATA__
# data syntax
@@ name
Example Name
@@ end
@@ titles #1
Example Title #1
@@ end
@@ titles #2
Example Title #2
@@ end
+=head2 DATA syntax (nested)
__DATA__
# data syntax (nested)
@@ nested
Example Nested
+@@ demo
blah blah blah
+@@ end
@@ end
+=head2 POD syntax
# pod syntax
=head1 NAME
Example #1
=cut
=head1 NAME
Example #2
=cut
# pod-ish syntax
=name
Example #1
=cut
=name
Example #2
=cut
+=head2 POD syntax (nested)
# pod syntax (nested)
=nested
Example #1
+=head1 WHY?
blah blah blah
+=cut
More information on the same topic as was previously mentioned in the
previous section demonstrating the topic, obviously from said section.
=cut
Venus::Path
The count method uses the criteria provided to "search" for and return the number of blocks found.
count(HashRef $criteria) (Int)
{ since => '0.01', }
=example-1 count
# given: synopsis;
my $count = $data->docs->count;
# 6
The data method returns the text between the DATA and END sections of a Perl package or file.
data() (Str)
{ since => '0.01', }
=example-1 data
# given: synopsis;
$data = $data->data;
# ...
The docs method configures the instance for parsing POD blocks.
docs() (Data)
{ since => '0.01', }
=example-1 docs
# given: synopsis;
my $docs = $data->docs;
# bless({ etag => "=cut", from => "read", stag => "=", ... }, "Venus::Data")
The find method is a wrapper around "search" as shorthand for searching by list and name.
find(Maybe[Str] $list, Maybe[Str] $name) (ArrayRef)
{ since => '0.01', }
=example-1 find
# given: synopsis;
my $find = $data->docs->find(undef, 'name');
# [
# { data => ["Example #1"], index => 4, list => undef, name => "name" },
# { data => ["Example #2"], index => 5, list => undef, name => "name" },
# ]
The search method returns the set of blocks matching the criteria provided. This method can return a list of values in list-context.
find(HashRef $criteria) (ArrayRef)
{ since => '0.01', }
=example-1 search
# given: synopsis;
my $search = $data->docs->search({list => undef, name => 'name'});
# [
# { data => ["Example #1"], index => 4, list => undef, name => "name" },
# { data => ["Example #2"], index => 5, list => undef, name => "name" },
# ]
The string method is a wrapper around "find" as shorthand for searching by list and name, returning only the strings found.
string(Maybe[Str] $list, Maybe[Str] $name) (Str)
{ since => '1.67', }
=example-1 string
# given: synopsis;
my $string = $data->docs->string(undef, 'name');
# "Example #1\nExample #2"
The text method configures the instance for parsing DATA blocks.
text() (Data)
{ since => '0.01', }
=example-1 text
# given: synopsis;
my $text = $data->text;
# bless({ etag => '@@ end', from => 'data', stag => '@@ ', ... }, "Venus::Data")
t/Venus.t: pdml: authors t/Venus.t: pdml: license
40 POD Errors
The following errors were encountered while parsing the POD:
- Around line 13:
Unknown directive: =name
- Around line 21:
Unknown directive: =tagline
- Around line 29:
Unknown directive: =abstract
- Around line 37:
Unknown directive: =includes
- Around line 51:
Unknown directive: =synopsis
- Around line 71:
Unknown directive: =description
- Around line 172:
Unknown directive: =inherits
- Around line 180:
Unknown directive: =method
- Around line 185:
Unknown directive: =signature
- Around line 189:
Unknown directive: =metadata
- Around line 221:
=cut found outside a pod block. Skipping to next block.
- Around line 231:
Unknown directive: =method
- Around line 236:
Unknown directive: =signature
- Around line 240:
Unknown directive: =metadata
- Around line 263:
Unknown directive: =method
- Around line 267:
Unknown directive: =signature
- Around line 271:
Unknown directive: =metadata
- Around line 298:
Unknown directive: =method
- Around line 303:
Unknown directive: =signature
- Around line 307:
Unknown directive: =metadata
- Around line 348:
=cut found outside a pod block. Skipping to next block.
- Around line 371:
=cut found outside a pod block. Skipping to next block.
- Around line 393:
=cut found outside a pod block. Skipping to next block.
- Around line 405:
Unknown directive: =method
- Around line 410:
Unknown directive: =signature
- Around line 414:
Unknown directive: =metadata
- Around line 455:
=cut found outside a pod block. Skipping to next block.
- Around line 478:
=cut found outside a pod block. Skipping to next block.
- Around line 500:
=cut found outside a pod block. Skipping to next block.
- Around line 512:
Unknown directive: =method
- Around line 517:
Unknown directive: =signature
- Around line 521:
Unknown directive: =metadata
- Around line 553:
=cut found outside a pod block. Skipping to next block.
- Around line 571:
=cut found outside a pod block. Skipping to next block.
- Around line 589:
=cut found outside a pod block. Skipping to next block.
- Around line 607:
=cut found outside a pod block. Skipping to next block.
- Around line 617:
Unknown directive: =method
- Around line 621:
Unknown directive: =signature
- Around line 625:
Unknown directive: =metadata
- Around line 652:
Unknown directive: =partials