line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenFrame::AppKit::Segment::DispatchOnURI; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1416
|
use Pipeline::Segment; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use base qw ( Pipeline::Segment ); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub uri { |
9
|
|
|
|
|
|
|
my $self = shift; |
10
|
|
|
|
|
|
|
my $uri = shift; |
11
|
|
|
|
|
|
|
if (defined($uri)) { |
12
|
|
|
|
|
|
|
$self->{_uri} = $uri; |
13
|
|
|
|
|
|
|
return $self; |
14
|
|
|
|
|
|
|
} else { |
15
|
|
|
|
|
|
|
return $self->{_uri}; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub dispatch_on_uri { |
20
|
|
|
|
|
|
|
my $self = shift; |
21
|
|
|
|
|
|
|
my $pipe = shift; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub match_uri { |
25
|
|
|
|
|
|
|
my $self = shift; |
26
|
|
|
|
|
|
|
my $uri = shift; |
27
|
|
|
|
|
|
|
my $siteUri = $self->uri(); |
28
|
|
|
|
|
|
|
$uri->path() =~ /^$siteUri/; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub dispatch { |
32
|
|
|
|
|
|
|
my $self = shift; |
33
|
|
|
|
|
|
|
my $pipe = shift; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $store = $pipe->store(); |
36
|
|
|
|
|
|
|
my $req = $store->get('OpenFrame::Request'); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
if ( $self->match_uri( $req->uri() ) ) { |
39
|
|
|
|
|
|
|
return ($self->dispatch_on_uri( $pipe )); |
40
|
|
|
|
|
|
|
} else { |
41
|
|
|
|
|
|
|
return undef; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 NAME |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
OpenFrame::AppKit::Segment::DispatchOnURI - pipeline segments that dispatch only on certain uris |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 SYNOPSIS |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
package MyPipeSegment; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
use OpenFrame::AppKit::Segment::DispatchOnURI; |
56
|
|
|
|
|
|
|
use base qw( OpenFrame::AppKit::Segment::DispatchOnURI ); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub uri { |
59
|
|
|
|
|
|
|
return qr!/some/uri/here.html! |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub dispatch_on_uri { |
63
|
|
|
|
|
|
|
my $self = shift; |
64
|
|
|
|
|
|
|
my $pipe = shift; |
65
|
|
|
|
|
|
|
# ... |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 DESCRIPTION |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
C is a base class for all pipeline segments that want to dispatch |
73
|
|
|
|
|
|
|
only at a certain uri. To subclass it you can simply define the dispatch_on_uri method in your package and |
74
|
|
|
|
|
|
|
call the uri() method, which by default is a get/set for the regular expression that will match the path of |
75
|
|
|
|
|
|
|
your uri. If you wish to set a hard value you can override the uri() method to return a regular expression. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 AUTHOR |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
James A. Duncan |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 COPYRIGHT |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Copyright 2002 Fotango Ltd. All Rights Reserved |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This code is released under the GNU GPL and Artistic licenses. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|