Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 128 lines (85 sloc) 2.488 kB
634795b make catalyst branch the new trunk
autarch authored
1 package VegGuide;
2
3 use strict;
4 use warnings;
5
6 our $VERSION = '0.01';
7
e7603dd @autarch Only return some User data for many rest end points.
autarch authored
8 our $REST_VERSION = '0.0.2';
e3da00c @autarch Sync REST API version throughout code base and docs.
autarch authored
9
634795b make catalyst branch the new trunk
autarch authored
10 use Catalyst;
11 use DateTime;
12 use VegGuide::Client;
13 use VegGuide::Config;
14 use VegGuide::Request;
15 use VegGuide::Response;
16
17 use VegGuide::Engine;
18
19 use VegGuide::Attribute;
20 use VegGuide::Comment;
21 use VegGuide::Cuisine;
22 use VegGuide::Location;
23 use VegGuide::User;
24 use VegGuide::Vendor;
e694f1a Rename from external vendor source to just vendor source
autarch authored
25 use VegGuide::VendorSource;
634795b make catalyst branch the new trunk
autarch authored
26
75efbec @autarch lots more work on new layout
autarch authored
27 use namespace::autoclean;
28 use Moose;
634795b make catalyst branch the new trunk
autarch authored
29
d752bd7 @autarch perltidy all code
autarch authored
30 BEGIN {
75efbec @autarch lots more work on new layout
autarch authored
31 extends 'Catalyst';
32
634795b make catalyst branch the new trunk
autarch authored
33 Catalyst->import( VegGuide::Config->CatalystImports() );
34 }
35
75efbec @autarch lots more work on new layout
autarch authored
36 with( VegGuide::Config->CatalystRoles() );
37
d752bd7 @autarch perltidy all code
autarch authored
38 __PACKAGE__->config(
39 name => 'VegGuide',
40 VegGuide::Config->CatalystConfig(),
41 );
634795b make catalyst branch the new trunk
autarch authored
42
d752bd7 @autarch perltidy all code
autarch authored
43 __PACKAGE__->request_class('VegGuide::Request');
44 __PACKAGE__->response_class('VegGuide::Response');
634795b make catalyst branch the new trunk
autarch authored
45
46 __PACKAGE__->setup();
47
d752bd7 @autarch perltidy all code
autarch authored
48 sub client {
634795b make catalyst branch the new trunk
autarch authored
49 my $self = shift;
50
51 my $stash = $self->stash();
52
53 return $stash->{client} if $stash->{client};
54
55 my $location = $stash->{location};
56 $location ||= $stash->{vendor}->location()
57 if $stash->{vendor};
58
59 my $locale;
60 $locale = $location->locale() if $location;
61
d752bd7 @autarch perltidy all code
autarch authored
62 return $stash->{client}
63 = VegGuide::Client->new( $self->request(), $locale );
634795b make catalyst branch the new trunk
autarch authored
64 }
65
66 {
d752bd7 @autarch perltidy all code
autarch authored
67
634795b make catalyst branch the new trunk
autarch authored
68 package Devel::InnerPackage;
69
70 no warnings 'redefine';
71
72 sub list_packages {
d752bd7 @autarch perltidy all code
autarch authored
73 my $pack = shift;
74 $pack .= "::" unless $pack =~ m!::$!;
634795b make catalyst branch the new trunk
autarch authored
75
76 no strict 'refs';
77 my @packs;
78 my @stuff = grep !/^(main|)::$/, keys %{$pack};
79
80 # This is a monkey-patch for some weirdness where D::IP ends
81 # up thinking VegGuide::View::Mason has an inner package of
82 # VegGuide::View::Mason::SUPER. This only happens when the
83 # full Catalyst stack is also loaded.
d752bd7 @autarch perltidy all code
autarch authored
84 for my $cand ( grep { !/SUPER::$/ } grep /::$/, @stuff ) {
634795b make catalyst branch the new trunk
autarch authored
85 $cand =~ s!::$!!;
d752bd7 @autarch perltidy all code
autarch authored
86 my @children = list_packages( $pack . $cand );
634795b make catalyst branch the new trunk
autarch authored
87
d752bd7 @autarch perltidy all code
autarch authored
88 push @packs, "$pack$cand"
89 unless $cand =~ /^::/
90 || !__PACKAGE__->_loaded( $pack . $cand ); # or @children;
634795b make catalyst branch the new trunk
autarch authored
91 push @packs, @children;
92 }
d752bd7 @autarch perltidy all code
autarch authored
93 return grep { $_ !~ /::::ISA::CACHE/ } @packs;
634795b make catalyst branch the new trunk
autarch authored
94 }
95
96 }
97
98 1;
99
100 __END__
101
102 =head1 NAME
103
104 VegGuide - Catalyst based application
105
106 =head1 SYNOPSIS
107
108 script/vegguide_server.pl
109
110 =head1 DESCRIPTION
111
112 Catalyst based application.
113
114 =head1 METHODS
115
116 =head2 default
117
118 =head1 AUTHOR
119
120 Dave Rolsky,,,
121
122 =head1 LICENSE
123
124 This library is free software, you can redistribute it and/or modify
125 it under the same terms as Perl itself.
126
127 =cut
Something went wrong with that request. Please try again.