← 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
StatementsExecuted 13 statements in 336µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11110µs11µsSpreadsheet::ParseExcel::Workbook::::BEGIN@19Spreadsheet::ParseExcel::Workbook::BEGIN@19
1115µs18µsSpreadsheet::ParseExcel::Workbook::::BEGIN@189Spreadsheet::ParseExcel::Workbook::BEGIN@189
1114µs21µsSpreadsheet::ParseExcel::Workbook::::BEGIN@20Spreadsheet::ParseExcel::Workbook::BEGIN@20
1112µs2µsSpreadsheet::ParseExcel::Workbook::::newSpreadsheet::ParseExcel::Workbook::new
0000s0sSpreadsheet::ParseExcel::Workbook::::ParseSpreadsheet::ParseExcel::Workbook::Parse
0000s0sSpreadsheet::ParseExcel::Workbook::::ParseAbortSpreadsheet::ParseExcel::Workbook::ParseAbort
0000s0sSpreadsheet::ParseExcel::Workbook::::color_idx_to_rgbSpreadsheet::ParseExcel::Workbook::color_idx_to_rgb
0000s0sSpreadsheet::ParseExcel::Workbook::::get_active_sheetSpreadsheet::ParseExcel::Workbook::get_active_sheet
0000s0sSpreadsheet::ParseExcel::Workbook::::get_filenameSpreadsheet::ParseExcel::Workbook::get_filename
0000s0sSpreadsheet::ParseExcel::Workbook::::get_print_areasSpreadsheet::ParseExcel::Workbook::get_print_areas
0000s0sSpreadsheet::ParseExcel::Workbook::::get_print_titlesSpreadsheet::ParseExcel::Workbook::get_print_titles
0000s0sSpreadsheet::ParseExcel::Workbook::::using_1904_dateSpreadsheet::ParseExcel::Workbook::using_1904_date
0000s0sSpreadsheet::ParseExcel::Workbook::::worksheetSpreadsheet::ParseExcel::Workbook::worksheet
0000s0sSpreadsheet::ParseExcel::Workbook::::worksheet_countSpreadsheet::ParseExcel::Workbook::worksheet_count
0000s0sSpreadsheet::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
1package 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
19219µs213µ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
202284µs237µ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
221300nsour $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 {
311600ns my ($class) = @_;
321400ns my $self = {};
3312µs bless $self, $class;
34}
35
36###############################################################################
37sub 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#
50sub 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#
68sub 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#
80sub 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#
93sub 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#
108sub 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#
123sub 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#
136sub using_1904_date {
137
138 my $self = shift;
139
140 return $self->{Flg1904};
141}
142
143###############################################################################
144#
145# ParseAbort()
146#
147# Todo
148#
149sub ParseAbort {
150 my ( $self, $val ) = @_;
151 $self->{_ParseAbort} = $val;
152}
153
154=head2 get_active_sheet()
155
156Return the number of the active (open) worksheet (at the time the workbook
157was saved. May return undef.
158
159=cut
160
161sub 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#
175sub 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{
189328µs231µ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
1901900ns *Worksheet = *worksheet;
191}
192
19312µs1;
194
195__END__