]> git.decadent.org.uk Git - maypole.git/commitdiff
Simplified Net::Amazon example (bug 14073)
authorAaron Trevena <aaron.trevena@gmail.com>
Tue, 9 Aug 2005 21:55:44 +0000 (21:55 +0000)
committerAaron Trevena <aaron.trevena@gmail.com>
Tue, 9 Aug 2005 21:55:44 +0000 (21:55 +0000)
git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@370 48953598-375a-da11-a14b-00016c27c3ee

Changes
lib/Maypole/Manual/Request.pod

diff --git a/Changes b/Changes
index d5ba3d3b6184dea96fce8323fd3df895ead2d691..b0e2172cc29f22c4f5e6ef76e2f238bd61c51476 100644 (file)
--- a/Changes
+++ b/Changes
@@ -6,6 +6,7 @@ For information about current developments and future releases, see:
     Fix to documentation for CGI::Maypole (bug 7263)
     Fix to cgi_maypole.t (bug 11346)
     Fix to TT error reporting (bug 13991)
+    Template xhtml validation (bug 13975)
 
 2.10 Tue 19 Jul 2005
     Multiple Template Paths added ( http://rt.cpan.org/NoAuth/Bug.html?id=13447 )
index f9788bd4dd90e4aa9d0c40f8336bc0cdeaeaf0f5..0aa333a6c22be22cf3ea03f2a54bff9336b574b2 100644 (file)
@@ -602,16 +602,21 @@ to the original C<do_edit> routine. For instance, in this method,
 we use a L<Net::Amazon> object to fill in some fields of a database row
 based on an ISBN:
 
+    use Net::Amazon;
+    my $amazon = Net::Amazon->new(token => 'YOUR_AMZN_TOKEN');
+
+    ...
+
     sub create_from_isbn :Exported {
        my ($self, $r) = @_;
-       my $response = $ua->search(asin => $r->params->{isbn});
-       my ($prop) = $response->properties;
+       my $book_info = $amazon->search(asin => $r->params->{isbn})->properties;
+
        # Rewrite the CGI parameters with the ones from Amazon
-       @{$r->params->{qw(title publisher author year)} =            
-           ($prop->title,
-           $prop->publisher,
-           (join "/", $prop->authors()),
-           $prop->year());
+       $r->params->{title} = $book_info->title;
+       $r->params->{publisher} = $book_info->publisher;
+       $r->params->{year} = $book_info->year;
+       $r->params->{author} = join('and', $book_info->authors());
        # And jump to the usual edit/create routine
        $self->do_edit($r);
     }