Geo::TigerLine::Record::Parser(3)

NAME
Geo::TigerLine::Record::Parser - Parsing superclass for TIGER/Line records.

SYNOPSIS
  package Geo::TigerLine::Record::23;
  use base qw(Geo::TigerLine::Record::Parser);

  @records = __PACKAGE__->parse_file($fh);
  __PACKAGE__->parse_file($fh, \&callback);

  $record = __PACKAGE__->parse($row);

DESCRIPTION
Parses raw TIGER/Line data into Geo::TigerLine::Record objects. This is intended to be used as a superclass of Geo::TigerLine::Record objects and not used directly.

You shouldn't be here.

  Methods

parse_file
        @records = __PACKAGE__->parse_file($fh);
        __PACKAGE__->parse_file($fh, \&callback);

    Parses a given filehandle as a TIGER/Line data file. The data definition is taken from __PACKAGE__->Pack_Tmpl, __PACKAGE__->Dict and __PACKAGE__->Fields. Returns an array of objects of type __PACKAGE__.

    &callback will be called for each record and given a record object and its position in the file (ie. 1 for the first, 2 for the second, etc...). A sample callback...

        sub callback {
            my($record, $pos) = @_;

            printf "Record #$pos is %s\n", $record->tlid;
        }

    If a &callback is given, a list of records will NOT be returned. It is assumed you'll be taking care of arrangements to store the records in your callback and @records can eat up huge amounds of memory for a typical TIGER/Line data file.

parse
        $record = __PACKAGE__->parse($line);

    Parses a single record of TIGER/Line data.

AUTHOR
Michael G Schwern <schwern@pobox.com>

SEE ALSO
Geo::TigerLine