← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 18:42:36 2015
Reported on Fri Jul 31 18:48:14 2015

Filename/var/www/foswikidev/core/lib/Foswiki/Configure/Wizard.pm
StatementsExecuted 7 statements in 236µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11114µs28µsFoswiki::Configure::Wizard::::BEGIN@35Foswiki::Configure::Wizard::BEGIN@35
11111µs37µsFoswiki::Configure::Wizard::::BEGIN@38Foswiki::Configure::Wizard::BEGIN@38
1119µs13µsFoswiki::Configure::Wizard::::BEGIN@36Foswiki::Configure::Wizard::BEGIN@36
0000s0sFoswiki::Configure::Wizard::::loadWizardFoswiki::Configure::Wizard::loadWizard
0000s0sFoswiki::Configure::Wizard::::newFoswiki::Configure::Wizard::new
0000s0sFoswiki::Configure::Wizard::::paramFoswiki::Configure::Wizard::param
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# See bottom of file for license and copyright information
2package Foswiki::Configure::Wizard;
3
4=begin TML
5
6---++ package Foswiki::Configure::Wizard
7
8A Wizard is module that performs one or more configuration functions.
9For example, you might have a wizard that helps set up email;
10when you have all the email settings done, you invoke the wizard
11to attempt to complete the configuration.
12
13Any number of callable functions may be defined in a wizard.
14Each function _fn_ has the signature:
15
16=ObjectMethod _fn_ ($reporter, $spec) -> $boolean=
17
18Wizards can accept
19values from callers using the =$this->param()= method. Error messages
20etc are reported via the =Foswiki::Configure::Reporter $reporter=.
21
22$spec is the root of the type specification tree for configuration entries.
23This is provided primarily for wizards that need to modify it e.g.
24installers.
25
26Wizard functions may modify =$Foswiki::cfg=, but must report
27any such changes that have to persist using the
28=$reporter->CHANGED= method.
29
30It's up to the UI how wizards are called, and their results returned.
31See the documentation for the UI for more information.
32
33=cut
34
35227µs241µs
# spent 28µs (14+13) within Foswiki::Configure::Wizard::BEGIN@35 which was called: # once (14µs+13µs) by Foswiki::Plugins::ConfigurePlugin::BEGIN@43 at line 35
use strict;
# spent 28µs making 1 call to Foswiki::Configure::Wizard::BEGIN@35 # spent 13µs making 1 call to strict::import
36230µs217µs
# spent 13µs (9+4) within Foswiki::Configure::Wizard::BEGIN@36 which was called: # once (9µs+4µs) by Foswiki::Plugins::ConfigurePlugin::BEGIN@43 at line 36
use warnings;
# spent 13µs making 1 call to Foswiki::Configure::Wizard::BEGIN@36 # spent 4µs making 1 call to warnings::import
37
382177µs263µs
# spent 37µs (11+26) within Foswiki::Configure::Wizard::BEGIN@38 which was called: # once (11µs+26µs) by Foswiki::Plugins::ConfigurePlugin::BEGIN@43 at line 38
use Assert;
# spent 37µs making 1 call to Foswiki::Configure::Wizard::BEGIN@38 # spent 26µs making 1 call to Exporter::import
39
40=begin TML
41
42---++ StaticMethod loadWizard($name, $param_source) -> $wizard
43
44Loads the Foswiki::Configure::Wizards subclass identified
45by $name. =$param_source= is a reference to an object that
46supports the =param()= method for getting parameter values.
47
48=cut
49
50sub loadWizard {
51 my ( $name, $param_source ) = @_;
52
53 ASSERT( $name =~ m/^[A-Za-z][A-Za-z0-9]+$/ ) if DEBUG;
54
55 my $class = 'Foswiki::Configure::Wizards::' . $name;
56
57 eval("require $class");
58 die "Failed to load wizard $class: $@" if $@;
59
60 return $class->new($param_source);
61}
62
63sub new {
64 my ( $class, $ps ) = @_;
65 return bless( { param_source => $ps }, $class );
66}
67
68=begin TML
69
70---++ ObjectMethod param($name) -> $value
71
72Returns the value of a parameter that was given when the wizard was invoked.
73
74=cut
75
76sub param {
77 my ( $this, $param ) = @_;
78 return $this->{param_source}->{$param};
79}
80
8112µs1;