← Index
NYTProf Performance Profile   « line view »
For webmerge/scripts/webmerge.pl
  Run on Mon Oct 7 02:42:42 2013
Reported on Mon Oct 7 03:03:22 2013

Filename/home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/Include/JS.pm
StatementsExecuted 17 statements in 2.36ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11186µs352µsRTP::Webmerge::Include::JS::::BEGIN@8RTP::Webmerge::Include::JS::BEGIN@8
11174µs74µsRTP::Webmerge::Include::JS::::BEGIN@18.18RTP::Webmerge::Include::JS::BEGIN@18.18
11160µs301µsRTP::Webmerge::Include::JS::::BEGIN@26RTP::Webmerge::Include::JS::BEGIN@26
11156µs88µsRTP::Webmerge::Include::JS::::BEGIN@10RTP::Webmerge::Include::JS::BEGIN@10
11155µs589µsRTP::Webmerge::Include::JS::::BEGIN@25RTP::Webmerge::Include::JS::BEGIN@25
11153µs141µsRTP::Webmerge::Include::JS::::BEGIN@9RTP::Webmerge::Include::JS::BEGIN@9
11129µs29µsRTP::Webmerge::Include::JS::::BEGIN@21RTP::Webmerge::Include::JS::BEGIN@21
11122µs22µsRTP::Webmerge::Include::JS::::BEGIN@18RTP::Webmerge::Include::JS::BEGIN@18
11122µs22µsRTP::Webmerge::Include::JS::::BEGIN@15RTP::Webmerge::Include::JS::BEGIN@15
0000s0sRTP::Webmerge::Include::JS::::includeJSRTP::Webmerge::Include::JS::includeJS
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1###################################################################################################
2# Copyright 2013 by Marcel Greter
3# This file is part of Webmerge (GPL3)
4###################################################################################################
5package RTP::Webmerge::Include::JS;
6###################################################################################################
7
82161µs2618µs
# spent 352µs (86+266) within RTP::Webmerge::Include::JS::BEGIN@8 which was called: # once (86µs+266µs) by RTP::Webmerge::Merge::JS::BEGIN@70 at line 8
use Carp;
# spent 352µs making 1 call to RTP::Webmerge::Include::JS::BEGIN@8 # spent 266µs making 1 call to Exporter::import
92158µs2228µs
# spent 141µs (53+88) within RTP::Webmerge::Include::JS::BEGIN@9 which was called: # once (53µs+88µs) by RTP::Webmerge::Merge::JS::BEGIN@70 at line 9
use strict;
# spent 141µs making 1 call to RTP::Webmerge::Include::JS::BEGIN@9 # spent 88µs making 1 call to strict::import
102192µs2121µs
# spent 88µs (56+33) within RTP::Webmerge::Include::JS::BEGIN@10 which was called: # once (56µs+33µs) by RTP::Webmerge::Merge::JS::BEGIN@70 at line 10
use warnings;
# spent 88µs making 1 call to RTP::Webmerge::Include::JS::BEGIN@10 # spent 33µs making 1 call to warnings::import
11
12###################################################################################################
13
14# define our version string
151143µs122µs
# spent 22µs within RTP::Webmerge::Include::JS::BEGIN@15 which was called: # once (22µs+0s) by RTP::Webmerge::Merge::JS::BEGIN@70 at line 15
BEGIN { $RTP::Webmerge::Include::JS::VERSION = "0.7.0" }
# spent 22µs making 1 call to RTP::Webmerge::Include::JS::BEGIN@15
16
17# load exporter and inherit from it
183399µs296µs
# spent 22µs within RTP::Webmerge::Include::JS::BEGIN@18 which was called: # once (22µs+0s) by RTP::Webmerge::Merge::JS::BEGIN@70 at line 18 # spent 74µs within RTP::Webmerge::Include::JS::BEGIN@18.18 which was called: # once (74µs+0s) by RTP::Webmerge::Merge::JS::BEGIN@70 at line 18
BEGIN { use Exporter qw(); our @ISA = qw(Exporter) }
# spent 74µs making 1 call to RTP::Webmerge::Include::JS::BEGIN@18.18 # spent 22µs making 1 call to RTP::Webmerge::Include::JS::BEGIN@18
19
20# define our functions to be exported
211167µs129µs
# spent 29µs within RTP::Webmerge::Include::JS::BEGIN@21 which was called: # once (29µs+0s) by RTP::Webmerge::Merge::JS::BEGIN@70 at line 21
BEGIN { our @EXPORT = qw(includeJS $js_dev_header); }
# spent 29µs making 1 call to RTP::Webmerge::Include::JS::BEGIN@21
22
23###################################################################################################
24
252180µs21.12ms
# spent 589µs (55+534) within RTP::Webmerge::Include::JS::BEGIN@25 which was called: # once (55µs+534µs) by RTP::Webmerge::Merge::JS::BEGIN@70 at line 25
use RTP::Webmerge::Path qw($webroot exportURI);
# spent 589µs making 1 call to RTP::Webmerge::Include::JS::BEGIN@25 # spent 534µs making 1 call to Exporter::import
262931µs2543µs
# spent 301µs (60+242) within RTP::Webmerge::Include::JS::BEGIN@26 which was called: # once (60µs+242µs) by RTP::Webmerge::Merge::JS::BEGIN@70 at line 26
use RTP::Webmerge::Fingerprint qw(fingerprint);
# spent 301µs making 1 call to RTP::Webmerge::Include::JS::BEGIN@26 # spent 242µs making 1 call to Exporter::import
27
28###################################################################################################
29
30# js function for header include
31# you can overwrite and control all bits by defining your own
32# javascript functions before including the generated dev file
33#**************************************************************************************************
34114µsour $js_dev_header =
35'
36// create namespace for webmerge if not yet defined
37if (typeof webmerge == \'undefined\') window.webmerge = {};
38
39// define default JS loader function, overwrite with
40// other defered JS loaders like head.hs or requireJS
41if (typeof webmerge.loadJS != \'function\')
42{
43 webmerge.loadJS = function (src)
44 {
45 document.write(\'<script src="\' + src + \'"></script>\');
46 }
47}
48
49// include a JS file (rewrite url if configured to)
50// then call the loadJS function to import the code
51if (typeof webmerge.includeJS != \'function\')
52{
53 webmerge.includeJS = function (src)
54 {
55 // check if we have a custom webroot
56 if (webmerge.webroot) src = [webmerge.webroot, src].join(\'/\');
57 // check if we have a custom url rewriter
58 if (webmerge.rewriteJS) src = webmerge.rewriteJS(src);
59 // call the importer function, which
60 // can be overwritten by a custom loader
61 webmerge.loadJS.call(this, src);
62 }
63}
64
65';
66
67###################################################################################################
68
69# called via array map
70#**************************************************************************************************
71sub includeJS
72{
73
74 # get passed variables
75 my ($config) = @_;
76
77 # magick map variable
78 my $data = $_;
79
80 # define the template for the script includes
81 my $js_include_tmpl = 'webmerge.includeJS(\'%s\');' . "\n";
82
83 # get a unique path with added fingerprint (query or directory)
84 my $path = fingerprint($config, 'dev', $data->{'local_path'}, $data->{'org'});
85
86 # return the script include string
87 return sprintf($js_include_tmpl, exportURI($path, $webroot, 1));
88
89}
90# EO includeJS
91
92###################################################################################################
93###################################################################################################
94115µs1;