App-TextFragmentUtils
view release on metacpan or search on metacpan
lib/App/TextFragmentUtils.pm view on Meta::CPAN
=over
=item * L<get-fragment>
=item * L<list-fragments>
=back
=head1 FUNCTIONS
=head2 get_fragment
Usage:
get_fragment(%args) -> [$status_code, $reason, $payload, \%result_meta]
Get fragment with a certain ID in text.
If there are multiple occurences of the fragment with the same ID ,
This function is not exported.
Arguments ('*' denotes required arguments):
=over 4
=item * B<comment_style> => I<str> (default: "shell")
Comment style.
=item * B<filename>* => I<filename>
=item * B<id>* => I<str>
Fragment ID.
=item * B<label> => I<str> (default: "FRAGMENT")
Comment label.
=back
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP status code
(200 means OK, 4xx caller error, 5xx function error). Second element
($reason) is a string containing error message, or "OK" if status is
200. Third element ($payload) is optional, the actual result. Fourth
element (%result_meta) is called result metadata and is optional, a hash
that contains extra information.
Return value: Fragment (array)
Will return status 200 if fragment is found. Result will be a hash with the
following keys: C<raw> (string), C<payload> (string), C<attrs> (hash), C<id>
(string, can also be found in attributes).
Return 404 if fragment is not found.
=head2 list_fragments
Usage:
list_fragments(%args) -> [$status_code, $reason, $payload, \%result_meta]
List fragments in text.
This function is not exported.
Arguments ('*' denotes required arguments):
=over 4
=item * B<comment_style> => I<str> (default: "shell")
Comment style.
=item * B<filename>* => I<filename>
=item * B<label> => I<str> (default: "FRAGMENT")
Comment label.
=back
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP status code
(200 means OK, 4xx caller error, 5xx function error). Second element
($reason) is a string containing error message, or "OK" if status is
200. Third element ($payload) is optional, the actual result. Fourth
element (%result_meta) is called result metadata and is optional, a hash
that contains extra information.
Return value: List of fragments (array)
Will return status 200 if operation is successful. Result will be an array of
fragments, where each fragment is a hash containing these keys: C<raw> (string),
C<payload> (string), C<attrs> (hash), C<id> (string, can also be found in
attributes).
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/App-TextFragmentUtils>.
=head1 SOURCE
Source repository is at L<https://github.com/perlancar/perl-App-TextFragmentUtils>.
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=App-TextFragmentUtils>
When submitting a bug or request, please include a test-file or a
( run in 1.624 second using v1.01-cache-2.11-cpan-39bf76dae61 )