| Filename | /home/ocbnet/domain/ocbnet.ch/vhost/webmerge/htdocs/webmerge/scripts/modules/RTP/Webmerge/IO/JS.pm |
| Statements | Executed 15 statements in 2.29ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 87µs | 366µs | RTP::Webmerge::IO::JS::BEGIN@8 |
| 1 | 1 | 1 | 72µs | 104µs | RTP::Webmerge::IO::JS::BEGIN@10 |
| 1 | 1 | 1 | 67µs | 156µs | RTP::Webmerge::IO::JS::BEGIN@9 |
| 1 | 1 | 1 | 58µs | 58µs | RTP::Webmerge::IO::JS::BEGIN@18.15 |
| 1 | 1 | 1 | 55µs | 254µs | RTP::Webmerge::IO::JS::BEGIN@29 |
| 1 | 1 | 1 | 32µs | 32µs | RTP::Webmerge::IO::JS::BEGIN@18 |
| 1 | 1 | 1 | 30µs | 30µs | RTP::Webmerge::IO::JS::BEGIN@21 |
| 1 | 1 | 1 | 22µs | 22µs | RTP::Webmerge::IO::JS::BEGIN@15 |
| 1 | 1 | 1 | 22µs | 22µs | RTP::Webmerge::IO::JS::BEGIN@24 |
| 0 | 0 | 0 | 0s | 0s | RTP::Webmerge::IO::JS::exportJS |
| 0 | 0 | 0 | 0s | 0s | RTP::Webmerge::IO::JS::importJS |
| 0 | 0 | 0 | 0s | 0s | RTP::Webmerge::IO::JS::readJS |
| 0 | 0 | 0 | 0s | 0s | RTP::Webmerge::IO::JS::writeJS |
| 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 | ################################################################################################### | ||||
| 5 | package RTP::Webmerge::IO::JS; | ||||
| 6 | ################################################################################################### | ||||
| 7 | |||||
| 8 | 2 | 158µs | 2 | 645µs | # spent 366µs (87+279) within RTP::Webmerge::IO::JS::BEGIN@8 which was called:
# once (87µs+279µs) by RTP::Webmerge::Merge::BEGIN@66 at line 8 # spent 366µs making 1 call to RTP::Webmerge::IO::JS::BEGIN@8
# spent 279µs making 1 call to Exporter::import |
| 9 | 2 | 149µs | 2 | 245µs | # spent 156µs (67+89) within RTP::Webmerge::IO::JS::BEGIN@9 which was called:
# once (67µs+89µs) by RTP::Webmerge::Merge::BEGIN@66 at line 9 # spent 156µs making 1 call to RTP::Webmerge::IO::JS::BEGIN@9
# spent 89µs making 1 call to strict::import |
| 10 | 2 | 195µs | 2 | 136µs | # spent 104µs (72+32) within RTP::Webmerge::IO::JS::BEGIN@10 which was called:
# once (72µs+32µs) by RTP::Webmerge::Merge::BEGIN@66 at line 10 # spent 104µs making 1 call to RTP::Webmerge::IO::JS::BEGIN@10
# spent 32µs making 1 call to warnings::import |
| 11 | |||||
| 12 | ################################################################################################### | ||||
| 13 | |||||
| 14 | # define our version string | ||||
| 15 | 1 | 166µs | 1 | 22µs | # spent 22µs within RTP::Webmerge::IO::JS::BEGIN@15 which was called:
# once (22µs+0s) by RTP::Webmerge::Merge::BEGIN@66 at line 15 # spent 22µs making 1 call to RTP::Webmerge::IO::JS::BEGIN@15 |
| 16 | |||||
| 17 | # load exporter and inherit from it | ||||
| 18 | 3 | 433µs | 2 | 90µs | BEGIN { use Exporter qw(); our @ISA = qw(Exporter) } # spent 58µs making 1 call to RTP::Webmerge::IO::JS::BEGIN@18.15
# spent 32µs making 1 call to RTP::Webmerge::IO::JS::BEGIN@18 |
| 19 | |||||
| 20 | # define our variables to be exported | ||||
| 21 | 1 | 170µs | 1 | 30µs | # spent 30µs within RTP::Webmerge::IO::JS::BEGIN@21 which was called:
# once (30µs+0s) by RTP::Webmerge::Merge::BEGIN@66 at line 21 # spent 30µs making 1 call to RTP::Webmerge::IO::JS::BEGIN@21 |
| 22 | |||||
| 23 | # define our functions to be exported | ||||
| 24 | 1 | 163µs | 1 | 22µs | # spent 22µs within RTP::Webmerge::IO::JS::BEGIN@24 which was called:
# once (22µs+0s) by RTP::Webmerge::Merge::BEGIN@66 at line 24 # spent 22µs making 1 call to RTP::Webmerge::IO::JS::BEGIN@24 |
| 25 | |||||
| 26 | ################################################################################################### | ||||
| 27 | |||||
| 28 | # import webmerge IO file reader and writer | ||||
| 29 | 2 | 840µs | 2 | 453µs | # spent 254µs (55+199) within RTP::Webmerge::IO::JS::BEGIN@29 which was called:
# once (55µs+199µs) by RTP::Webmerge::Merge::BEGIN@66 at line 29 # spent 254µs making 1 call to RTP::Webmerge::IO::JS::BEGIN@29
# spent 199µs making 1 call to Exporter::import |
| 30 | |||||
| 31 | ################################################################################################### | ||||
| 32 | |||||
| 33 | # read a js file from the disk | ||||
| 34 | sub readJS | ||||
| 35 | { | ||||
| 36 | |||||
| 37 | # get input variables | ||||
| 38 | my ($jsfile) = @_; | ||||
| 39 | |||||
| 40 | # read complete css file | ||||
| 41 | my $data = readfile($jsfile); | ||||
| 42 | |||||
| 43 | # die with an error message that js file is not found | ||||
| 44 | die "js file <$jsfile> could not be read: $!\n" unless $data; | ||||
| 45 | |||||
| 46 | # return as string | ||||
| 47 | return $data; | ||||
| 48 | |||||
| 49 | } | ||||
| 50 | # EO sub readJS | ||||
| 51 | |||||
| 52 | # mangle JS | ||||
| 53 | sub importJS | ||||
| 54 | { | ||||
| 55 | return 1; | ||||
| 56 | } | ||||
| 57 | # EO sub importJS | ||||
| 58 | |||||
| 59 | # mangle JS | ||||
| 60 | sub exportJS | ||||
| 61 | { | ||||
| 62 | return 1; | ||||
| 63 | } | ||||
| 64 | # EO sub exportJS | ||||
| 65 | |||||
| 66 | ################################################################################################### | ||||
| 67 | |||||
| 68 | # write a js file to the disk | ||||
| 69 | sub writeJS | ||||
| 70 | { | ||||
| 71 | |||||
| 72 | # get input variables | ||||
| 73 | my ($path, $data, $config) = @_; | ||||
| 74 | |||||
| 75 | # write the content to the file and return result | ||||
| 76 | return writefile($path, $data, $config->{'atomic'}, 1) | ||||
| 77 | |||||
| 78 | } | ||||
| 79 | # EO writeJS | ||||
| 80 | |||||
| 81 | ################################################################################################### | ||||
| 82 | ################################################################################################### | ||||
| 83 | 1 | 12µs | 1; |