← Index
NYTProf Performance Profile   « line view »
For starman worker -M FindBin --max-requests 50 --workers 2 --user=kohadev-koha --group kohadev-koha --pid /var/run/koha/kohadev/plack.pid --daemonize --access-log /var/log/koha/kohadev/plack.log --error-log /var/log/koha/kohadev/plack-error.log -E deployment --socket /var/run/koha/kohadev/plack.sock /etc/koha/sites/kohadev/plack.psgi
  Run on Fri Jan 8 14:31:06 2016
Reported on Fri Jan 8 14:33:30 2016

Filename/usr/share/perl5/URI/QueryParam.pm
StatementsExecuted 0 statements in 0s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11117µs30µsURI::QueryParam::::BEGIN@3URI::QueryParam::BEGIN@3
11110µs20µsURI::QueryParam::::BEGIN@4URI::QueryParam::BEGIN@4
0000s0sURI::_query::::query_form_hash URI::_query::query_form_hash
0000s0sURI::_query::::query_param URI::_query::query_param
0000s0sURI::_query::::query_param_append URI::_query::query_param_append
0000s0sURI::_query::::query_param_delete URI::_query::query_param_delete
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package URI::QueryParam;
2
3243µs
# spent 30µs (17+13) within URI::QueryParam::BEGIN@3 which was called: # once (17µs+13µs) by Authen::CAS::Client::BEGIN@11 at line 3
use strict;
# spent 30µs making 1 call to URI::QueryParam::BEGIN@3 # spent 13µs making 1 call to strict::import
4230µs
# spent 20µs (10+10) within URI::QueryParam::BEGIN@4 which was called: # once (10µs+10µs) by Authen::CAS::Client::BEGIN@11 at line 4
use warnings;
# spent 20µs making 1 call to URI::QueryParam::BEGIN@4 # spent 10µs making 1 call to warnings::import
5
6sub URI::_query::query_param {
7 my $self = shift;
8 my @old = $self->query_form;
9
10 if (@_ == 0) {
11 # get keys
12 my (%seen, $i);
13 return grep !($i++ % 2 || $seen{$_}++), @old;
14 }
15
16 my $key = shift;
17 my @i = grep $_ % 2 == 0 && $old[$_] eq $key, 0 .. $#old;
18
19 if (@_) {
20 my @new = @old;
21 my @new_i = @i;
22 my @vals = map { ref($_) eq 'ARRAY' ? @$_ : $_ } @_;
23
24 while (@new_i > @vals) {
25 splice @new, pop @new_i, 2;
26 }
27 if (@vals > @new_i) {
28 my $i = @new_i ? $new_i[-1] + 2 : @new;
29 my @splice = splice @vals, @new_i, @vals - @new_i;
30
31 splice @new, $i, 0, map { $key => $_ } @splice;
32 }
33 if (@vals) {
34 #print "SET $new_i[0]\n";
35 @new[ map $_ + 1, @new_i ] = @vals;
36 }
37
38 $self->query_form(\@new);
39 }
40
41 return wantarray ? @old[map $_+1, @i] : @i ? $old[$i[0]+1] : undef;
42}
43
44sub URI::_query::query_param_append {
45 my $self = shift;
46 my $key = shift;
47 my @vals = map { ref $_ eq 'ARRAY' ? @$_ : $_ } @_;
48 $self->query_form($self->query_form, $key => \@vals); # XXX
49 return;
50}
51
52sub URI::_query::query_param_delete {
53 my $self = shift;
54 my $key = shift;
55 my @old = $self->query_form;
56 my @vals;
57
58 for (my $i = @old - 2; $i >= 0; $i -= 2) {
59 next if $old[$i] ne $key;
60 push(@vals, (splice(@old, $i, 2))[1]);
61 }
62 $self->query_form(\@old) if @vals;
63 return wantarray ? reverse @vals : $vals[-1];
64}
65
66sub URI::_query::query_form_hash {
67 my $self = shift;
68 my @old = $self->query_form;
69 if (@_) {
70 $self->query_form(@_ == 1 ? %{shift(@_)} : @_);
71 }
72 my %hash;
73 while (my($k, $v) = splice(@old, 0, 2)) {
74 if (exists $hash{$k}) {
75 for ($hash{$k}) {
76 $_ = [$_] unless ref($_) eq "ARRAY";
77 push(@$_, $v);
78 }
79 }
80 else {
81 $hash{$k} = $v;
82 }
83 }
84 return \%hash;
85}
86
871;
88
89__END__