=================================================================== RCS file: /cvs/todotxt/Text-Todo-REST-API/lib/Text/Todo/REST/API/Representations/md5.pm,v retrieving revision 1.1 retrieving revision 1.3 diff -u -r1.1 -r1.3 --- todotxt/Text-Todo-REST-API/lib/Text/Todo/REST/API/Representations/md5.pm 2010/01/18 03:51:40 1.1 +++ todotxt/Text-Todo-REST-API/lib/Text/Todo/REST/API/Representations/md5.pm 2010/01/19 03:20:14 1.3 @@ -1,8 +1,8 @@ package Text::Todo::REST::API::Representations::md5; -# $AFresh1: md5.pm,v 1.3 2010/01/18 00:30:55 andrew Exp $ +# $AFresh1: md5.pm,v 1.2 2010/01/19 03:18:34 andrew Exp $ -use base 'Text::Todo::REST::API'; +use base 'Text::Todo::REST::API::Representations'; use warnings; use strict; @@ -11,40 +11,37 @@ use version; our $VERSION = qv('0.0.1'); { - my %handled_formats = map { $_ => 1 } qw( - md5 - ); - sub content_type { return 'text/plain' }; + sub content_type { return 'text/plain' } - sub _handles { - my ($class, $format) = @_; + sub can_format { + my ( $class, $format ) = @_; + return if !defined $format; + + my %handled_formats = map { $_ => 1 } qw( + md5 + ); + return exists $handled_formats{$format}; } - sub Dump { - my ($self, @output) = @_; - my $action = $self->_action; + sub dump_list { + my ( $self, $format, @input ) = @_; my $output; - if ($action eq 'files') { - $output .= $self->SUPER::Dump(@output); - #foreach my $o (@output) { - #} + foreach my $o (@input) { + $output .= "MD5 ($o->{text}) = $o->{md5}\n"; } - elsif ($action eq 'list' || $action eq 'entry') { - foreach my $o (@output) { - $output .= "MD5 ($o->{text}) = $o->{md5}\n"; - } - } - else { - $output .= $self->SUPER::Dump(@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__ =head1 NAME