| 1 | package Plack::Middleware::Statsd; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # ABSTRACT: send statistics to statsd | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | # RECOMMEND PREREQ: Net::Statsd::Tiny v0.3.0 | ||||||||||||||||||||||||||||
| 6 | # RECOMMEND PREREQ: HTTP::Status 6.16 | ||||||||||||||||||||||||||||
| 7 | # RECOMMEND PREREQ: List::Util::XS | ||||||||||||||||||||||||||||
| 8 | # RECOMMEND PREREQ: Ref::Util::XS | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 5 | ▶ | use v5.20; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 5 | ▶ | use parent qw/ Plack::Middleware /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 5 | ▶ | use Digest::SHA 5.96 qw/ hmac_sha256_base64 /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 5 | ▶ | use List::Util qw/ first /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 5 | ▶ | use Plack::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | use Plack::Util::Accessor | ||||||||||||||||||||||||||||
| 19 | 5 | ▶ | qw/ client sample_rate histogram increment set_add secure_set_add secure_set_key catch_errors /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 5 | ▶ | use Ref::Util qw/ is_coderef /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 5 | ▶ | use Scalar::Util qw/ weaken /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 5 | ▶ | use Time::HiRes; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 23 | 5 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 5 | ▶ | use experimental qw/ postderef signatures /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 5 | our $VERSION = 'v0.9.3'; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | # Note: You may be able to omit the client if there is a client | ||||||||||||||||||||||||||||
| 30 | # defined in the environment hash at C<psgix.monitor.statsd>, and the | ||||||||||||||||||||||||||||
| 31 | # L</histogram>, L</increment> and L</attributes> are set. But that | ||||||||||||||||||||||||||||
| 32 | # is a strange case and unsupported. | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 5 | ▶ | sub prepare_app($self) { | ||||||||||||||||||||||||||
|
Subroutine
prepare_app: called CC=11 SCAR=24.2
Pod
documented
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 5 | ▶ | if ( my $client = $self->client ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 5 | foreach my $init ( | |||||||||||||||||||||||||||
| 38 | [qw/ histogram timing_ms timing /], | ||||||||||||||||||||||||||||
| 39 | [qw/ increment increment /], | ||||||||||||||||||||||||||||
| 40 | [qw/ set_add set_add /], | ||||||||||||||||||||||||||||
| 41 | [qw/ secure_set_add secure_set_add /], | ||||||||||||||||||||||||||||
| 42 | ) | ||||||||||||||||||||||||||||
| 43 | { | ||||||||||||||||||||||||||||
| 44 | 20 | my ( $attr, @methods ) = $init->@*; | |||||||||||||||||||||||||||
| 45 | 20 | ▶ | next if defined $self->$attr; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 19 | ▶ | my $method = first { $client->can($_) } @methods; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 47 | 19 | ▶ | warn "No $attr method found for client " . ref($client) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $method or $attr eq "secure_set_add"
MC/DC100%2/2
defined $method or $attr eq "secure_set_add"
defined $method
$attr eq "secure_set_add"
Truth table100%3/3
A or B
A= defined $methodB= $attr eq "secure_set_add"
| |||||||||||||||||||||||||||||
| 48 | unless defined $method || $attr eq "secure_set_add"; | ||||||||||||||||||||||||||||
| 49 | $self->$attr( | ||||||||||||||||||||||||||||
| 50 | 58 | ▶ | sub($env, @args) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 51 | 58 | ▶ | return unless defined $method; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 56 | ▶ | try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 53 | 56 | $client->$method( grep { defined $_ } @args ); | |||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | 2 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||
| 56 | 2 | my ($e) = $_; | |||||||||||||||||||||||||||
| 57 | 2 | ▶ | if (my $logger = $env->{'psgix.logger'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | 2 | $logger->( { message => $e, level => 'error' } ); | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | else { | ||||||||||||||||||||||||||||
| 61 | 0 | $env->{'psgi.errors'}->print($e); | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | 56 | }; | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | 19 | ); | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 5 | ▶ | unless ( $client->can("secure_set_add") ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 70 | 5 | ▶ | if ( my $key = $self->secure_set_key ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | $self->secure_set_add( | ||||||||||||||||||||||||||||
| 72 | 6 | ▶ | sub( $env, $metric, $string ) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 73 | 6 | my $obscure = hmac_sha256_base64( $string, $key ); | |||||||||||||||||||||||||||
| 74 | 6 | $self->set_add->( $env, $metric, $obscure ); | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | 1 | ); | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 5 | ▶ | if (my $attr = first { !is_coderef($self->$_) } qw/ histogram increment set_add /) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | 1 | die "$attr is not a coderef"; | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 4 | ▶ | if ( my $catch = $self->catch_errors ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 1 | ▶ | unless ( is_coderef($catch) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | $self->catch_errors( | ||||||||||||||||||||||||||||
| 91 | 1 | ▶ | sub( $env, $error ) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||
| 92 | 1 | ▶ | if ( my $logger = $env->{'psgix.logger'} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | 1 | $logger->( { level => 'error', message => $error } ); | |||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | else { | ||||||||||||||||||||||||||||
| 96 | 0 | $env->{'psgi.errors'}->print($error); | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | 1 | my $message = 'Internal Error'; | |||||||||||||||||||||||||||
| 99 | 1 | return [ 500, [ 'Content-Type' => 'text/plain', 'Content-Length' => length($message) ], [$message] ]; | |||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | 1 | ); | |||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 7 | ▶ | sub call ( $self, $env ) { | ||||||||||||||||||||||||||
|
Subroutine
call: called CC=4 SCAR=14.5
Pod
documented
| |||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 7 | ▶ | my $client = ( $env->{'psgix.monitor.statsd'} //= $self->client ); | ||||||||||||||||||||||||||
|
Condition33%1/3
$env->{"psgix.monitor.statsd"} //= $self->client
MC/DC0%0/2
$env->{"psgix.monitor.statsd"} //= $self->client
$env->{"psgix.monitor.statsd"}
$self->client
Truth table33%1/3
A //= B
A= $env->{"psgix.monitor.statsd"}B= $self->client
| |||||||||||||||||||||||||||||
| 111 | 7 | my $secure = $self->secure_set_add; | |||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 7 | ▶ | if ( defined $secure ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 114 | 7 | weaken( my $ref = $env ); | |||||||||||||||||||||||||||
| 115 | 7 | ▶ | $env->{'psgix.monitor.statsd_secure_set_add'} = sub { $secure->( $ref, @_ ) }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 7 | my $start = [Time::HiRes::gettimeofday]; | |||||||||||||||||||||||||||
| 120 | 7 | my $res; | |||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 7 | ▶ | if (my $catch = $self->catch_errors) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 123 | 1 | ▶ | try { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 124 | 1 | $res = $self->app->($env); | |||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||
| 126 | 1 | ▶ | catch { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 127 | 1 | $res = $catch->( $env, $_ ); | |||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | 1 | } | |||||||||||||||||||||||||||
| 130 | else { | ||||||||||||||||||||||||||||
| 131 | 6 | $res = $self->app->($env); | |||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | return Plack::Util::response_cb( | ||||||||||||||||||||||||||||
| 135 | $res, | ||||||||||||||||||||||||||||
| 136 | 7 | ▶ | sub($res) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=19 SCAR=33.1
| |||||||||||||||||||||||||||||
| 137 | 7 | ▶ | return unless $client; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 7 | my $rate = $self->sample_rate; | |||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 7 | ▶ | $rate = undef if ( defined $rate ) && ( $rate >= 1 ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $rate and $rate >= 1
MC/DC0%0/2
defined $rate and $rate >= 1
defined $rate
$rate >= 1
Truth table33%1/3
A and B
A= defined $rateB= $rate >= 1
| |||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 7 | my $histogram = $self->histogram; | |||||||||||||||||||||||||||
| 144 | 7 | my $increment = $self->increment; | |||||||||||||||||||||||||||
| 145 | 7 | my $set_add = $self->set_add; | |||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 7 | my $elapsed = Time::HiRes::tv_interval($start); | |||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 7 | $histogram->( $env, 'psgi.response.time', $elapsed * 1000, $rate ); | |||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 7 | ▶ | if ( defined $env->{CONTENT_LENGTH} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 152 | $histogram->( $env, | ||||||||||||||||||||||||||||
| 153 | 'psgi.request.content-length', | ||||||||||||||||||||||||||||
| 154 | 7 | $env->{CONTENT_LENGTH}, $rate | |||||||||||||||||||||||||||
| 155 | ); | ||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 7 | ▶ | if ( my $method = $env->{REQUEST_METHOD} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 159 | 7 | ▶ | $method = "other" unless $method =~ /^\w+$/a; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 160 | 7 | $increment->( $env, 'psgi.request.method.' . $method, $rate ); | |||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 7 | ▶ | if ( my $type = _mime_type_to_metric( $env->{CONTENT_TYPE} ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 164 | 1 | $increment->( $env, 'psgi.request.content-type.' . $type, $rate ); | |||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | $secure->( $env, 'psgi.request.remote_addr', $env->{REMOTE_ADDR} ) | ||||||||||||||||||||||||||||
| 168 | 7 | ▶ | if defined($secure) && $env->{REMOTE_ADDR}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $secure and $env->{"REMOTE_ADDR"}
MC/DC0%0/2
defined $secure and $env->{"REMOTE_ADDR"}
defined $secure
$env->{"REMOTE_ADDR"}
Truth table33%1/3
A and B
A= defined $secureB= $env->{"REMOTE_ADDR"}
| |||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | 7 | $set_add->( $env, 'psgi.worker.pid', $$ ); | |||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 7 | my $h = Plack::Util::headers( $res->[1] ); | |||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | my $xsendfile = | ||||||||||||||||||||||||||||
| 175 | $env->{'plack.xsendfile.type'} | ||||||||||||||||||||||||||||
| 176 | || $ENV{HTTP_X_SENDFILE_TYPE} | ||||||||||||||||||||||||||||
| 177 | 7 | ▶ | || 'X-Sendfile'; | ||||||||||||||||||||||||||
|
Condition40%2/5
$env->{'plack.xsendfile.type'} || $ENV{'HTTP_X_SENDFILE_TYPE'} || 'X-Sendfile'
$env->{"plack.xsendfile.type"} or $ENV{"HTTP_X_SENDFILE_TYPE"}
MC/DC0%0/2
$env->{'plack.xsendfile.type'} || $ENV{'HTTP_X_SENDFILE_TYPE'} || 'X-Sendfile'
$env->{"plack.xsendfile.type"}
$ENV{"HTTP_X_SENDFILE_TYPE"}
Truth table33%1/3
A or B
A= $env->{"plack.xsendfile.type"}B= $ENV{"HTTP_X_SENDFILE_TYPE"}
| |||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 7 | ▶ | if ( $h->exists($xsendfile) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 180 | 0 | $increment->( $env, 'psgi.response.x-sendfile', $rate ); | |||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 7 | ▶ | if ( $h->exists('Content-Length') ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 184 | 7 | ▶ | my $length = $h->get('Content-Length') || 0; | ||||||||||||||||||||||||||
|
Condition100%2/2
$h->get('Content-Length') || 0
MC/DC100%1/1
$h->get('Content-Length') || 0
$h->get('Content-Length')
Truth table100%2/2
A
A= $h->get('Content-Length')
| |||||||||||||||||||||||||||||
| 185 | 7 | $histogram->( $env, 'psgi.response.content-length', $length, $rate ); | |||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 7 | ▶ | if ( my $type = _mime_type_to_metric( $h->get('Content-Type') ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 189 | 7 | $increment->( $env, 'psgi.response.content-type.' . $type, $rate ); | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 7 | $increment->( $env, 'psgi.response.status.' . $res->[0], $rate ); | |||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 7 | ▶ | if ( | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 195 | $env->{'psgix.harakiri.supported'} | ||||||||||||||||||||||||||||
| 196 | ? $env->{'psgix.harakiri'} | ||||||||||||||||||||||||||||
| 197 | : $env->{'psgix.harakiri.commit'} | ||||||||||||||||||||||||||||
| 198 | ) | ||||||||||||||||||||||||||||
| 199 | { | ||||||||||||||||||||||||||||
| 200 | 0 | $increment->( $env, 'psgix.harakiri' ); # rate == 1 | |||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | 7 | ▶ | $client->flush if $client->can('flush'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | 7 | return; | |||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | 7 | ); | |||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | 14 | ▶ | sub _mime_type_to_metric( $type = undef ) { | ||||||||||||||||||||||||||
|
Subroutine
_mime_type_to_metric: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 212 | 14 | ▶ | return unless $type; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 213 | 8 | ▶ | return unless $type =~ m#^\w+/(?:\w+[\-\+])*\w+(?: *;\w+=\w+)?#a; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | 8 | return $type =~ s#\.#-#gr =~ s#/#.#gr =~ s/;.*$//r; | |||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 5 | 1; | |||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | __END__ | ||||||||||||||||||||||||||||