← Index
NYTProf Performance Profile   « line view »
For /usr/local/libexec/sympa/task_manager-debug.pl
  Run on Tue Jun 1 22:32:51 2021
Reported on Tue Jun 1 22:35:09 2021

Filename/usr/local/lib/perl5/site_perl/mach/5.32/XML/LibXML/XPathContext.pm
StatementsExecuted 0 statements in 0s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
0000s0sXML::LibXML::XPathContext::::BEGIN@12XML::LibXML::XPathContext::BEGIN@12
0000s0sXML::LibXML::XPathContext::::BEGIN@13XML::LibXML::XPathContext::BEGIN@13
0000s0sXML::LibXML::XPathContext::::BEGIN@14XML::LibXML::XPathContext::BEGIN@14
0000s0sXML::LibXML::XPathContext::::BEGIN@142XML::LibXML::XPathContext::BEGIN@142
0000s0sXML::LibXML::XPathContext::::BEGIN@16XML::LibXML::XPathContext::BEGIN@16
0000s0sXML::LibXML::XPathContext::::BEGIN@17XML::LibXML::XPathContext::BEGIN@17
0000s0sXML::LibXML::XPathContext::::BEGIN@18XML::LibXML::XPathContext::BEGIN@18
0000s0sXML::LibXML::XPathContext::::CLONE_SKIPXML::LibXML::XPathContext::CLONE_SKIP
0000s0sXML::LibXML::XPathContext::::__ANON__XML::LibXML::XPathContext::__ANON__ (xsub)
0000s0sXML::LibXML::XPathContext::::_guarded_find_callXML::LibXML::XPathContext::_guarded_find_call
0000s0sXML::LibXML::XPathContext::::_perl_dispatcherXML::LibXML::XPathContext::_perl_dispatcher
0000s0sXML::LibXML::XPathContext::::existsXML::LibXML::XPathContext::exists
0000s0sXML::LibXML::XPathContext::::findXML::LibXML::XPathContext::find
0000s0sXML::LibXML::XPathContext::::findnodesXML::LibXML::XPathContext::findnodes
0000s0sXML::LibXML::XPathContext::::findvalueXML::LibXML::XPathContext::findvalue
0000s0sXML::LibXML::XPathContext::::registerFunctionXML::LibXML::XPathContext::registerFunction
0000s0sXML::LibXML::XPathContext::::unregisterFunctionXML::LibXML::XPathContext::unregisterFunction
0000s0sXML::LibXML::XPathContext::::unregisterFunctionNSXML::LibXML::XPathContext::unregisterFunctionNS
0000s0sXML::LibXML::XPathContext::::unregisterNsXML::LibXML::XPathContext::unregisterNs
0000s0sXML::LibXML::XPathContext::::unregisterVarLookupFuncXML::LibXML::XPathContext::unregisterVarLookupFunc
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# $Id: XPathContext.pm 422 2002-11-08 17:10:30Z phish $
2#
3# This is free software, you may use it and distribute it under the same terms as
4# Perl itself.
5#
6# Copyright 2001-2003 AxKit.com Ltd., 2002-2006 Christian Glahn, 2006-2009 Petr Pajas
7#
8#
9
10package XML::LibXML::XPathContext;
11
12use strict;
13use warnings;
14use vars qw($VERSION @ISA $USE_LIBXML_DATA_TYPES);
15
16use Carp;
17use XML::LibXML;
18use XML::LibXML::NodeList;
19
20$VERSION = "2.0207"; # VERSION TEMPLATE: DO NOT CHANGE
21
22# should LibXML XPath data types be used for simple objects
23# when passing parameters to extension functions (default: no)
24$USE_LIBXML_DATA_TYPES = 0;
25
26sub CLONE_SKIP { 1 }
27
28sub findnodes {
29 my ($self, $xpath, $node) = @_;
30
31 my @nodes = $self->_guarded_find_call('_findnodes', $node, $xpath);
32
33 if (wantarray) {
34 return @nodes;
35 }
36 else {
37 return XML::LibXML::NodeList->new(@nodes);
38 }
39}
40
41sub find {
42 my ($self, $xpath, $node) = @_;
43
44 my ($type, @params) = $self->_guarded_find_call('_find', $node, $xpath,0);
45
46 if ($type) {
47 return $type->new(@params);
48 }
49 return undef;
50}
51
52sub exists {
53 my ($self, $xpath, $node) = @_;
54 my (undef, $value) = $self->_guarded_find_call('_find', $node, $xpath,1);
55 return $value;
56}
57
58sub findvalue {
59 my $self = shift;
60 return $self->find(@_)->to_literal->value;
61}
62
63sub _guarded_find_call {
64 my ($self, $method, $node)=(shift,shift,shift);
65
66 my $prev_node;
67 if (ref($node)) {
68 $prev_node = $self->getContextNode();
69 $self->setContextNode($node);
70 }
71 my @ret;
72 eval {
73 @ret = $self->$method(@_);
74 };
75 $self->_free_node_pool;
76 $self->setContextNode($prev_node) if ref($node);
77
78 if ($@) {
79 my $err = $@;
80 chomp $err;
81 croak $err;
82 }
83
84 return @ret;
85}
86
87sub registerFunction {
88 my ($self, $name, $sub) = @_;
89 $self->registerFunctionNS($name, undef, $sub);
90 return;
91}
92
93sub unregisterNs {
94 my ($self, $prefix) = @_;
95 $self->registerNs($prefix, undef);
96 return;
97}
98
99sub unregisterFunction {
100 my ($self, $name) = @_;
101 $self->registerFunctionNS($name, undef, undef);
102 return;
103}
104
105sub unregisterFunctionNS {
106 my ($self, $name, $ns) = @_;
107 $self->registerFunctionNS($name, $ns, undef);
108 return;
109}
110
111sub unregisterVarLookupFunc {
112 my ($self) = @_;
113 $self->registerVarLookupFunc(undef, undef);
114 return;
115}
116
117# extension function perl dispatcher
118# borrowed from XML::LibXSLT
119
120sub _perl_dispatcher {
121 my $func = shift;
122 my @params = @_;
123 my @perlParams;
124
125 my $i = 0;
126 while (@params) {
127 my $type = shift(@params);
128 if ($type eq 'XML::LibXML::Literal' or
129 $type eq 'XML::LibXML::Number' or
130 $type eq 'XML::LibXML::Boolean')
131 {
132 my $val = shift(@params);
133 unshift(@perlParams, $USE_LIBXML_DATA_TYPES ? $type->new($val) : $val);
134 }
135 elsif ($type eq 'XML::LibXML::NodeList') {
136 my $node_count = shift(@params);
137 unshift(@perlParams, $type->new(splice(@params, 0, $node_count)));
138 }
139 }
140
141 $func = "main::$func" unless ref($func) || $func =~ /(.+)::/;
142 no strict 'refs';
143 my $res = $func->(@perlParams);
144 return $res;
145}
146
1471;