Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    PICA::Record 0.36

    Download button

    No screenshots available
    Downloads: 364  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Good (3.5/5)
    14 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Jakob Voss | More programs
    Perl Artistic License / FREE
    March 27th, 2008, 16:20 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    PICA::Record description

    PICA::Record is a Perl extension for handling PICA records.

    PICA::Record is a Perl extension for handling PICA records.

    METHODS

    new( [data] )

    Base constructor for the class. A single string will be parsed line by line into PICA::Field objects, empty lines and start record markers will be skipped. More then one or non scalar parameters will be passed to append so you can use the constructor in the same way:

    my $record = PICA::Record->new('037A','a' => 'My note');

    If no data is given then it just returns a completely empty record.

    fields()

    Returns an array of all the fields in the record. The array contains a PICA::Field object for each field in the record. An empty array is returns if the record is empty.

    field( $tagspec(s) )

    Returns a list of tags that match the field specifier, or in scalar context, just the first matching tag.

    You may specify multiple tags and use regular expressions.

    my $field = $record->field("021A","021C");
    my $field = $record->field("009P/03");
    my @fields = $record->field("02..");
    my @fields = $record->field("039[B-E]");

    subfield

    Shortcut method for getting just the subfield's value of a tag (see PICA::Field). Returns a list of subfield values that match or in scalar context, just the first matching subfield.
    These are equivalent (in scalar context):

    my $title = $pica->field('021A')->subfield('a');
    my $title = $pica->subfield('021A','a');

    You may also specify both field and subfield seperated by '$'. Don't forget to quote the dollar sign!

    my $title = $pica->subfield('021A$a');
    my $title = $pica->subfield("021A$a");
    my $title = $pica->subfield("021A$a"); # this won't work!

    If either the field or subfield can't be found, undef is returned.

    You may also use wildcards like in field() and the subfield() method of PICA::Field:

    my @values = $pica->subfield('005A', '0a'); # 005A$0 and 005A$a
    my @values = $pica->subfield('005[AIJ]', '0'); # 005A$0, 005I$0, and 005J$0

    values

    Shortcut method to get subfield values of multiple fields and subfields. The fields and subfields are specified in a list of strings, for instance:

    my @titles = $pica->values( '021A$a', '025@$a', '026C$a');

    This method always returns an array.

    You may also use wildcards in the field specifications, see subfield() and field().

    main

    Get the main record (all tags starting with '0').

    local

    Get the local record (all tags starting with '1').

    copy

    Get the copy record (all tags starting with '2').

    is_empty

    Return true if the record is empty (no fields or all fields empty)

    delete_fields ( )

    Delete fields specified by tags. You can also use wildcards, see field() for examples Returns the number of deleted fields.

    append

    Appends one or more fields to the end of the record. Parameters can be PICA::Field objects or parameters that are passed to PICA::Field->new.

    my $field = PICA::Field->new('037A','a' => 'My note');
    $record->append($field);
    is equivalent to
    $record->append('037A','a' => 'My note');

    You can also append multiple fields with one call:

    my $field = PICA::Field->new('037A','a' => 'First note');
    $record->append($field, '037A','a' => 'Second note');

    $record->append(
    '037A', 'a' => '1st note',
    '037A', 'a' => '2nd note',
    );

    Returns the number of fields appended.

    replace

    Replace a field. You must pass a tag and a field. Attention: Only the first occurence will be replaced so better not use this method for repeatable fields.

    sort()

    Sort all fields. Most times the order of fields is not changed and not relevant but sorted fields are helpful for viewing records.

    add_headers

    Add header fields to a PICA::Record. You must specify two named parameters (eln and satus). This method is experimental. There is no test whether the header fields already exist.

    normalized()

    Returns record as a normalized string. Optionally adds prefix data at the beginning.

    print $record->normalized();
    print $record->normalized("##TitleSequenceNumber 1n");
    to_xml

    Returns the record in XML format (not tested, nor official).

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    PICA records | manipulate records | Perl module | PICA | records | Perl

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM