Parse::SAMGov - Parses SAM Entity Management Public Extract Layout from SAM.gov
version 0.101
my $parser = Parse::SAMGov::Parser->new; my $entities = $parser->parse_file(entity => 'SAM_PUBLIC_DAILY_20160701.dat'); foreach my $e (@$entities) { ## do something with each entity say $e->DUNS, ' is a valid entity'; } # ... do something ... my $exclusions = $parser->parse_file(exclusion => 'SAM_Exclusions_Public_Extract_16202.CSV'); foreach my $e (@$exclusions) { ## do something with each entity that has been excluded say $e->DUNS, ' has been excluded'; }
This method takes as arguments the file to be parsed and returns an array reference of Parse::SAMGov::Entity or Parse::SAMGOv::Exclusion objects depending on the data being parsed. Returns undef if the type is not 'entity' or 'exclusion'. If the third argument is a coderef then passes each Entity or Exclusion object into the callback instead rather than returning it. This can be useful for a lower memory footprint if the file to parse is large or if the user wants to write a filter that only picks entities they're interested in. The function returns an array reference only if the callback mode is not used.
my $entities = $parser->parse_file('SAM_PUBLIC_DAILY_20160701.dat'); my $exclusions = $parser->parse_file('SAM_Exclusions_Public_Extract_16202.CSV'); $parser->parse_file('SAM_PUBLIC_DAILY_20160701.dat', sub { my ($entity_or_exclusion, $optional_user_arg) = @_; #... do something ... }, $optional_user_arg);
Vikas N Kumar <vikas@cpan.org>
This software is copyright (c) 2016 by Selective Intellect LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Parse::SAMGov, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parse::SAMGov
CPAN shell
perl -MCPAN -e shell install Parse::SAMGov
For more information on module installation, please visit the detailed CPAN module installation guide.