Skip to content

Commit

Permalink
Make it possible to read from STDIN
Browse files Browse the repository at this point in the history
  • Loading branch information
claesjac committed Jan 17, 2012
1 parent ea218b6 commit 6129ac0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Pg/Checksource.pm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ sub run {

for my $file (@_) {
if (@token_rules) {
my $lexer = Pg::Parser::Lexer->lex(scalar read_file($file), { ignore_whitespace => 0});
my $src = read_file($file eq '-' ? \*STDIN : $file);
my $lexer = Pg::Parser::Lexer->lex($src, { ignore_whitespace => 0});
my $tokens = $lexer->read_all();
my $stream = Array::Stream::Transactional->new($tokens);
while ($stream->has_more) {
Expand Down

0 comments on commit 6129ac0

Please sign in to comment.