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

Diff for /todotxt/Text-Todo-REST-API/lib/Text/Todo/REST/API/Response.pm between version 1.1 and 1.4

version 1.1, 2010/01/23 07:04:43 version 1.4, 2010/01/26 06:03:11
Line 1 
Line 1 
 package Text::Todo::REST::API::Response;  package Text::Todo::REST::API::Response;
   
 # $AFresh1$  # $AFresh1: Response.pm,v 1.3 2010/01/26 05:05:34 andrew Exp $
   
 use warnings;  use warnings;
 use strict;  use strict;
Line 30 
Line 30 
         my $ident = ident($self);          my $ident = ident($self);
   
         $format_of{$ident} = $options->{format} || '';          $format_of{$ident} = $options->{format} || '';
         $data_of{$ident}   = $options->{data};          $data_of{$ident} = $options->{data};
   
         if ( $options->{type} ) {          if ( $options->{type} ) {
             $type_of{$ident} = $options->{type};              $type_of{$ident} = $options->{type};
Line 42 
Line 42 
         return $self;          return $self;
     }      }
   
     #sub content_type {      sub content_type {
     #my ($self) = shift;          my ($self) = shift;
     #my $ident = ident($self);          return $self->_handle_representation('content_type');
     #return defined $content_type_of{$ident}      }
     #}  
   
     sub _handle_representation {      sub _handle_representation {
         my ( $self, $method, $options ) = @_;          my ( $self, $method, $options ) = @_;
   
         $method = join q{_}, $method, $self->_type;          if ( $method ne 'content_type' ) {
               $method = join q{_}, $method, $self->type;
           }
   
         my $format = $self->_format;          my $format = $self->format;
         if ( $options->{format} ) {          if ( $options->{format} ) {
             $format = $options->{format};              $format = $options->{format};
         }          }
Line 62 
Line 63 
             if (   $class->can_render($format)              if (   $class->can_render($format)
                 && $class->can($method) )                  && $class->can($method) )
             {              {
                 return $class->$method( $format, $self->_data );                  return $class->$method( $format, $self->data );
             }              }
         }          }
   
Line 83 
Line 84 
         croak(@message);          croak(@message);
     }      }
   
     sub _format { my ($self) = @_; return $format_of{ ident $self}; }      sub format { my ($self) = @_; return $format_of{ ident $self}; }
     sub _type   { my ($self) = @_; return $type_of{ ident $self}; }      sub type   { my ($self) = @_; return $type_of{ ident $self}; }
     sub _data   { my ($self) = @_; return $data_of{ ident $self}; }      sub data   { my ($self) = @_; return $data_of{ ident $self}; }
   
     sub DESTROY {      sub DESTROY {
         my ($self) = @_;          my ($self) = @_;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

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