PICA::Path - PICA path expression to match field and subfield values
use PICA::Path; use PICA::Parser::Plain; # extract URLs from PIC Records, given from STDIN my $urlpath = PICA::Path->new('009P$a'); my $parser = PICA::Parser::Plain->new(\*STDIN); while ( my $record = $parser->next ) { print "$_\n" for $urlpath->record_subfields($record); }
PICA path expressions can be used to match fields and subfields of PICA::Data records or equivalent record structures. An instance of PICA::Path is a blessed array reference, consisting of the following fields:
regular expression to match field tags against
regular expression to match occurrences against, or undefined
regular expression to match subfields against
substring start position
substring end position
Create a PICA path by parsing the path expression. The expression consists of
A tag, constisting of three digits, the first 0 to 2, followed by a digit or @. The character * can be used as wildcard.
0
2
@
*
An optional occurrence, given by two digits (or * as wildcard) in brackets, e.g. [12] or [0*].
[12]
[0*]
An optional list of subfields. Allowed subfield codes include _A-Za-z0-9.
_A-Za-z0-9
An optional position, preceeded by /. Both single characters (e.g. /0 for the first), and character ranges (such as 2-4, -3, 2-...) are supported.
/
/0
2-4
-3
2-
Check whether a given PICA field matches the field and occurrence of this path. Returns the $field on success.
$field
Returns an array reference with fields of a PICA::Data that match the path. Subfield codes are ignore.
Returns a list of matching subfields (optionally trimmed by from and length) without inspection field and occurrence values.
Stringifies the PICA path to normalized form. Subfields are separated with $, unless called as stringify(1) or the first subfield is $.
$
stringify(1)
Catmandu::Fix::pica_map
To install PICA::Data, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PICA::Data
CPAN shell
perl -MCPAN -e shell install PICA::Data
For more information on module installation, please visit the detailed CPAN module installation guide.