Changeset 36


Ignore:
Timestamp:
11/25/10 03:34:05 (14 years ago)
Author:
nanardon
Message:
  • propery call fetchdata

command line parsing is done by the Model

Location:
server/trunk/web/lib/Sophie
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • server/trunk/web/lib/Sophie/Controller/Chat.pm

    r35 r36  
    22use Moose; 
    33use namespace::autoclean; 
    4 use Getopt::Long; 
    5 use Text::ParseWords; 
    64 
    75BEGIN {extends 'Catalyst::Controller'; } 
     
    2725    my ( $self, $c ) = @_; 
    2826 
    29     $c->response->body('Matched Sophie::Controller::Chat in Chat.'); 
     27 
    3028} 
    3129 
     
    3735 
    3836    foreach my $co (ref $contexts ? @$contexts : $contexts) { 
    39         warn $co; 
    40         if (ref $co) { 
     37        if (ref($co) eq 'HASH') { 
    4138            foreach (keys %$co) { 
    4239                $reqspec->{$_} = $co->{$_}; 
    4340            } 
    4441        } else { 
    45             if (my $coo = $c->forward('/user/fetchdata', $co)) { 
     42            if (my $coo = $c->forward('/user/fetchdata', [ $co ])) { 
    4643                foreach (keys %$coo) {  
    4744                    $reqspec->{$_} = $coo->{$_}; 
  • server/trunk/web/lib/Sophie/Controller/User.pm

    r35 r36  
    5050    my ( $self, $c, $dataname ) = @_; 
    5151 
    52     return $c->forward('fetch_user_data', [ $c->user, $dataname ]); 
     52    return $c->forward('fetch_user_data', [ $c->user || '', $dataname ]); 
    5353} 
    5454 
  • server/trunk/web/lib/Sophie/Model/Chat.pm

    r35 r36  
    22use Moose; 
    33use namespace::autoclean; 
     4use Getopt::Long; 
     5use Text::ParseWords; 
    46 
    57extends 'Catalyst::Model'; 
     
    3133    }, 
    3234    t => { 
    33         code => sub { $_[0]->forward('/distrib/list') }, 
     35        code => sub {  
     36            my ($c, $context, @args) = @_; 
     37            local @ARGV = @args; 
     38            join(', ', @{ $_[0]->forward('/distrib/list', [ {  
     39                distribution => $args[0], 
     40                release => $args[1], 
     41                arch => $args[2], 
     42                }, ] 
     43            ) });; 
     44        }, 
    3445    }, 
    3546}; 
    3647 
    3748sub process { 
    38     my ( $self, $c, $context, $cmd, @args) = @_; 
     49    my ( $self, $c, $context, $message) = @_; 
    3950 
    40     warn keys %$context; 
     51    my ($cmd, @args) = Text::ParseWords::shellwords($message); 
    4152 
    4253    my $msg; 
Note: See TracChangeset for help on using the changeset viewer.