Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed list of hidden attributes and methods to include routes
  • Loading branch information
kraih committed Mar 21, 2012
1 parent 1cac434 commit 03e0c4f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -3,6 +3,7 @@ This file documents the revision history for Perl extension Mojolicious.
2.65 2012-03-21 00:00:00
- Improved documentation.
- Improved tests.
- Fixed list of hidden attributes and methods to include routes.

2.64 2012-03-21 00:00:00
- Deprecated Mojolicious::Routes->controller_base_class in favor of
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious.pm
Expand Up @@ -69,11 +69,11 @@ sub new {
my $r = $self->routes;
$r->namespace(ref $self);

# Hide own controller methods
# Hide controller attributes/methods, "handler" and "routes"
$r->hide(qw/AUTOLOAD DESTROY app cookie finish flash handler on on_finish/);
$r->hide(qw/param redirect_to render render_content render_data/);
$r->hide(qw/render_exception render_json render_not_found render_partial/);
$r->hide(qw/render_static render_text rendered req res respond_to/);
$r->hide(qw/render_static render_text rendered req res respond_to routes/);
$r->hide(qw/send session signed_cookie stash tx ua url_for write/);
$r->hide('write_chunk');

Expand Down
8 changes: 4 additions & 4 deletions lib/Mojolicious/Routes.pm
Expand Up @@ -11,7 +11,7 @@ use Scalar::Util 'weaken';
has base_classes => sub { [qw/Mojolicious::Controller Mojo/] };
has cache => sub { Mojo::Cache->new };
has [qw/conditions shortcuts/] => sub { {} };
has hidden => sub { [qw/new attr has/] };
has hidden => sub { [qw/attr has new/] };
has 'namespace';

sub add_condition {
Expand Down Expand Up @@ -181,7 +181,7 @@ sub _generate_method {
my ($self, $field, $c) = @_;

# Prepare hidden
unless ($self->{hiding}) { $self->{hiding}->{$_}++ for @{$self->hidden} }
$self->{hiding} = {map { $_ => 1 } @{$self->hidden}} unless $self->{hiding};

# DEPRECATED in Leaf Fluttering In Wind!
warn "The method stash value is DEPRECATED in favor of action!\n"
Expand Down Expand Up @@ -331,10 +331,10 @@ Contains all available conditions.
=head2 C<hidden>
my $hidden = $r->hidden;
$r = $r->hidden([qw/new attr tx render req res stash/]);
$r = $r->hidden([qw/attr has new/]);
Controller methods and attributes that are hidden from routes, defaults to
C<new>, C<attr> and C<has>.
C<attr>, C<has> and C<new>.
=head2 C<namespace>
Expand Down

0 comments on commit 03e0c4f

Please sign in to comment.