Biblio-SIF

 view release on metacpan or  search on metacpan

lib/Biblio/SIF/Patron.pm  view on Meta::CPAN


# -------------------------------------------------------------------

package Biblio::SIF::Patron::Barcode;

use vars qw(@ISA);
@ISA = qw(Biblio::SIF);

use Biblio::SIF;

sub _min_length { 56 }

sub id              { shift()->_numeric(  0, 10, @_ ) }
sub barcode         { shift()->_string(  10, 25, @_ ) }
sub group           { shift()->_string(  35, 10, @_ ) }
sub status          { shift()->_string(  45,  1, @_ ) }
sub status_date     { shift()->_date(    46,     @_ ) }

sub fields {
    qw(
        id barcode group
        status status_date
    );
}

sub as_hash {
    my ($self) = @_;
    my %h = map { $_ => $self->$_ } $self->fields;
    return \%h;
}

# -------------------------------------------------------------------

package Biblio::SIF::Patron::Address;

use vars qw(@ISA);
@ISA = qw(Biblio::SIF);

use Biblio::SIF;

sub _min_length { 429 }

sub id              { shift()->_numeric(  0, 10, @_ ) }
sub type            { shift()->_numeric( 10,  1, @_ ) }
sub status          { shift()->_string(  11,  1, @_ ) }
sub begin_date      { shift()->_date(    12,     @_ ) }
sub end_date        { shift()->_date(    22,     @_ ) }
sub line1           { shift()->_string(  32, 50, @_ ) }
sub line2           { shift()->_string(  82, 40, @_ ) }
sub line3           { shift()->_string( 122, 40, @_ ) }
sub line4           { shift()->_string( 162, 40, @_ ) }
sub line5           { shift()->_string( 202, 40, @_ ) }
sub city            { shift()->_string( 242, 40, @_ ) }
sub state           { shift()->_string( 282,  7, @_ ) }
sub zipcode         { shift()->_string( 289, 10, @_ ) }
sub country         { shift()->_string( 299, 20, @_ ) }
sub phone           { shift()->_string( 319, 25, @_ ) }
sub cell_phone      { shift()->_string( 344, 25, @_ ) }
sub fax             { shift()->_string( 369, 25, @_ ) }
sub other_phone     { shift()->_string( 394, 25, @_ ) }
sub update_date     { shift()->_date(   419,     @_ ) }

sub postal_code     { shift()->_string( 289, 10, @_ ) }  # Alias
sub state_province  { shift()->_string( 282,  7, @_ ) }  # Alias
sub zip_postal      { shift()->_string( 289, 10, @_ ) }  # Alias

sub fields {
    qw(
        id type status
        begin_date end_date update_date
        line1 line2 line3 line4 line5
        city state zipcode country
        phone cell_phone fax other_phone
    );
}

sub as_hash {
    my ($self) = @_;
    my %h = map { $_ => $self->$_ } $self->fields;
    return \%h;
}

1;

=pod

=head1 NAME

Biblio::SIF::Patron - standard patron interchange file for Voyager ILS

=head1 SYNOPSIS

    use Biblio::SIF::Patron;
    $iter = Biblio::SIF::Patron->iterator(\*STDIN);
    while (my $patron = $iter->()) {
        $patron->institution_id($new_id);
        print $patron;
    }



( run in 0.677 second using v1.01-cache-2.11-cpan-9581c071862 )