Finance::MICR::LineParser

Validate and parse a check MICR string
Download

Finance::MICR::LineParser Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Leo Charre
  • Publisher web site:
  • http://search.cpan.org/~leocharre/

Finance::MICR::LineParser Tags


Finance::MICR::LineParser Description

Validate and parse a check MICR string Finance::MICR::LineParser is a Perl module that can parse a MICR Line code into parts. Additionally tell us if a string garble contains a MICR code. If you have a string and want to parse it as a check's MICR line, this is useful.I am presently using this module to let the office scan in documents and using gocr, I get a string out of the scanned check image. Then with this module I parse the MICR line- if one is there. I name the documents for archiving after the MICR code.Obviously with scanning, the MICR symbols don't have unicode equivalents- so various companies have switched the symbols for alpha counterparts. This module accepts the symbols being more then one character. This is beacuse gocr can't group something like '||"' into one character. You may have trained your ocr software to replace those with something like Tt (transit, which looks like |:) and UUu (on us, which looks like ||"). This module can be told on instantiation, that the symbols are something other then the defaults. For example, I trained my gocr to change ||" to CCc and |: to Aa - so I start an object instance like so: my $micr = new Finance::MICR::LineParser({ string => $string_from_gocr, on_us_symbol => 'CCc', transit_symbol => 'Aa', dash_symbol => 'DDd', ammount_symbol => 'XxX', });By default, these are changed to : * Transit Symbol: T * Ammount Symbol: X * On-Us Symbol: U * Dash Symbol: DThat is, when you query methods such as $micr->on_us, the return on_us value therein is U and not CCc.As of this time, if you want to change the symbols back to something else, it's up to you to handle the output.SYNOPSIS use Finance::MICR::LineParser; my $micr = Finance::MICR::LineParser->new({ string => $string }); print "Is this a MICR code? ". $micr->valid;Imagine you scanned in a check using a standard scanner. And used some OCR sofware to try to extract the text from it. It could have a miriad problems, garble, etc - but it's what we have to work with. So.. let's create a small cli script that takes potentially garble and tells us if a MICR code is there and something about it.micrline.pl: #!/usr/bin/perl -w use strict; use Finance::MICR::LineParser; my $string = $ARGV; $string or die('missing arg'); my $micr = new Finance::MICR::LineParser({ string => $string }); if ($micr->valid){ print "A valid MICR line is present: ".$micr->micr." "; print "The type of check is: ".$micr->get_check_type." "; print "The routing number is: ".$micr->routing_number." "; print "The check number is: ".$micr->check_number." "; print "Status: ".$micr->status; } elsif ($micr->is_unknown_check){ print "I don't see a full valid MICR line here, but this is what I can match up " ."if this is a business check: ". $micr->micr." "; print "Status: ".$micr->status; } else { print "This is garble to me. "; print "Status: ".$micr->status; }Now in your terminal: # perl ./micrline.pl U2323424U_T234244T_2342424U Requirements: · Perl


Finance::MICR::LineParser Related Software