package Iotta::Copp::Parse::Objs; use strict; require Iotta::Elem; our @ISA = ("Iotta::Elem"); my $ws = "[ \t\n]"; sub run { my $self = shift; my $meta = shift; my $data = shift; $_ = $data; my $obj; my @objs; while (s/(CO_OBJECT|CO_ATTR)$ws*\((.*?)\)//) { my $match = $1; if ($match eq "CO_OBJECT") { my %_obj; $obj = \%_obj; my $o = $2; $o =~ s/(.*?),(.*)/$1/; $$obj{name} = $o; my $fl = $2; $fl =~ s/^[ \t]*|[ \t]*$//g; $$obj{flav} = $fl; $$obj{attrs} = []; push @objs, $obj; } else { my ($t, $m) = split /,/, $2; $t =~ s/^$ws+|$ws+$//g; $m =~ s/^$ws+|$ws+$//g; push @{$$obj{attrs}}, "$t:$m"; } } push @{$$meta{objs}}, @objs; $self->next->run ($meta, $data) if ($self->next); } 1;