/[cwmp]/google/trunk/lib/CWMP/Request.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /google/trunk/lib/CWMP/Request.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 65 by dpavlin, Wed Jun 20 23:07:48 2007 UTC revision 92 by dpavlin, Sat Jun 23 09:15:19 2007 UTC
# Line 44  sub _tag { Line 44  sub _tag {
44          }          }
45  }  }
46    
47  my $state;  our $state;     # FIXME check this!
48    
49  my $parser = XML::Rules->new(  my $parser = XML::Rules->new(
50  #       start_rules => [  #       start_rules => [
# Line 71  my $parser = XML::Rules->new( Line 71  my $parser = XML::Rules->new(
71                  # Inform                  # Inform
72                  #                  #
73                  'Inform' => sub {                  'Inform' => sub {
74                          $state->{_dispatch} = 'Inform';         # what reponse to call                          $state->{_dispatch} = 'InformResponse';         # what reponse to call
75                  },                  },
76                  'DeviceId' => sub {                  'DeviceId' => sub {
77                          my ($tag_name, $tag_hash, $context, $parent_data) = @_;                          my ($tag_name, $tag_hash, $context, $parent_data) = @_;
# Line 109  my $parser = XML::Rules->new( Line 109  my $parser = XML::Rules->new(
109                  #                  #
110                  'ParameterInfoStruct' => sub {                  'ParameterInfoStruct' => sub {
111                          my ($tag_name, $tag_hash, $context, $parent_data) = @_;                          my ($tag_name, $tag_hash, $context, $parent_data) = @_;
112                          $state->{ParameterInfo}->{ _tag($tag_hash, 'Name', '_content') } = _tag($tag_hash, 'Writable', '_content' );                          my $name = _tag($tag_hash, 'Name', '_content');
113                          #warn dump( $tag_name, $tag_hash, $context );                          my $writable = _tag($tag_hash, 'Writable', '_content' );
114    
115                            confess "need state" unless ( $state ); # don't remove!
116    
117                            # XXX dragons ahead: convert name to tree rewriting it into perl
118    
119                            my $s = $name;
120                            warn "===> $name\n";
121                            $s =~ s/^([^\.]+)/\$state->{ParameterInfo}->{'$1'}/;
122                            warn "---> $s\n";
123    
124                            my $stat;
125                            while ( $s =~ s/\.(\d+)/->[$1]/ ) {
126                                    $stat->{array}++;
127                                    warn "-\@-> $s\n";
128                            }
129                            while ( $s =~ s/\.([a-zA-Z0-9_]+)/->{'$1'}/ ) {
130                                    $stat->{scalar}++;
131                                    warn "-\$-> $s\n";
132                            };
133                            $s .= "->{'writable'} = $writable;";
134    
135                            warn "## $name\n## tree: $s\n## stat: ",dump( $stat ), "\n";
136    
137                            eval "$s";
138                            confess "can't eval $s : $@" if ($@);
139    
140                            #warn "## state = dump( $state ), "\n";
141                  },                  },
142                  #                  #
143                  # Fault                  # Fault

Legend:
Removed from v.65  
changed lines
  Added in v.92

  ViewVC Help
Powered by ViewVC 1.1.26