line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Spreadsheet::Engine::Storage::SocialCalc; |
2
|
|
|
|
|
|
|
|
3
|
31
|
|
|
31
|
|
57613
|
use strict; |
|
31
|
|
|
|
|
59
|
|
|
31
|
|
|
|
|
1486
|
|
4
|
31
|
|
|
31
|
|
161
|
use warnings; |
|
31
|
|
|
|
|
47
|
|
|
31
|
|
|
|
|
1074
|
|
5
|
|
|
|
|
|
|
|
6
|
31
|
|
|
31
|
|
155
|
use Carp; |
|
31
|
|
|
|
|
60
|
|
|
31
|
|
|
|
|
2880
|
|
7
|
31
|
|
|
31
|
|
45555
|
use IO::File; |
|
31
|
|
|
|
|
412773
|
|
|
31
|
|
|
|
|
5137
|
|
8
|
|
|
|
|
|
|
|
9
|
31
|
|
|
31
|
|
2413
|
use Spreadsheet::Engine; |
|
31
|
|
|
|
|
67
|
|
|
31
|
|
|
|
|
14109
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Spreadsheet::Engine::Storage::SocialCalc - load SocialCalc files |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Spreadsheet::Engine::Storage::SocialCalc; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my Spreadsheet::Engine $sheet = |
20
|
|
|
|
|
|
|
Spreadsheet::Engine:Storage::SocialCalc->load($file); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This instantiates a Spreadsheet::Engine from a saved file in the |
25
|
|
|
|
|
|
|
SocialCalc format. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 METHODS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 load |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my Spreadsheet::Engine $sheet = |
32
|
|
|
|
|
|
|
Spreadsheet::Engine:Storage::SocialCalc->load($file); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Load a saved file. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub load { |
39
|
21
|
|
|
21
|
1
|
590
|
my ($class, $file) = @_; |
40
|
21
|
50
|
|
|
|
259
|
my $datafile = IO::File->new($file) or croak "Can't open $file: $!\n"; |
41
|
|
|
|
|
|
|
|
42
|
21
|
|
|
|
|
2630
|
my ($line, $boundary); |
43
|
0
|
|
|
|
|
0
|
my ($headerlines, $sheetlines); |
44
|
|
|
|
|
|
|
|
45
|
21
|
|
|
|
|
688
|
while ($line = <$datafile>) { |
46
|
42
|
100
|
|
|
|
298
|
last if $line =~ m/^Content-Type:\smultipart\/mixed;/i; |
47
|
|
|
|
|
|
|
} |
48
|
21
|
|
|
|
|
118
|
$line =~ m/\sboundary=(\S+)/i; |
49
|
21
|
50
|
|
|
|
152
|
$boundary = $1 or croak "No boundary found in $file"; |
50
|
|
|
|
|
|
|
|
51
|
21
|
|
|
|
|
148
|
while ($line = <$datafile>) { |
52
|
21
|
|
|
|
|
77
|
$line =~ s/\r//g; |
53
|
21
|
50
|
|
|
|
525
|
last if $line =~ m/^--$boundary$/o; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
21
|
|
|
|
|
290
|
while ($line = <$datafile>) { # go to blank line |
57
|
102
|
|
|
|
|
154
|
chomp $line; |
58
|
102
|
|
|
|
|
148
|
$line =~ s/\r//g; |
59
|
102
|
100
|
|
|
|
303
|
last unless $line; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
21
|
|
|
|
|
291
|
my $bregex = qr/^--$boundary/; |
63
|
|
|
|
|
|
|
|
64
|
21
|
|
|
|
|
102
|
while ($line = <$datafile>) { # copy header lines |
65
|
42
|
100
|
|
|
|
235
|
last if $line =~ m/$bregex/; |
66
|
21
|
50
|
|
|
|
132
|
push @{$headerlines}, $line if $headerlines; |
|
0
|
|
|
|
|
0
|
|
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
21
|
|
|
|
|
230
|
while ($line = <$datafile>) { # go to blank line |
70
|
42
|
|
|
|
|
83
|
chomp $line; |
71
|
42
|
|
|
|
|
86
|
$line =~ s/\r//g; |
72
|
42
|
100
|
|
|
|
186
|
last unless $line; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
21
|
|
|
|
|
112
|
while ($line = <$datafile>) { # copy sheet lines |
76
|
5191
|
100
|
|
|
|
27508
|
last if $line =~ m/$bregex/; |
77
|
5170
|
|
|
|
|
5003
|
push @{$sheetlines}, $line; |
|
5170
|
|
|
|
|
15200
|
|
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
21
|
|
|
|
|
239
|
return Spreadsheet::Engine->load_data($sheetlines); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 HISTORY |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This is a modified version of code from SocialCalc::DataFiles in |
89
|
|
|
|
|
|
|
SocialCalc 1.1.0 |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 AUTHORS |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
wikiCalc was developed by Dan Bricklin, at Software Garden, Inc. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
SocialCalc 1.1.0 was developed by Dan Bricklin, Casey West, and Tony |
96
|
|
|
|
|
|
|
Bowden, at Socialtext, Inc. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Spreadsheet::Engine is developed and maintained by Tony Bowden |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 COPYRIGHT |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Portions (c) Copyright 2005, 2006, 2007 Software Garden, Inc. |
104
|
|
|
|
|
|
|
All Rights Reserved. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Portions (c) Copyright 2007 Socialtext, Inc. |
107
|
|
|
|
|
|
|
All Rights Reserved. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Portions (c) Copyright 2007 Tony Bowden |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 LICENCE |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
The contents of this file are subject to the Artistic License 2.0; |
114
|
|
|
|
|
|
|
you may not use this file except in compliance with the License. |
115
|
|
|
|
|
|
|
You may obtain a copy of the License at |
116
|
|
|
|
|
|
|
http://www.perlfoundation.org/artistic_license_2_0 |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
|