| 1 | package MVC::Neaf::Route::PreRoute; | ||||||||||
| 2 | |||||||||||
| 3 | 94 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 94 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 94 | our $VERSION = '0.2901'; | |||||||||
| 6 | |||||||||||
| 7 | =head1 NAME | ||||||||||
| 8 | |||||||||||
| 9 | MVC::Neaf::Route::PreRoute - temporary route stub for Not Even A Framework | ||||||||||
| 10 | |||||||||||
| 11 | =head1 DESCRIPTION | ||||||||||
| 12 | |||||||||||
| 13 | This is utility class. | ||||||||||
| 14 | Nothing to see here unless one intends to work on L<MVC::Neaf> itself. | ||||||||||
| 15 | |||||||||||
| 16 | It will show up in C<$req-E<gt>route> while a specific route | ||||||||||
| 17 | has not yet been selected. | ||||||||||
| 18 | |||||||||||
| 19 | It can still contain hooks & helpers, that's what it's for. | ||||||||||
| 20 | |||||||||||
| 21 | =head1 METHODS | ||||||||||
| 22 | |||||||||||
| 23 | =cut | ||||||||||
| 24 | |||||||||||
| 25 | 94 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | |||||||||||
| 27 | 94 | ▶ | use parent qw(MVC::Neaf::Route); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 28 | |||||||||||
| 29 | =head2 new | ||||||||||
| 30 | |||||||||||
| 31 | 'method' parameter is required. | ||||||||||
| 32 | |||||||||||
| 33 | =cut | ||||||||||
| 34 | |||||||||||
| 35 | 1 | ▶ | my $nobody_home = sub { die 404 }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 36 | 83 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 37 | 83 | my $class = shift; | |||||||||
| 38 | |||||||||||
| 39 | # Not using SUPER::new because MVC::Neaf::Route requires a parent | ||||||||||
| 40 | 83 | my $self = bless { | |||||||||
| 41 | where => '[in pre_route]', | ||||||||||
| 42 | path => '/', | ||||||||||
| 43 | code => $nobody_home, | ||||||||||
| 44 | default => {}, | ||||||||||
| 45 | hooks => {}, | ||||||||||
| 46 | helpers => {}, | ||||||||||
| 47 | @_ | ||||||||||
| 48 | }, $class; | ||||||||||
| 49 | |||||||||||
| 50 | $self->post_setup() | ||||||||||
| 51 | 83 | ▶ | if $self->{parent}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | |||||||||||
| 53 | # Probably a bad idea. How to visually separate missing path in logs? | ||||||||||
| 54 | 83 | $self->{path} = '[pre_route]'; | |||||||||
| 55 | 83 | $self; | |||||||||
| 56 | }; | ||||||||||
| 57 | |||||||||||
| 58 | |||||||||||
| 59 | =head2 RUNTIME STUB METHODS | ||||||||||
| 60 | |||||||||||
| 61 | =over | ||||||||||
| 62 | |||||||||||
| 63 | =item * method = Actual method; | ||||||||||
| 64 | |||||||||||
| 65 | =item * path = C<'[pre_route]'> | ||||||||||
| 66 | |||||||||||
| 67 | May change to C</> in the future. | ||||||||||
| 68 | |||||||||||
| 69 | =item * code = C<die 404;> | ||||||||||
| 70 | |||||||||||
| 71 | =item * where = C<'[pre_route]'> | ||||||||||
| 72 | |||||||||||
| 73 | =back | ||||||||||
| 74 | |||||||||||
| 75 | Do not rely on these values. | ||||||||||
| 76 | |||||||||||
| 77 | =cut | ||||||||||
| 78 | |||||||||||
| 79 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 80 | |||||||||||
| 81 | This module is part of L<MVC::Neaf> suite. | ||||||||||
| 82 | |||||||||||
| 83 | Copyright 2016-2023 Konstantin S. Uvarin C<khedin@cpan.org>. | ||||||||||
| 84 | |||||||||||
| 85 | This program is free software; you can redistribute it and/or modify it | ||||||||||
| 86 | under the terms of either: the GNU General Public License as published | ||||||||||
| 87 | by the Free Software Foundation; or the Artistic License. | ||||||||||
| 88 | |||||||||||
| 89 | See L<http://dev.perl.org/licenses/> for more information. | ||||||||||
| 90 | |||||||||||
| 91 | =cut | ||||||||||
| 92 | |||||||||||
| 93 | 94 | 1; | |||||||||