Commit | Line | Data |
68a748b9 |
1 | package Catalyst::Dispatcher; |
1abd6db7 |
2 | |
3 | use strict; |
fbcc39ad |
4 | use base 'Class::Accessor::Fast'; |
a2f2cde9 |
5 | use Catalyst::Exception; |
f05af9ba |
6 | use Catalyst::Utils; |
fbcc39ad |
7 | use Catalyst::Action; |
1abd6db7 |
8 | use Text::ASCIITable; |
1abd6db7 |
9 | use Tree::Simple; |
10 | use Tree::Simple::Visitor::FindByPath; |
11 | |
fbcc39ad |
12 | # Stringify to class |
13 | use overload '""' => sub { return ref shift }, fallback => 1; |
14 | |
15 | __PACKAGE__->mk_accessors(qw/actions tree/); |
1abd6db7 |
16 | |
1abd6db7 |
17 | =head1 NAME |
18 | |
9c053379 |
19 | Catalyst::Dispatcher - The Catalyst Dispatcher |
1abd6db7 |
20 | |
21 | =head1 SYNOPSIS |
22 | |
23 | See L<Catalyst>. |
24 | |
25 | =head1 DESCRIPTION |
26 | |
27 | =head1 METHODS |
28 | |
29 | =over 4 |
30 | |
fbcc39ad |
31 | =item $self->detach( $c, $command [, \@arguments ] ) |
6ef62eb2 |
32 | |
33 | =cut |
34 | |
35 | sub detach { |
fbcc39ad |
36 | my ( $self, $c, $command, @args ) = @_; |
bd7d2e94 |
37 | $c->forward( $command, @args ) if $command; |
fbcc39ad |
38 | die $Catalyst::DETACH; |
6ef62eb2 |
39 | } |
40 | |
fbcc39ad |
41 | =item $self->dispatch($c) |
1abd6db7 |
42 | |
43 | =cut |
44 | |
45 | sub dispatch { |
fbcc39ad |
46 | my ( $self, $c ) = @_; |
1abd6db7 |
47 | my $action = $c->req->action; |
48 | my $namespace = ''; |
49 | $namespace = ( join( '/', @{ $c->req->args } ) || '/' ) |
50 | if $action eq 'default'; |
99fe1710 |
51 | |
1abd6db7 |
52 | unless ($namespace) { |
53 | if ( my $result = $c->get_action($action) ) { |
fbcc39ad |
54 | $namespace = |
55 | Catalyst::Utils::class2prefix( $result->[0]->[0]->namespace, |
e494bd6b |
56 | $c->config->{case_sensitive} ); |
1abd6db7 |
57 | } |
58 | } |
99fe1710 |
59 | |
1abd6db7 |
60 | my $default = $action eq 'default' ? $namespace : undef; |
2d16b61a |
61 | my $results = $c->get_action( $action, $default, $default ? 1 : 0 ); |
1abd6db7 |
62 | $namespace ||= '/'; |
99fe1710 |
63 | |
1abd6db7 |
64 | if ( @{$results} ) { |
65 | |
fbcc39ad |
66 | # Errors break the normal flow and the end action is instantly run |
67 | my $error = 0; |
68 | |
1abd6db7 |
69 | # Execute last begin |
70 | $c->state(1); |
2d16b61a |
71 | if ( my $begin = @{ $c->get_action( 'begin', $namespace, 1 ) }[-1] ) { |
fbcc39ad |
72 | $begin->[0]->execute($c); |
73 | $error++ if scalar @{ $c->error }; |
1abd6db7 |
74 | } |
75 | |
76 | # Execute the auto chain |
1196a46d |
77 | my $autorun = 0; |
9ddd9d05 |
78 | for my $auto ( @{ $c->get_action( 'auto', $namespace, 1 ) } ) { |
fbcc39ad |
79 | last if $error; |
9ddd9d05 |
80 | $autorun++; |
fbcc39ad |
81 | $auto->[0]->execute($c); |
82 | $error++ if scalar @{ $c->error }; |
1abd6db7 |
83 | last unless $c->state; |
84 | } |
85 | |
86 | # Execute the action or last default |
e5f21aa2 |
87 | my $mkay = $autorun ? $c->state ? 1 : 0 : 1; |
61cfdd57 |
88 | if ( ( my $action = $c->req->action ) && $mkay ) { |
fbcc39ad |
89 | unless ($error) { |
90 | if ( my $result = |
91 | @{ $c->get_action( $action, $default, 1 ) }[-1] ) |
92 | { |
93 | $result->[0]->execute($c); |
94 | $error++ if scalar @{ $c->error }; |
95 | } |
1abd6db7 |
96 | } |
97 | } |
98 | |
99 | # Execute last end |
2d16b61a |
100 | if ( my $end = @{ $c->get_action( 'end', $namespace, 1 ) }[-1] ) { |
fbcc39ad |
101 | $end->[0]->execute($c); |
1abd6db7 |
102 | } |
fbcc39ad |
103 | } |
104 | |
105 | else { |
1abd6db7 |
106 | my $path = $c->req->path; |
107 | my $error = $path |
108 | ? qq/Unknown resource "$path"/ |
109 | : "No default action defined"; |
110 | $c->log->error($error) if $c->debug; |
111 | $c->error($error); |
112 | } |
113 | } |
114 | |
fbcc39ad |
115 | =item $self->forward( $c, $command [, \@arguments ] ) |
1abd6db7 |
116 | |
117 | =cut |
118 | |
119 | sub forward { |
fbcc39ad |
120 | my $self = shift; |
1abd6db7 |
121 | my $c = shift; |
122 | my $command = shift; |
99fe1710 |
123 | |
1abd6db7 |
124 | unless ($command) { |
125 | $c->log->debug('Nothing to forward to') if $c->debug; |
126 | return 0; |
127 | } |
99fe1710 |
128 | |
71c3bcc3 |
129 | # Relative forwards from detach |
fbcc39ad |
130 | my $caller = ( caller(1) )[0]->isa('Catalyst::Dispatcher') |
131 | && ( ( caller(2) )[3] =~ /::detach$/ ) ? caller(3) : caller(1); |
71c3bcc3 |
132 | |
e0fc6749 |
133 | my $arguments = ( ref( $_[-1] ) eq 'ARRAY' ) ? pop(@_) : $c->req->args; |
99fe1710 |
134 | |
fbcc39ad |
135 | my $results = []; |
136 | |
8199eac3 |
137 | my $command_copy = $command; |
138 | |
139 | unless ( $command_copy =~ s/^\/// ) { |
5d68b17b |
140 | my $namespace = |
141 | Catalyst::Utils::class2prefix( $caller, $c->config->{case_sensitive} ) || ''; |
142 | $command_copy = "${namespace}/${command}"; |
1abd6db7 |
143 | } |
99fe1710 |
144 | |
8199eac3 |
145 | unless ( $command_copy =~ /\// ) { |
146 | $results = $c->get_action( $command_copy, '/' ); |
147 | } |
e494bd6b |
148 | else { |
8199eac3 |
149 | my @extra_args; |
150 | DESCEND: while ( $command_copy =~ s/^(.*)\/(\w+)$/$1/ ) { |
151 | my $tail = $2; |
152 | $results = $c->get_action( $tail, $1 ); |
153 | if ( @{$results} ) { |
154 | $command = $tail; |
155 | push( @{$arguments}, @extra_args ); |
156 | last DESCEND; |
157 | } |
158 | unshift( @extra_args, $tail ); |
159 | } |
e494bd6b |
160 | } |
99fe1710 |
161 | |
1abd6db7 |
162 | unless ( @{$results} ) { |
bd7d2e94 |
163 | |
fbcc39ad |
164 | unless ( $c->components->{$command} ) { |
bd7d2e94 |
165 | my $error = |
166 | qq/Couldn't forward to command "$command". Invalid action or component./; |
3b2ed580 |
167 | $c->error($error); |
168 | $c->log->debug($error) if $c->debug; |
1abd6db7 |
169 | return 0; |
170 | } |
bd7d2e94 |
171 | |
1f6bb799 |
172 | my $class = $command; |
1abd6db7 |
173 | my $method = shift || 'process'; |
99fe1710 |
174 | |
1f6bb799 |
175 | if ( my $code = $c->components->{$class}->can($method) ) { |
fbcc39ad |
176 | my $action = Catalyst::Action->new( |
177 | { |
178 | code => $code, |
179 | reverse => "$class->$method", |
180 | namespace => $class, |
181 | } |
182 | ); |
183 | $results = [ [$action] ]; |
184 | } |
185 | |
186 | else { |
bd7d2e94 |
187 | my $error = |
188 | qq/Couldn't forward to "$class". Does not implement "$method"/; |
3b2ed580 |
189 | $c->error($error); |
190 | $c->log->debug($error) |
1abd6db7 |
191 | if $c->debug; |
192 | return 0; |
193 | } |
99fe1710 |
194 | |
1abd6db7 |
195 | } |
bd7d2e94 |
196 | |
197 | local $c->request->{arguments} = [ @{$arguments} ]; |
99fe1710 |
198 | |
1abd6db7 |
199 | for my $result ( @{$results} ) { |
fbcc39ad |
200 | $result->[0]->execute($c); |
e0fc6749 |
201 | return if scalar @{ $c->error }; |
1abd6db7 |
202 | last unless $c->state; |
203 | } |
99fe1710 |
204 | |
1abd6db7 |
205 | return $c->state; |
206 | } |
207 | |
fbcc39ad |
208 | =item $self->prepare_action($c) |
209 | |
210 | =cut |
211 | |
212 | sub prepare_action { |
213 | my ( $self, $c ) = @_; |
214 | my $path = $c->req->path; |
215 | my @path = split /\//, $c->req->path; |
216 | $c->req->args( \my @args ); |
217 | |
218 | while (@path) { |
219 | $path = join '/', @path; |
220 | if ( my $result = ${ $c->get_action($path) }[0] ) { |
221 | |
222 | # It's a regex |
223 | if ($#$result) { |
224 | my $match = $result->[1]; |
225 | my @snippets = @{ $result->[2] }; |
226 | $c->log->debug( |
227 | qq/Requested action is "$path" and matched "$match"/) |
228 | if $c->debug; |
229 | $c->log->debug( |
230 | 'Snippets are "' . join( ' ', @snippets ) . '"' ) |
231 | if ( $c->debug && @snippets ); |
232 | $c->req->action($match); |
233 | $c->req->snippets( \@snippets ); |
234 | } |
235 | |
236 | else { |
237 | $c->req->action($path); |
238 | $c->log->debug(qq/Requested action is "$path"/) if $c->debug; |
239 | } |
1abd6db7 |
240 | |
fbcc39ad |
241 | $c->req->match($path); |
242 | last; |
243 | } |
244 | unshift @args, pop @path; |
245 | } |
246 | |
247 | unless ( $c->req->action ) { |
248 | $c->req->action('default'); |
249 | $c->req->match(''); |
250 | } |
251 | |
252 | $c->log->debug( 'Arguments are "' . join( '/', @args ) . '"' ) |
253 | if ( $c->debug && @args ); |
254 | } |
255 | |
256 | =item $self->get_action( $c, $action, $namespace, $inherit ) |
1abd6db7 |
257 | |
258 | =cut |
259 | |
260 | sub get_action { |
fbcc39ad |
261 | my ( $self, $c, $action, $namespace, $inherit ) = @_; |
1abd6db7 |
262 | return [] unless $action; |
263 | $namespace ||= ''; |
2d16b61a |
264 | $inherit ||= 0; |
99fe1710 |
265 | |
1abd6db7 |
266 | if ($namespace) { |
c8d9780f |
267 | |
fbcc39ad |
268 | my $parent = $self->tree; |
c8d9780f |
269 | my @match; |
99fe1710 |
270 | |
c8d9780f |
271 | if ($namespace ne '/') { |
99fe1710 |
272 | |
c8d9780f |
273 | my $visitor = Tree::Simple::Visitor::FindByPath->new; |
274 | my @path = split('/', $namespace); |
d1b0d31d |
275 | $visitor->setSearchPath( @path ); |
276 | $parent->accept($visitor); |
277 | |
c8d9780f |
278 | if ($inherit) { |
d1b0d31d |
279 | |
c8d9780f |
280 | @match = $visitor->getResults; |
281 | @match = ($parent) unless @match; |
d1b0d31d |
282 | |
c8d9780f |
283 | if (!defined $visitor->getResult) { |
284 | my $extra = $path[(scalar @match) - 1]; |
285 | last unless $extra; |
286 | $visitor->setSearchPath($extra); |
287 | $match[-1]->accept($visitor); |
288 | push(@match, $visitor->getResult) if defined $visitor->getResult; |
289 | } |
290 | } else { |
291 | @match = ($visitor->getResult) if $visitor->getResult; |
d1b0d31d |
292 | } |
293 | |
1abd6db7 |
294 | } |
99fe1710 |
295 | |
c8d9780f |
296 | @match = ($parent) unless @match; |
99fe1710 |
297 | |
c8d9780f |
298 | my @results; |
99fe1710 |
299 | |
c8d9780f |
300 | foreach my $child (@match) { |
301 | my $node = $self->actions->{private}->{$child->getUID}; |
302 | next unless $node; |
303 | push(@results, [ $node->{$action} ]) if defined $node->{$action}; |
1abd6db7 |
304 | } |
305 | return \@results; |
306 | } |
99fe1710 |
307 | |
fbcc39ad |
308 | elsif ( my $p = $self->actions->{plain}->{$action} ) { return [ [$p] ] } |
309 | elsif ( my $r = $self->actions->{regex}->{$action} ) { return [ [$r] ] } |
99fe1710 |
310 | |
1abd6db7 |
311 | else { |
99fe1710 |
312 | |
fbcc39ad |
313 | for my $i ( 0 .. $#{ $self->actions->{compiled} } ) { |
314 | my $name = $self->actions->{compiled}->[$i]->[0]; |
315 | my $regex = $self->actions->{compiled}->[$i]->[1]; |
99fe1710 |
316 | |
2d752b2a |
317 | if ( my @snippets = ( $action =~ $regex ) ) { |
fbcc39ad |
318 | return [ |
319 | [ $self->actions->{regex}->{$name}, $name, \@snippets ] ]; |
1abd6db7 |
320 | } |
99fe1710 |
321 | |
1abd6db7 |
322 | } |
323 | } |
324 | return []; |
325 | } |
326 | |
fbcc39ad |
327 | =item $self->set_action( $c, $action, $code, $namespace, $attrs ) |
1abd6db7 |
328 | |
329 | =cut |
330 | |
331 | sub set_action { |
fbcc39ad |
332 | my ( $self, $c, $method, $code, $namespace, $attrs ) = @_; |
1abd6db7 |
333 | |
e494bd6b |
334 | my $prefix = |
335 | Catalyst::Utils::class2prefix( $namespace, $c->config->{case_sensitive} ) |
336 | || ''; |
1abd6db7 |
337 | my %flags; |
338 | |
339 | for my $attr ( @{$attrs} ) { |
0299ba22 |
340 | if ( $attr =~ /^(Local|Relative)$/ ) { $flags{local}++ } |
341 | elsif ( $attr =~ /^(Global|Absolute)$/ ) { $flags{global}++ } |
749472d6 |
342 | elsif ( $attr =~ /^Path\(\s*(.+)\s*\)$/i ) { |
343 | push @{ $flags{path} }, $1; |
344 | } |
345 | elsif ( $attr =~ /^Private$/i ) { $flags{private}++ } |
0299ba22 |
346 | elsif ( $attr =~ /^(Regex|Regexp)\(\s*(.+)\s*\)$/i ) { |
749472d6 |
347 | push @{ $flags{regex} }, $2; |
0299ba22 |
348 | } |
1abd6db7 |
349 | } |
350 | |
d0e524d2 |
351 | if ( $flags{private} && ( keys %flags > 1 ) ) { |
8d4e224b |
352 | $c->log->debug( 'Bad action definition "' |
d0e524d2 |
353 | . join( ' ', @{$attrs} ) |
8d4e224b |
354 | . qq/" for "$namespace->$method"/ ) |
355 | if $c->debug; |
d0e524d2 |
356 | return; |
357 | } |
1abd6db7 |
358 | return unless keys %flags; |
359 | |
fbcc39ad |
360 | my $parent = $self->tree; |
1abd6db7 |
361 | my $visitor = Tree::Simple::Visitor::FindByPath->new; |
99fe1710 |
362 | |
1abd6db7 |
363 | for my $part ( split '/', $prefix ) { |
364 | $visitor->setSearchPath($part); |
365 | $parent->accept($visitor); |
366 | my $child = $visitor->getResult; |
99fe1710 |
367 | |
1abd6db7 |
368 | unless ($child) { |
369 | $child = $parent->addChild( Tree::Simple->new($part) ); |
370 | $visitor->setSearchPath($part); |
371 | $parent->accept($visitor); |
372 | $child = $visitor->getResult; |
373 | } |
99fe1710 |
374 | |
1abd6db7 |
375 | $parent = $child; |
376 | } |
99fe1710 |
377 | |
fbcc39ad |
378 | my $reverse = $prefix ? "$prefix/$method" : $method; |
379 | |
380 | my $action = Catalyst::Action->new( |
381 | { |
382 | code => $code, |
383 | reverse => $reverse, |
384 | namespace => $namespace, |
385 | } |
386 | ); |
387 | |
388 | my $uid = $parent->getUID; |
389 | $self->actions->{private}->{$uid}->{$method} = $action; |
390 | |
749472d6 |
391 | my @path; |
392 | for my $path ( @{ $flags{path} } ) { |
393 | $path =~ s/^\w+//; |
394 | $path =~ s/\w+$//; |
395 | if ( $path =~ /^\s*'(.*)'\s*$/ ) { $path = $1 } |
396 | if ( $path =~ /^\s*"(.*)"\s*$/ ) { $path = $1 } |
397 | push @path, $path; |
1abd6db7 |
398 | } |
749472d6 |
399 | $flags{path} = \@path; |
400 | |
401 | my @regex; |
402 | for my $regex ( @{ $flags{regex} } ) { |
403 | $regex =~ s/^\w+//; |
404 | $regex =~ s/\w+$//; |
405 | if ( $regex =~ /^\s*'(.*)'\s*$/ ) { $regex = $1 } |
406 | if ( $regex =~ /^\s*"(.*)"\s*$/ ) { $regex = $1 } |
407 | push @regex, $regex; |
1abd6db7 |
408 | } |
749472d6 |
409 | $flags{regex} = \@regex; |
1abd6db7 |
410 | |
749472d6 |
411 | if ( $flags{local} || $flags{global} ) { |
412 | push( @{ $flags{path} }, $prefix ? "/$prefix/$method" : "/$method" ) |
413 | if $flags{local}; |
99fe1710 |
414 | |
749472d6 |
415 | push( @{ $flags{path} }, "/$method" ) if $flags{global}; |
416 | } |
99fe1710 |
417 | |
749472d6 |
418 | for my $path ( @{ $flags{path} } ) { |
419 | if ( $path =~ /^\// ) { $path =~ s/^\/// } |
420 | else { $path = $prefix ? "$prefix/$path" : $path } |
421 | $self->actions->{plain}->{$path} = $action; |
1abd6db7 |
422 | } |
99fe1710 |
423 | |
749472d6 |
424 | for my $regex ( @{ $flags{regex} } ) { |
fbcc39ad |
425 | push @{ $self->actions->{compiled} }, [ $regex, qr#$regex# ]; |
426 | $self->actions->{regex}->{$regex} = $action; |
1abd6db7 |
427 | } |
1abd6db7 |
428 | } |
429 | |
fbcc39ad |
430 | =item $self->setup_actions( $class, $component ) |
1abd6db7 |
431 | |
432 | =cut |
433 | |
434 | sub setup_actions { |
fbcc39ad |
435 | my ( $self, $class ) = @_; |
99fe1710 |
436 | |
12e28165 |
437 | # These are the core structures |
438 | $self->actions( |
439 | { |
440 | plain => {}, |
441 | private => {}, |
442 | regex => {}, |
fbcc39ad |
443 | compiled => [] |
12e28165 |
444 | } |
445 | ); |
446 | |
447 | # We use a tree |
448 | $self->tree( Tree::Simple->new( 0, Tree::Simple->ROOT ) ); |
e494bd6b |
449 | |
fbcc39ad |
450 | for my $comp ( keys %{ $class->components } ) { |
e494bd6b |
451 | |
452 | # We only setup components that inherit from Catalyst::Base |
a268a011 |
453 | next unless $comp->isa('Catalyst::Base'); |
99fe1710 |
454 | |
812a28c9 |
455 | for my $action ( @{ Catalyst::Utils::reflect_actions($comp) } ) { |
1abd6db7 |
456 | my ( $code, $attrs ) = @{$action}; |
457 | my $name = ''; |
458 | no strict 'refs'; |
459 | my @cache = ( $comp, @{"$comp\::ISA"} ); |
460 | my %namespaces; |
99fe1710 |
461 | |
1abd6db7 |
462 | while ( my $namespace = shift @cache ) { |
463 | $namespaces{$namespace}++; |
464 | for my $isa ( @{"$comp\::ISA"} ) { |
465 | next if $namespaces{$isa}; |
466 | push @cache, $isa; |
467 | $namespaces{$isa}++; |
468 | } |
469 | } |
99fe1710 |
470 | |
1abd6db7 |
471 | for my $namespace ( keys %namespaces ) { |
99fe1710 |
472 | |
1abd6db7 |
473 | for my $sym ( values %{ $namespace . '::' } ) { |
99fe1710 |
474 | |
1abd6db7 |
475 | if ( *{$sym}{CODE} && *{$sym}{CODE} == $code ) { |
99fe1710 |
476 | |
1abd6db7 |
477 | $name = *{$sym}{NAME}; |
fbcc39ad |
478 | $class->set_action( $name, $code, $comp, $attrs ); |
1abd6db7 |
479 | last; |
480 | } |
99fe1710 |
481 | |
1abd6db7 |
482 | } |
99fe1710 |
483 | |
1abd6db7 |
484 | } |
99fe1710 |
485 | |
1abd6db7 |
486 | } |
99fe1710 |
487 | |
1abd6db7 |
488 | } |
e494bd6b |
489 | |
fbcc39ad |
490 | return unless $class->debug; |
99fe1710 |
491 | |
1abd6db7 |
492 | my $actions = $self->actions; |
493 | my $privates = Text::ASCIITable->new; |
5fbed090 |
494 | $privates->setCols( 'Private', 'Class' ); |
495 | $privates->setColWidth( 'Private', 36, 1 ); |
496 | $privates->setColWidth( 'Class', 37, 1 ); |
99fe1710 |
497 | |
1abd6db7 |
498 | my $walker = sub { |
499 | my ( $walker, $parent, $prefix ) = @_; |
500 | $prefix .= $parent->getNodeValue || ''; |
501 | $prefix .= '/' unless $prefix =~ /\/$/; |
502 | my $uid = $parent->getUID; |
99fe1710 |
503 | |
1abd6db7 |
504 | for my $action ( keys %{ $actions->{private}->{$uid} } ) { |
fbcc39ad |
505 | my $action_obj = $actions->{private}->{$uid}->{$action}; |
506 | $privates->addRow( "$prefix$action", $action_obj->namespace ); |
1abd6db7 |
507 | } |
99fe1710 |
508 | |
1abd6db7 |
509 | $walker->( $walker, $_, $prefix ) for $parent->getAllChildren; |
510 | }; |
99fe1710 |
511 | |
1abd6db7 |
512 | $walker->( $walker, $self->tree, '' ); |
fbcc39ad |
513 | $class->log->debug( "Loaded private actions:\n" . $privates->draw ) |
a268a011 |
514 | if ( @{ $privates->{tbl_rows} } ); |
99fe1710 |
515 | |
1abd6db7 |
516 | my $publics = Text::ASCIITable->new; |
517 | $publics->setCols( 'Public', 'Private' ); |
699e1247 |
518 | $publics->setColWidth( 'Public', 36, 1 ); |
519 | $publics->setColWidth( 'Private', 37, 1 ); |
99fe1710 |
520 | |
1abd6db7 |
521 | for my $plain ( sort keys %{ $actions->{plain} } ) { |
fbcc39ad |
522 | my $action = $actions->{plain}->{$plain}; |
523 | $publics->addRow( "/$plain", "/$action" ); |
1abd6db7 |
524 | } |
99fe1710 |
525 | |
fbcc39ad |
526 | $class->log->debug( "Loaded public actions:\n" . $publics->draw ) |
a268a011 |
527 | if ( @{ $publics->{tbl_rows} } ); |
99fe1710 |
528 | |
1abd6db7 |
529 | my $regexes = Text::ASCIITable->new; |
530 | $regexes->setCols( 'Regex', 'Private' ); |
699e1247 |
531 | $regexes->setColWidth( 'Regex', 36, 1 ); |
532 | $regexes->setColWidth( 'Private', 37, 1 ); |
99fe1710 |
533 | |
1abd6db7 |
534 | for my $regex ( sort keys %{ $actions->{regex} } ) { |
fbcc39ad |
535 | my $action = $actions->{regex}->{$regex}; |
536 | $regexes->addRow( $regex, "/$action" ); |
1abd6db7 |
537 | } |
99fe1710 |
538 | |
fbcc39ad |
539 | $class->log->debug( "Loaded regex actions:\n" . $regexes->draw ) |
a268a011 |
540 | if ( @{ $regexes->{tbl_rows} } ); |
1abd6db7 |
541 | } |
542 | |
1abd6db7 |
543 | =back |
544 | |
545 | =head1 AUTHOR |
546 | |
547 | Sebastian Riedel, C<sri@cpan.org> |
548 | |
549 | =head1 COPYRIGHT |
550 | |
551 | This program is free software, you can redistribute it and/or modify it under |
552 | the same terms as Perl itself. |
553 | |
554 | =cut |
555 | |
556 | 1; |