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

Diff for /todotxt/Text-Todo-REST-API/lib/Text/Todo/REST/API/Representations/text.pm between version 1.1 and 1.2

version 1.1, 2010/01/18 03:51:40 version 1.2, 2010/01/19 03:18:34
Line 1 
Line 1 
 package Text::Todo::REST::API::Representations::text;  package Text::Todo::REST::API::Representations::text;
   
 # $AFresh1: text.pm,v 1.3 2010/01/18 00:30:55 andrew Exp $  # $AFresh1: text.pm,v 1.1 2010/01/18 03:51:40 andrew Exp $
   
 use base 'Text::Todo::REST::API';  use base 'Text::Todo::REST::API::Representations';
   
 use warnings;  use warnings;
 use strict;  use strict;
Line 11 
Line 11 
 use version; our $VERSION = qv('0.0.1');  use version; our $VERSION = qv('0.0.1');
   
 {  {
     my %handled_formats = map { $_ => 1 } qw(      sub content_type { return 'text/plain' }
         text  
         txt  
     );  
   
     sub content_type { return 'text/plain' };      sub can_format {
           my ( $class, $format ) = @_;
           return if !defined $format;
   
     sub _handles {          my %handled_formats = map { $_ => 1 } qw(
         my ($class, $format) = @_;              text
               txt
           );
   
         return exists $handled_formats{$format};          return exists $handled_formats{$format};
     }      }
   
       sub dump_files {
           my ( $self, $format, @input ) = @_;
   
     sub Dump {          my $output;
         my ($self, @output) = @_;          foreach my $line (@input) {
         my $action = $self->_action;              $output .= "$line\n";
           }
           return $output;
       }
   
       sub dump_list {
           my ( $self, $format, @input ) = @_;
   
         my $output;          my $output;
         if ($action eq 'files') {          foreach my $o (@input) {
             foreach my $o (@output) {              $output .= "$o->{text}\n";
                 $output .= "$o\n";  
             }  
         }          }
         elsif ($action eq 'list' || $action eq 'entry') {  
             foreach my $o (@output) {  
                 $output .= "$o->{text}\n";  
             }  
         }  
         else {  
             $output .= $self->SUPER::Dump(@output);  
         }  
         return $output;          return $output;
     }      }
   
       sub dump_entry {
           my ( $self, @args ) = @_;
           return $self->dump_list(@args);
       }
 }  }
   
 1; # Magic true value required at end of module  1;    # Magic true value required at end of module
 __END__  __END__
   
 =head1 NAME  =head1 NAME

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

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