forked from gudtech/x12-schema
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
430 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package X12::Schema; | ||
|
||
use Moose; | ||
use namespace::autoclean; | ||
use File::Slurp qw( read_file ); | ||
|
||
has root => (is => 'ro', isa => 'X12::Schema::Sequence', required => 1); | ||
|
||
sub parse { | ||
my ($pkg, %args) = @_; | ||
|
||
require X12::Schema::Parser; # laziness, also avoid a circularity | ||
|
||
confess "text argument required" unless $args{text}; | ||
return X12::Schema::Parser->parse( $args{filename} || 'ANON', $args{text} ); | ||
} | ||
|
||
sub parsefile { | ||
my ($pkg, %args) = @_; | ||
|
||
return $pkg->parse( filename => $args{file}, text => scalar(read_file($args{file})) ); | ||
} | ||
|
||
__PACKAGE__->meta->make_immutable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.