Changeset 53
- Timestamp:
- 02/17/06 17:29:33 (3 years ago)
- Files:
-
- atom_client/trunk/lib/AtomClient.pm (modified) (4 diffs)
- atom_client/trunk/root/default.tt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
atom_client/trunk/lib/AtomClient.pm
r49 r53 4 4 use warnings; 5 5 use My::XML::Atom::Client; 6 7 # 8 # Set flags and add plugins for the application 9 # 10 # -Debug: activates the debug mode for very useful log messages 11 # Static::Simple: will serve static files from the application's root 12 # directory 13 # 14 use Catalyst qw/-Debug ConfigLoader Static::Simple Prototype/; 6 use Catalyst qw/ConfigLoader Static::Simple Prototype/; 15 7 16 8 our $VERSION = '0.01'; 17 9 18 #19 # Start the application20 #21 10 __PACKAGE__->setup; 22 23 11 __PACKAGE__->config->{static}->{dirs} = [ qw(css img) ]; 24 12 25 =head1 NAME26 27 AtomClient - Catalyst based application28 29 =head1 SYNOPSIS30 31 script/atomclient_server.pl32 33 =head1 DESCRIPTION34 35 Catalyst based application.36 37 =head1 METHODS38 39 =cut40 41 =head2 default42 43 =cut44 45 #46 # Output a friendly welcome message47 #48 13 sub default : Private { 49 14 my ( $self, $c ) = @_; … … 53 18 my ( $self, $c ) = @_; 54 19 55 my $resource_uri = $c->req->param('resource_uri'); 20 my %method_map = ( 21 GET => 'getFeed', 22 POST => 'createEntry', 23 ); 56 24 25 my $method = $method_map{$c->req->param('request_method')}; 57 26 my $api = My::XML::Atom::Client->new; 58 27 $api->username($c->req->param('username')); 59 28 $api->password($c->req->param('password')); 60 29 61 my ($feed, $request, $response) = $api-> getFeed($resource_uri);30 my ($feed, $request, $response) = $api->$method($c->req->param('resource_uri')); 62 31 63 32 ## ãªã¯ãšã¹ãå … … 78 47 } 79 48 80 81 49 sub end : Private { 82 50 my ( $self, $c ) = @_; … … 85 53 } 86 54 87 #88 # Uncomment and modify this end action after adding a View component89 #90 #=head2 end91 #92 #=cut93 #94 #sub end : Private {95 # my ( $self, $c ) = @_;96 #97 # # Forward to View unless response body is already defined98 # $c->forward( $c->view('') ) unless $c->response->body;99 #}100 101 =head1 AUTHOR102 103 Catalyst developer104 105 =head1 LICENSE106 107 This library is free software, you can redistribute it and/or modify108 it under the same terms as Perl itself.109 110 =cut111 112 55 1; atom_client/trunk/root/default.tt
r52 r53 26 26 27 27 <label>Request Method: </label> 28 <select name="request_me dhot">28 <select name="request_method"> 29 29 <option>GET</option> 30 30 <option>POST</option>
