Profile of Spreadsheet/ParseExcel/Workbook.pm

← Index
NYTProf Performance Profile «line view»
For t/bug-md-11.t
Run on Fri Mar 8 13:27:24 2024
Reported on Fri Mar 8 13:30:23 2024

Filename | /home/micha/.plenv/versions/5.38.2/lib/perl5/site_perl/5.38.2/Spreadsheet/ParseExcel/Workbook.pm
Statements | Executed 13 statements in 336µs

Subroutines
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 10µs | 11µs | Spreadsheet::ParseExcel::Workbook::::BEGIN@19Spreadsheet::ParseExcel::Workbook::BEGIN@19
1 | 1 | 1 | 5µs | 18µs | Spreadsheet::ParseExcel::Workbook::::BEGIN@189Spreadsheet::ParseExcel::Workbook::BEGIN@189
1 | 1 | 1 | 4µs | 21µs | Spreadsheet::ParseExcel::Workbook::::BEGIN@20Spreadsheet::ParseExcel::Workbook::BEGIN@20
1 | 1 | 1 | 2µs | 2µs | Spreadsheet::ParseExcel::Workbook::::newSpreadsheet::ParseExcel::Workbook::new
0 | 0 | 0 | 0s | 0s | Spreadsheet::ParseExcel::Workbook::::ParseSpreadsheet::ParseExcel::Workbook::Parse
0 | 0 | 0 | 0s | 0s | Spreadsheet::ParseExcel::Workbook::::ParseAbortSpreadsheet::ParseExcel::Workbook::ParseAbort
0 | 0 | 0 | 0s | 0s | Spreadsheet::ParseExcel::Workbook::::color_idx_to_rgbSpreadsheet::ParseExcel::Workbook::color_idx_to_rgb
0 | 0 | 0 | 0s | 0s | Spreadsheet::ParseExcel::Workbook::::get_active_sheetSpreadsheet::ParseExcel::Workbook::get_active_sheet
0 | 0 | 0 | 0s | 0s | Spreadsheet::ParseExcel::Workbook::::get_filenameSpreadsheet::ParseExcel::Workbook::get_filename
0 | 0 | 0 | 0s | 0s | Spreadsheet::ParseExcel::Workbook::::get_print_areasSpreadsheet::ParseExcel::Workbook::get_print_areas
0 | 0 | 0 | 0s | 0s | Spreadsheet::ParseExcel::Workbook::::get_print_titlesSpreadsheet::ParseExcel::Workbook::get_print_titles
0 | 0 | 0 | 0s | 0s | Spreadsheet::ParseExcel::Workbook::::using_1904_dateSpreadsheet::ParseExcel::Workbook::using_1904_date
0 | 0 | 0 | 0s | 0s | Spreadsheet::ParseExcel::Workbook::::worksheetSpreadsheet::ParseExcel::Workbook::worksheet
0 | 0 | 0 | 0s | 0s | Spreadsheet::ParseExcel::Workbook::::worksheet_countSpreadsheet::ParseExcel::Workbook::worksheet_count
0 | 0 | 0 | 0s | 0s | Spreadsheet::ParseExcel::Workbook::::worksheetsSpreadsheet::ParseExcel::Workbook::worksheets

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package Spreadsheet::ParseExcel::Workbook;
2 |  |  |  |  |
3 |  |  |  |  | ###############################################################################
4 |  |  |  |  | #
5 |  |  |  |  | # Spreadsheet::ParseExcel::Workbook - A class for Workbooks.
6 |  |  |  |  | #
7 |  |  |  |  | # Used in conjunction with Spreadsheet::ParseExcel.
8 |  |  |  |  | #
9 |  |  |  |  | # Copyright (c) 2014 Douglas Wilson
10 |  |  |  |  | # Copyright (c) 2009-2013 John McNamara
11 |  |  |  |  | # Copyright (c) 2006-2008 Gabor Szabo
12 |  |  |  |  | # Copyright (c) 2000-2006 Kawai Takanori
13 |  |  |  |  | #
14 |  |  |  |  | # perltidy with standard settings.
15 |  |  |  |  | #
16 |  |  |  |  | # Documentation after __END__
17 |  |  |  |  | #
18 |  |  |  |  |
19 | 2 | 19µs | 2 | 13µs | # spent 11µs (10+2) within Spreadsheet::ParseExcel::Workbook::BEGIN@19 which was called: # once (10µs+2µs) by Spreadsheet::ParseExcel::BEGIN@31 at line 19 use strict; # spent 11µs making 1 call to Spreadsheet::ParseExcel::Workbook::BEGIN@19 # spent 2µs making 1 call to strict::import
20 | 2 | 284µs | 2 | 37µs | # spent 21µs (4+17) within Spreadsheet::ParseExcel::Workbook::BEGIN@20 which was called: # once (4µs+17µs) by Spreadsheet::ParseExcel::BEGIN@31 at line 20 use warnings; # spent 21µs making 1 call to Spreadsheet::ParseExcel::Workbook::BEGIN@20 # spent 17µs making 1 call to warnings::import
21 |  |  |  |  |
22 | 1 | 300ns |  |  | our $VERSION = '0.66';
23 |  |  |  |  |
24 |  |  |  |  | ###############################################################################
25 |  |  |  |  | #
26 |  |  |  |  | # new()
27 |  |  |  |  | #
28 |  |  |  |  | # Constructor.
29 |  |  |  |  | #
30 |  |  |  |  | # spent 2µs within Spreadsheet::ParseExcel::Workbook::new which was called: # once (2µs+0s) by Spreadsheet::ParseXLSX::parse at line 76 of /home/micha/Projekt/spreadsheet-parsexlsx/lib/Spreadsheet/ParseXLSX.pm sub new {
31 | 1 | 600ns |  |  | my ($class) = @_;
32 | 1 | 400ns |  |  | my $self = {};
33 | 1 | 2µs |  |  | bless $self, $class;
34 |  |  |  |  | }
35 |  |  |  |  |
36 |  |  |  |  | ###############################################################################
37 |  |  |  |  | sub color_idx_to_rgb {
38 |  |  |  |  | my( $workbook, $iidx ) = @_;
39 |  |  |  |  |
40 |  |  |  |  | my $palette = $workbook->{aColor};
41 |  |  |  |  | return ( ( defined $palette->[$iidx] ) ? $palette->[$iidx] : $palette->[0] );
42 |  |  |  |  | }
43 |  |  |  |  |
44 |  |  |  |  | ###############################################################################
45 |  |  |  |  | #
46 |  |  |  |  | # worksheet()
47 |  |  |  |  | #
48 |  |  |  |  | # This method returns a single Worksheet object using either its name or index.
49 |  |  |  |  | #
50 |  |  |  |  | sub worksheet {
51 |  |  |  |  | my ( $oBook, $sName ) = @_;
52 |  |  |  |  | my $oWkS;
53 |  |  |  |  | foreach $oWkS ( @{ $oBook->{Worksheet} } ) {
54 |  |  |  |  | return $oWkS if ( $oWkS->{Name} eq $sName );
55 |  |  |  |  | }
56 |  |  |  |  | if ( $sName =~ /^\d+$/ ) {
57 |  |  |  |  | return $oBook->{Worksheet}->[$sName];
58 |  |  |  |  | }
59 |  |  |  |  | return undef;
60 |  |  |  |  | }
61 |  |  |  |  |
62 |  |  |  |  | ###############################################################################
63 |  |  |  |  | #
64 |  |  |  |  | # worksheets()
65 |  |  |  |  | #
66 |  |  |  |  | # Returns an array of Worksheet objects.
67 |  |  |  |  | #
68 |  |  |  |  | sub worksheets {
69 |  |  |  |  | my $self = shift;
70 |  |  |  |  |
71 |  |  |  |  | return @{ $self->{Worksheet} };
72 |  |  |  |  | }
73 |  |  |  |  |
74 |  |  |  |  | ###############################################################################
75 |  |  |  |  | #
76 |  |  |  |  | # worksheet_count()
77 |  |  |  |  | #
78 |  |  |  |  | # Returns the number Woksheet objects in the Workbook.
79 |  |  |  |  | #
80 |  |  |  |  | sub worksheet_count {
81 |  |  |  |  |
82 |  |  |  |  | my $self = shift;
83 |  |  |  |  |
84 |  |  |  |  | return $self->{SheetCount};
85 |  |  |  |  | }
86 |  |  |  |  |
87 |  |  |  |  | ###############################################################################
88 |  |  |  |  | #
89 |  |  |  |  | # get_filename()
90 |  |  |  |  | #
91 |  |  |  |  | # Returns the name of the Excel file of C<undef> if the data was read from a filehandle rather than a file.
92 |  |  |  |  | #
93 |  |  |  |  | sub get_filename {
94 |  |  |  |  |
95 |  |  |  |  | my $self = shift;
96 |  |  |  |  |
97 |  |  |  |  | return $self->{File};
98 |  |  |  |  | }
99 |  |  |  |  |
100 |  |  |  |  | ###############################################################################
101 |  |  |  |  | #
102 |  |  |  |  | # get_print_areas()
103 |  |  |  |  | #
104 |  |  |  |  | # Returns an array ref of print areas.
105 |  |  |  |  | #
106 |  |  |  |  | # TODO. This should really be a Worksheet method.
107 |  |  |  |  | #
108 |  |  |  |  | sub get_print_areas {
109 |  |  |  |  |
110 |  |  |  |  | my $self = shift;
111 |  |  |  |  |
112 |  |  |  |  | return $self->{PrintArea};
113 |  |  |  |  | }
114 |  |  |  |  |
115 |  |  |  |  | ###############################################################################
116 |  |  |  |  | #
117 |  |  |  |  | # get_print_titles()
118 |  |  |  |  | #
119 |  |  |  |  | # Returns an array ref of print title hash refs.
120 |  |  |  |  | #
121 |  |  |  |  | # TODO. This should really be a Worksheet method.
122 |  |  |  |  | #
123 |  |  |  |  | sub get_print_titles {
124 |  |  |  |  |
125 |  |  |  |  | my $self = shift;
126 |  |  |  |  |
127 |  |  |  |  | return $self->{PrintTitle};
128 |  |  |  |  | }
129 |  |  |  |  |
130 |  |  |  |  | ###############################################################################
131 |  |  |  |  | #
132 |  |  |  |  | # using_1904_date()
133 |  |  |  |  | #
134 |  |  |  |  | # Returns true if the Excel file is using the 1904 date epoch.
135 |  |  |  |  | #
136 |  |  |  |  | sub using_1904_date {
137 |  |  |  |  |
138 |  |  |  |  | my $self = shift;
139 |  |  |  |  |
140 |  |  |  |  | return $self->{Flg1904};
141 |  |  |  |  | }
142 |  |  |  |  |
143 |  |  |  |  | ###############################################################################
144 |  |  |  |  | #
145 |  |  |  |  | # ParseAbort()
146 |  |  |  |  | #
147 |  |  |  |  | # Todo
148 |  |  |  |  | #
149 |  |  |  |  | sub ParseAbort {
150 |  |  |  |  | my ( $self, $val ) = @_;
151 |  |  |  |  | $self->{_ParseAbort} = $val;
152 |  |  |  |  | }
153 |  |  |  |  |
154 |  |  |  |  | =head2 get_active_sheet()
155 |  |  |  |  |
156 |  |  |  |  | Return the number of the active (open) worksheet (at the time the workbook
157 |  |  |  |  | was saved. May return undef.
158 |  |  |  |  |
159 |  |  |  |  | =cut
160 |  |  |  |  |
161 |  |  |  |  | sub get_active_sheet {
162 |  |  |  |  | my $workbook = shift;
163 |  |  |  |  |
164 |  |  |  |  | return $workbook->{ActiveSheet};
165 |  |  |  |  | }
166 |  |  |  |  |
167 |  |  |  |  | ###############################################################################
168 |  |  |  |  | #
169 |  |  |  |  | # Parse(). Deprecated.
170 |  |  |  |  | #
171 |  |  |  |  | # Syntactic wrapper around Spreadsheet::ParseExcel::Parse().
172 |  |  |  |  | # This method is *deprecated* since it doesn't conform to the current
173 |  |  |  |  | # error handling in the S::PE Parse() method.
174 |  |  |  |  | #
175 |  |  |  |  | sub Parse {
176 |  |  |  |  |
177 |  |  |  |  | my ( $class, $source, $formatter ) = @_;
178 |  |  |  |  | my $excel = Spreadsheet::ParseExcel->new();
179 |  |  |  |  | my $workbook = $excel->Parse( $source, $formatter );
180 |  |  |  |  | $workbook->{_Excel} = $excel;
181 |  |  |  |  | return $workbook;
182 |  |  |  |  | }
183 |  |  |  |  |
184 |  |  |  |  | ###############################################################################
185 |  |  |  |  | #
186 |  |  |  |  | # Mapping between legacy method names and new names.
187 |  |  |  |  | #
188 |  |  |  |  | {
189 | 3 | 28µs | 2 | 31µs | # spent 18µs (5+13) within Spreadsheet::ParseExcel::Workbook::BEGIN@189 which was called: # once (5µs+13µs) by Spreadsheet::ParseExcel::BEGIN@31 at line 189 no warnings; # Ignore warnings about variables used only once. # spent 18µs making 1 call to Spreadsheet::ParseExcel::Workbook::BEGIN@189 # spent 13µs making 1 call to warnings::unimport
190 | 1 | 900ns |  |  | *Worksheet = *worksheet;
191 |  |  |  |  | }
192 |  |  |  |  |
193 | 1 | 2µs |  |  | 1;
194 |  |  |  |  |
195 |  |  |  |  | __END__