|
NAMEData::Object::DataABSTRACTPodish Parser for Perl 5SYNOPSISpackage main; use Data::Object::Data; my $data = Data::Object::Data->new( file => 't/Data_Object_Data.t' ); DESCRIPTIONThis package provides methods for parsing and extracting pod-like sections from any file or package. The pod-like syntax allows for using these sections anywhere in the source code and having Perl properly ignoring them.SCENARIOSThis package supports the following scenarios:syntax# POD # =head1 NAME # # Example #1 # # =cut # # =head1 NAME # # Example #2 # # =cut # Podish Syntax # =name # # Example #1 # # =cut # # =name # # Example #2 # # =cut # Podish Syntax (Nested) # =name # # 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 as-is obvious from said section # ... # # =cut # Alternate Podish Syntax # @=name # # Example #1 # # @=cut # # @=name # # Example #2 # # @=cut my $data = Data::Object::Data->new( file => 't/examples/alternate.pod' ); $data->contents('name'); # [['Example #1'], ['Example #2']] This package supports parsing standard POD and pod-like sections from any file or package, anywhere in the document. Additionally, this package supports an alternative POD definition syntax which helps differentiate between the traditional POD usage and other usages. ATTRIBUTESThis package has the following attributes:datadata(Str) This attribute is read-only, accepts "(Str)" values, and is optional. filefile(Str) This attribute is read-only, accepts "(Str)" values, and is optional. fromfrom(Str) This attribute is read-only, accepts "(Str)" values, and is optional. METHODSThis package implements the following methods:contentcontent(Str $name) : ArrayRef[Str] The content method the pod-like section where the name matches the given string.
contentscontents(Str $list, Str $name) : ArrayRef[ArrayRef] The contents method returns all pod-like sections that start with the given string, e.g. "pod" matches "=pod foo". This method returns an arrayref of data for the matched sections. Optionally, you can filter the results by name by providing an additional argument.
itemitem(Str $name) : HashRef The item method returns metadata for the pod-like section that matches the given string.
listlist(Str $name) : ArrayRef The list method returns metadata for each pod-like section that matches the given string.
list_itemlist_item(Str $list, Str $item) : ArrayRef[HashRef] The list_item method returns metadata for the pod-like sections that matches the given list name and argument.
parserparser(Str $string) : ArrayRef The parser method extracts pod-like sections from a given string and returns an arrayref of metadata.
pluckpluck(Str $type, Str $item) : ArrayRef[HashRef] The pluck method splices and returns metadata for the pod-like section that matches the given list or item by name. Splicing means that the parsed dataset will be reduced each time this method returns data, making this useful with iterators and reducers.
AUTHORAl Newkirk, "awncorp@cpan.org"LICENSECopyright (C) 2011-2019, Al Newkirk, et al.This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file" <https://github.com/iamalnewkirk/data-object-data/blob/master/LICENSE>. PROJECTWiki <https://github.com/iamalnewkirk/data-object-data/wiki>Project <https://github.com/iamalnewkirk/data-object-data> Initiatives <https://github.com/iamalnewkirk/data-object-data/projects> Milestones <https://github.com/iamalnewkirk/data-object-data/milestones> Contributing <https://github.com/iamalnewkirk/data-object-data/blob/master/CONTRIBUTE.md> Issues <https://github.com/iamalnewkirk/data-object-data/issues>
Visit the GSP FreeBSD Man Page Interface. |