| 1 | package WWW::Garden::Design::Controller::GetFlowerDetails; | ||
| 2 | |||
| 3 | use Mojo::Base 'Mojolicious::Controller'; | ||
| 4 | |||
| 5 | use Date::Simple; | ||
| 6 | |||
| 7 | use Moo; | ||
| 8 | |||
| 9 | our $VERSION = '0.97'; | ||
| 10 | |||
| 11 | # ----------------------------------------------- | ||
| 12 | |||
| 13 | sub display | ||
| 14 | { | ||
| 15 | my($self) = @_; | ||
| 16 | my($flower_id) = $self -> param('flower_id') || 0; | ||
| 17 | |||
| 18 | $self -> app -> log -> debug("GetFlowerDetails.display(flower_id => $flower_id)"); | ||
| 19 | |||
| 20 | if ($flower_id > 0) | ||
| 21 | { | ||
| 22 | my($defaults) = $self -> app -> defaults; | ||
| 23 | my($json) = $$defaults{db} -> get_flower_by_id($flower_id); | ||
| 24 | |||
| 25 | $self -> stash(error => undef); | ||
| 26 | $self -> render(json => $json); | ||
| 27 | } | ||
| 28 | else | ||
| 29 | { | ||
| 30 | my($message) = "Error: Unknown key flower_id = $flower_id"; | ||
| 31 | |||
| 32 | $self -> app -> log -> error($message); | ||
| 33 | $self -> stash(error => $message); | ||
| 34 | $self -> render; | ||
| 35 | } | ||
| 36 | |||
| 37 | } # End of display. | ||
| 38 | |||
| 39 | # ----------------------------------------------- | ||
| 40 | |||
| 41 | 1; | ||
| 42 | |||
| 43 | =pod | ||
| 44 | |||
| 45 | =head1 NAME | ||
| 46 | |||
| 47 | WWW::Garden::Design::Controller::GetFlowerDetails - Manage the 'flowers' database | ||
| 48 | |||
| 49 | =head1 Machine-Readable Change Log | ||
| 50 | |||
| 51 | The file Changes was converted into Changelog.ini by L<Module::Metadata::Changes>. | ||
| 52 | |||
| 53 | =head1 Version Numbers | ||
| 54 | |||
| 55 | Version numbers < 1.00 represent development versions. From 1.00 up, they are production versions. | ||
| 56 | |||
| 57 | =head1 Repository | ||
| 58 | |||
| 59 | L<https://github.com/ronsavage/WWW-Garden-Design> | ||
| 60 | |||
| 61 | =head1 Support | ||
| 62 | |||
| 63 | Email the author, or log a bug on RT: | ||
| 64 | |||
| 65 | L<https://rt.cpan.org/Public/Dist/Display.html?Name=WWW::Garden::Design>. | ||
| 66 | |||
| 67 | =head1 Author | ||
| 68 | |||
| 69 | L<WWW::Garden::Design> was written by Ron Savage I<E<lt>ron@savage.net.auE<gt>> in 2014. | ||
| 70 | |||
| 71 | My homepage: L<https://savage.net.au/>. | ||
| 72 | |||
| 73 | =head1 Copyright | ||
| 74 | |||
| 75 | Australian copyright (c) 2018, Ron Savage. | ||
| 76 | |||
| 77 | All Programs of mine are 'OSI Certified Open Source Software'; | ||
| 78 | you can redistribute them and/or modify them under the terms of | ||
| 79 | The Perl License, a copy of which is available at: | ||
| 80 | http://dev.perl.org/licenses/ | ||
| 81 | |||
| 82 | =cut |