← Index
NYTProf Performance Profile   « block view • line view • sub view »
For mentat.storage.mongo.pl
  Run on Tue Jun 24 09:58:41 2014
Reported on Tue Jun 24 09:59:39 2014

Filename/usr/local/lib/site_perl/Log/Writer/Std.pm
StatementsExecuted 17 statements in 344µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11111µs14µsLog::Writer::Std::::BEGIN@2Log::Writer::Std::BEGIN@2
1119µs9µsLog::Writer::Std::::BEGIN@75Log::Writer::Std::BEGIN@75
1117µs44µsLog::Writer::Std::::BEGIN@63Log::Writer::Std::BEGIN@63
1117µs30µsLog::Writer::Std::::BEGIN@64Log::Writer::Std::BEGIN@64
1116µs11µsLog::Writer::Std::::BEGIN@3Log::Writer::Std::BEGIN@3
1116µs42µsLog::Writer::Std::::BEGIN@76Log::Writer::Std::BEGIN@76
1114µs4µsLog::Writer::Std::::BEGIN@72Log::Writer::Std::BEGIN@72
1112µs2µsLog::Writer::Std::::ENDLog::Writer::Std::END
0000s0sLog::Writer::Std::::_initLog::Writer::Std::_init
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Log::Writer::Std;
2221µs217µs
# spent 14µs (11+3) within Log::Writer::Std::BEGIN@2 which was called: # once (11µs+3µs) by Log::Loger::BEGIN@132 at line 2
use strict;
# spent 14µs making 1 call to Log::Writer::Std::BEGIN@2 # spent 3µs making 1 call to strict::import
3250µs216µs
# spent 11µs (6+5) within Log::Writer::Std::BEGIN@3 which was called: # once (6µs+5µs) by Log::Loger::BEGIN@132 at line 3
use warnings;
# spent 11µs making 1 call to Log::Writer::Std::BEGIN@3 # spent 5µs making 1 call to warnings::import
4
5#*******************************************************************************
6#
7# DOCUMENTATION SECTION
8#
9#*******************************************************************************
10
11=head1 NAME
12
13Log::Writer::Std - STDOUT and STDERR log writer
14
15=head1 SYNOPSIS
16
17 use Log::Writer::Std;
18
19 my $writer = Log::Writer::Std->new('ERR');
20 my $writer = Log::Writer::Std->new('OUT',...);
21 # For more information about the constructor arguments and some more examples
22 # please refer to the Log::Writer::Handle(3) manual page
23
24 $instance->write('module', 'severity','Message from Log::Writer::Std');
25
26=head1 DESCRIPTION
27
28This writer writes given messages to the standard output or error.
29
30=head1 AUTHOR
31
32Jan Mach
33Cesnet, z.s.p.o
34jan.mach@cesnet.cz
35http://www.cesnet.cz
36
37=head1 COPYRIGHT
38
39This program is free software; you can redistribute
40it and/or modify it under the same terms as Perl itself.
41
42The full text of the license can be found in the
43LICENSE file included with this module.
44
45
46=head1 SEE ALSO
47
48perl(1), Log::Writer::Handle(3), Log::Writer::Module(3).
49
50=head1 FUNCTION REFERENCE
51
52=over 4
53
54=cut
55
56#*******************************************************************************
57#
58# INITIALIZATION AND CLEANUP SECTION
59#
60#*******************************************************************************
61
62#-- Perl core modules ---------------------------------------------------------#
63226µs281µs
# spent 44µs (7+37) within Log::Writer::Std::BEGIN@63 which was called: # once (7µs+37µs) by Log::Loger::BEGIN@132 at line 63
use Carp;
# spent 44µs making 1 call to Log::Writer::Std::BEGIN@63 # spent 37µs making 1 call to Exporter::import
64225µs253µs
# spent 30µs (7+23) within Log::Writer::Std::BEGIN@64 which was called: # once (7µs+23µs) by Log::Loger::BEGIN@132 at line 64
use Scalar::Util 'blessed';
# spent 30µs making 1 call to Log::Writer::Std::BEGIN@64 # spent 23µs making 1 call to Exporter::import
65
66#use Data::Dumper; #-+-> DEVEL ONLY <-+-#
67#use Smart::Comments; #-+-> DEVEL ONLY <-+-#
68
69#-- Perl CPAN modules ---------------------------------------------------------#
70
71#-- Custom application modules ------------------------------------------------#
72231µs14µs
# spent 4µs within Log::Writer::Std::BEGIN@72 which was called: # once (4µs+0s) by Log::Loger::BEGIN@132 at line 72
use Log::Writer::Handle;
# spent 4µs making 1 call to Log::Writer::Std::BEGIN@72
73
74#-- Module initializations ----------------------------------------------------#
75
# spent 9µs within Log::Writer::Std::BEGIN@75 which was called: # once (9µs+0s) by Log::Loger::BEGIN@132 at line 80
BEGIN {
76234µs278µs
# spent 42µs (6+36) within Log::Writer::Std::BEGIN@76 which was called: # once (6µs+36µs) by Log::Loger::BEGIN@132 at line 76
use vars qw($VERSION $DEVEL @ISA);
# spent 42µs making 1 call to Log::Writer::Std::BEGIN@76 # spent 36µs making 1 call to vars::import
771400ns $VERSION = '0.1';
781100ns $DEVEL = 0;
79111µs @ISA = ('Log::Writer::Handle');
801139µs19µs}
# spent 9µs making 1 call to Log::Writer::Std::BEGIN@75
81
82#-- Module clean-up code (global destructor) ----------------------------------#
8313µs
# spent 2µs within Log::Writer::Std::END which was called: # once (2µs+0s) by main::RUNTIME at line 0 of mentat.storage.mongo.pl
END {
84
85}
86
87#*******************************************************************************
88#
89# CONSTANTS AND GLOBAL VARIABLES DEFINITION SECTION
90#
91#*******************************************************************************
92
93#-- Constants -----------------------------------------------------------------#
94
95#-- Static public class variables (our) ---------------------------------------#
96
97#-- Static protected class variables (my) -------------------------------------#
98
99#*******************************************************************************
100#
101# IMPLEMENTATION SECTION
102#
103#*******************************************************************************
104
105#-------------------------------------------------------------------------------
106# Private interface
107#-------------------------------------------------------------------------------
108
109# _init [PROTECTED]
110#
111# Usage : return $self->_init(@_);
112# Purpose : Initialize the new Log::Writer::Std instance
113# Arguments : ENUM $type - type of output (OUT|ERR)
114# (for other _init arguments see Log::Writer::Handle class)
115# Returns : Log::Writer::Module reference
116# Throws : Croaks, if invoked on class, or if given invalid arguments
117# See also : Log::Writer::Handle module
118
119sub _init
120{
121 my $self = shift;
122 croak ((caller(0))[3] . ": instance method invoked on class") unless blessed($self);
123 my ($type, @arguments) = @_;
124
125 my $handle_std = (defined($type) and uc($type) eq 'OUT') ? fileno(STDOUT) : fileno(STDERR);
126 my $io_handle = IO::Handle->new_from_fd($handle_std, "w") or die "Can't open terminal output '$type': $!\n";
127 return $self->SUPER::_init($io_handle, @arguments);
128}
129
130=pod
131
132=back
133
134=cut
135
13612µs1;