1 | package cf::pod; |
1 | package cf::pod; |
|
|
2 | |
|
|
3 | use Pod::POM; |
2 | |
4 | |
3 | our $indent; |
5 | our $indent; |
4 | our $level; |
6 | our $level; |
5 | our @result; |
7 | our @result; |
6 | |
8 | |
… | |
… | |
146 | |
148 | |
147 | ############################################################################# |
149 | ############################################################################# |
148 | |
150 | |
149 | package cf::pod; |
151 | package cf::pod; |
150 | |
152 | |
151 | sub as_paragraphs($) { |
153 | sub pom_as_paragraphs($) { |
152 | my ($pom) = @_; |
154 | my ($pom) = @_; |
153 | |
155 | |
154 | # we suckers use global variables, unfortunately. |
156 | # we suckers use global variables, unfortunately. |
155 | my $guard = cf::lock_acquire "cf::pod::as_paragraphs"; |
157 | my $guard = cf::lock_acquire "cf::pod::as_paragraphs"; |
156 | |
158 | |
… | |
… | |
161 | $pom->present ("cf::pod::AsParagraphs"); |
163 | $pom->present ("cf::pod::AsParagraphs"); |
162 | |
164 | |
163 | [grep $_->{index} || exists $_->{markup}, @result] |
165 | [grep $_->{index} || exists $_->{markup}, @result] |
164 | } |
166 | } |
165 | |
167 | |
|
|
168 | sub load_pod($) { |
|
|
169 | my ($path) = @_; |
|
|
170 | |
|
|
171 | Coro::Storable::thaw cf::cache "cf::pod::as_paragraphs/$path" => [$path], |
|
|
172 | 1 => sub { |
|
|
173 | my ($src) = @_; |
|
|
174 | fork_exec { |
|
|
175 | my $pod = $src->[0]; |
|
|
176 | utf8::decode $pod; |
|
|
177 | Coro::Storable::freeze pom_as_paragraphs Pod::POM->new->parse_text ($pod) |
|
|
178 | } |
|
|
179 | }; |
|
|
180 | } |
|
|
181 | |
166 | 1; |
182 | 1; |
167 | |
183 | |