[BACK]Return to API.pm CVS log [TXT][DIR] Up to [local] / todotxt / Text-Todo-REST-API / lib / Text / Todo / REST

Diff for /todotxt/Text-Todo-REST-API/lib/Text/Todo/REST/API.pm between version 1.18 and 1.19

version 1.18, 2010/02/13 21:48:28 version 1.19, 2010/02/16 06:12:26
Line 1 
Line 1 
 package Text::Todo::REST::API;  package Text::Todo::REST::API;
   
 # $AFresh1: API.pm,v 1.17 2010/01/31 03:10:39 andrew Exp $  # $AFresh1: API.pm,v 1.18 2010/02/13 21:48:28 andrew Exp $
   
 use warnings;  use warnings;
 use strict;  use strict;
Line 66 
Line 66 
     }      }
   
     sub _parse_options {      sub _parse_options {
         my ( $self, $method, @args ) = @_;          my ( $self, $method, @options) = @_;
   
         my %options = (          my %options = (
             method => lc $method,              method => lc $method,
             list   => '',              list   => '',
             action => 'files',              action => 'files',
             args   => [],              args   => {},
   
             suffix     => $self->_suffix,              suffix     => $self->_suffix,
             file_regex => $self->_file_regex,              file_regex => $self->_file_regex,
             format     => $self->_format,              format     => $self->_format,
         );          );
   
         if (@args) {          if (@options) {
             if ( !ref $args[0] ) {              if ( !ref $options[0] ) {
                 $options{path} = shift @args;                  $options{path} = shift @options;
             }              }
   
             if ( ref $args[0] eq 'HASH' ) {              if ( ref $options[0] eq 'HASH' ) {
                 my $opts = shift @args;                  my $opts = shift @options;
                 foreach my $o ( keys %{$opts} ) {                  foreach my $o ( keys %{$opts} ) {
                     $options{$o} = $opts->{$o};                      $options{$o} = $opts->{$o};
                 }                  }
Line 103 
Line 103 
             }              }
         }          }
   
         if ( $options{action} eq 'entry' && @{ $options{args} } ) {          if ( $options{action} eq 'entry' && @{ $options{extra} } ) {
             $options{action} .= q{_} . lc shift @{ $options{args} };              $options{action} .= q{_} . lc shift @{ $options{extra} };
         }          }
   
           push @{ $options{extra} }, @options;
   
         push @{ $options{args} }, @args;  
   
         my $list = $self->_todo->file( $options{list} );          my $list = $self->_todo->file( $options{list} );
   
         my $suffix = $self->_suffix || q{};          my $suffix = $self->_suffix || q{};
Line 163 
Line 163 
             action => undef,              action => undef,
             list   => undef,              list   => undef,
             entry  => undef,              entry  => undef,
             args   => [],              extra  => [],
         );          );
   
         $path = defined $path ? $path : q{};          $path = defined $path ? $path : q{};
Line 174 
Line 174 
         }          }
   
         ( $options{list}, $options{action},          ( $options{list}, $options{action},
           @{ $options{args} } ) = split '/', $path;            @{ $options{extra} } ) = split '/', $path;
   
         if (!defined $options{action}) {          if (!defined $options{action}) {
             if ( $options{list} ) {              if ( $options{list} ) {
Line 190 
Line 190 
         if ($options{action} eq 'entry'          if ($options{action} eq 'entry'
          || $options{action} eq 'tags'           || $options{action} eq 'tags'
         ) {          ) {
             $options{ $options{action} } = shift @{ $options{args} };              $options{ $options{action} } = shift @{ $options{extra} };
         }          }
   
         return %options;          return %options;

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>