pop

 view release on metacpan or  search on metacpan

lib/POP/Schema_parser.pm  view on Meta::CPAN

use strict;

sub new {
  my $type = shift;
  $type = ref($type) || $type;
  return bless {}, $type;
}

sub parse {
  my($this, $fh) = @_;
  local $/ = ""; # Paragraph mode
  while (<$fh>) {
    s/^--([A-Z]+)(?:\s+CLASS=\[([^\]]+)\])?\n// or croak "Syntax error [$_]";
    my($type, $class) = ($1, $2);
    $class ||= 'GLOBAL';
    push(@{$this->{$class}}, {'type' => $type, 'sql' => $_});
  }
}

1;



( run in 0.618 second using v1.01-cache-2.11-cpan-49f99fa48dc )