File/Spec/PublicationPage.pm

filter: Statementstmt 11.1% 17 / 153 Branchbran 0.0% 0 / 42 Conditioncond 0.0% 0 / 21 MC/DCmcdc 0.0% 0 / 11 Subroutinesub 13.1% 5 / 38 Podpod 100% 21 / 21 totaltotal 15.0% 43 / 286 CC 31 SCAR 39.1
CC
31
Cov
8%
splitpath
210.0
reset_document_title_section
20.0
reset_page_title_section
20.0
CRAP 49.7
« Document/PageId.pm ↑ Summary Document/TocFile.pm »
1 #=========================== PublicationPage.pm ==============================
2 # Filename: PublicationPage.pm
3 # Description: Object to parse publication filenames.
4 # Original Author: Dale Amon
5 # Revised by: $Author: amon $
6 # Date: $Date: 2008-08-31 23:41:58 $
7 # Version: $Revision: 1.4 $
8 # License: LGPL 2.1, Perl Artistic or BSD
9 #
10 #=============================================================================
11 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use DMA::FSM;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Fault::DebugPrinter;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use File::Spec::DatedPage;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 package File::Spec::PublicationPage;
17 1 ▶use vars qw{@ISA};
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 @ISA = qw( File::Spec::DatedPage );
19  
20 #=============================================================================
21 # Object Methods
22 #=============================================================================
23 # Local Lexical Analyzers for splitpath method.
24  
25 sub _noPublication
26 0 ▶ {my ($lexeme, $bb) = @_; $bb->_err("No publication name found");
Subroutine _noPublication: not called CC=1 SCAR=6.9
27 0 $bb->{'tail'} = "publication";
28 0 return (1,undef);}
29  
30 sub _getPublication
31 0 ▶ {my ($lexeme, $bb) = @_; @$bb{'publication','tail'}
Subroutine _getPublication: not called CC=1 SCAR=6.9
32 = ($lexeme,"publication");
33 0 return (1,undef);}
34  
35 sub _getPubTitleHead
36 0 ▶ {my ($lexeme, $bb) = @_;
Subroutine _getPubTitleHead: not called CC=1 SCAR=6.9
37 0 @$bb{'publication_title_head','tail'} = ($lexeme,"publication_title_head");
38 0 return (1,undef);}
39  
40 # Annotations start with a lowercase char
41 0 ▶sub _getPubSubtitles {
Subroutine _getPubSubtitles: not called CC=3 SCAR=24.8
42 0 my ($lexeme, $bb) = @_;
43 0 ▶ if ($lexeme =~ /^[^A-Z]/) {return (1,$lexeme);}
Branch: 1 branch
BranchTrueFalseTotal
if ($lexeme =~ /^[^A-Z]/) 0 0 0
44  
45 $bb->{'publication_subtitles'} .=
46 0 ▶ ((defined $bb->{'publication_subtitles'}) ? "-" : "") . $lexeme;
Branch: 1 branch
BranchTrueFalseTotal
defined $bb->{'publication_subtitles'} ? : 0 0 0
47 0 $bb->{'tail'} = "publication_subtitles";
48 0 return (0,undef);
49 }
50  
51 sub _getPubNoteHead
52 0 ▶ {my ($lexeme, $bb) = @_;
Subroutine _getPubNoteHead: not called CC=1 SCAR=6.9
53 0 @$bb{'publication_annotations','tail'}
54 = ($lexeme,"publication_annotations");
55 0 return (1,undef);}
56  
57 sub _getPubSubnotes
58 0 ▶ {my ($lexeme, $bb) = @_;
Subroutine _getPubSubnotes: not called CC=1 SCAR=6.9
59 0 $bb->{'publication_annotations'} .= "-" . $lexeme; return (1,undef);}
60  
61 sub _getPageTitleHead
62 0 ▶ {my ($lexeme, $bb) = @_;
Subroutine _getPageTitleHead: not called CC=1 SCAR=6.9
63 0 @$bb{'page_title_head','tail'} = ($lexeme,"page_title_head");
64 0 return (1,undef);}
65  
66 # Annotations start with a lowercase char
67 0 ▶sub _getPageSubtitles {
Subroutine _getPageSubtitles: not called CC=3 SCAR=24.8
68 0 my ($lexeme, $bb) = @_;
69 0 ▶ if ($lexeme =~ /^[^A-Z]/) {return (1,$lexeme);}
Branch: 1 branch
BranchTrueFalseTotal
if ($lexeme =~ /^[^A-Z]/) 0 0 0
70  
71 $bb->{'page_subtitles'} .=
72 0 ▶ ((defined $bb->{'page_subtitles'}) ? "-" : "") . $lexeme;
Branch: 1 branch
BranchTrueFalseTotal
defined $bb->{'page_subtitles'} ? : 0 0 0
73 0 $bb->{'tail'} = "page_subtitles";
74 0 return (0,undef);
75 }
76  
77 sub _getPageNoteHead
78 0 ▶ {my ($lexeme, $bb) = @_;
Subroutine _getPageNoteHead: not called CC=1 SCAR=6.9
79 0 @$bb{'page_annotations','tail'} = ($lexeme,"page_annotations");
80 0 return (1,undef);}
81  
82 sub _getPageSubnotes
83 0 ▶ {my ($lexeme, $bb) = @_;
Subroutine _getPageSubnotes: not called CC=1 SCAR=6.9
84 0 $bb->{'page_annotations'} .= "-" . $lexeme;
85 0 $bb->{'tail'} = "page_annotations";
86 0 return (1,undef);}
87  
88 0 ▶sub _noop {my ($lexeme, $bb) = @_; return (1,$lexeme);}
Subroutine _noop: not called CC=1 SCAR=6.9
89  
90 #-----------------------------------------------------------------------------
91  
92 0 ▶sub splitpath {
Subroutine splitpath: not called CC=14 SCAR=53.5
Pod documented
93 0 my ($self,$file) = (shift, shift);
94  
95 0 $self->SUPER::splitpath ($file);
96 0 Fault::DebugPrinter->dbg
97 (4,"Beginning parse for File::Spec::PublicationPage");
98
99 0 my $doctitle_fst =
100 {
101 'S0' => ["E0","SAME", \&_getPublication, "S1", "NEXT", "", ""],
102 'S1' => ["D0","SAME", \&_getPubTitleHead, "S2", "NEXT", "", ""],
103 'S2' => ["D0","SAME", \&_getPubSubtitles, "S3", "SAME", "S2", "NEXT"],
104 'S3' => ["D0","SAME", \&_getPubNoteHead, "S4", "NEXT", "", ""],
105 'S4' => ["D0","SAME", \&_getPubSubnotes, "S4", "NEXT", "", ""],
106 'E0' => ["E0","FAIL", \&_noPublication, "", "", "", ""],
107 'D0' => ["D0","DONE", \&_noop, "", "", "", ""],
108 };
109  
110 0 my $pagetitle_fst =
111 {
112 'S0' => ["D0","SAME", \&_getPageTitleHead,"S1", "NEXT", "S1", "NEXT"],
113 'S1' => ["D0","SAME", \&_getPageSubtitles,"S2", "SAME", "S1", "NEXT"],
114 'S2' => ["D0","SAME", \&_getPageNoteHead, "S3", "NEXT", "S3", "NEXT"],
115 'S3' => ["D0","SAME", \&_getPageSubnotes, "S3", "NEXT", "S3", "NEXT"],
116 'E0' => ["E0","FAIL", \&_noop, "", "", "", ""],
117 'D0' => ["D0","DONE", \&_noop, "", "", "", ""],
118 };
119  
120 # Append the extensions onto the end of the last entity
121 0 ▶ LEXANAL: while ($_=$self->{'tail'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ = $self->{"tail"}) 0 0 0
122 0 ▶ if (/document_title_section/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/document_title_section/) 0 0 0
123 0 $self->{'document_title_section'} = $self->_append_extensions_to_tail;
124 0 last;
125 }
126 0 ▶ if (/page_title_section/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/page_title_section/) 0 0 0
127 0 $self->{'page_title_section'} = $self->_append_extensions_to_tail;
128 0 last;
129 }
130 }
131  
132 my @doctitle_remaining =
133 DMA::FSM::FSM ($doctitle_fst, $self,
134 0 split (/-/, $self->{'document_title_section'}));
135  
136 my @pagetitle_remaining
137 = DMA::FSM::FSM ($pagetitle_fst, $self,
138 split (/-/, $self->{'page_title_section'}))
139 0 ▶ if (defined $self->{'page_title_section'});
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"page_title_section"} 0 0 0
140 0 delete $self->{'state'};
141  
142 # If page or document_title sections were the tailpart, see if it has
143 # trailing extensions. If the tailpart were pages, there could not have
144 # been anything leftover.
145 #
146 LEXANAL: {
147 0 $_=$self->{'tail'};
148 0 ▶ if (/publication/ ||
Branch: 1 branch
BranchTrueFalseTotal
if (/publication/ or /publication_title_head/ or /publication_subtitles/ or /publication_annotations/) 0 0 0
Condition0%0/9
/publication/ or /publication_title_head/ or /publication_subtitles/ or /publication_annotations/
l!l&&r!l&&!r
000
/publication/ or /publication_title_head/ or /publication_subtitles/
l!l&&r!l&&!r
000
/publication/ or /publication_title_head/
l!l&&r!l&&!r
000
MC/DC0%0/4
/publication/ or /publication_title_head/ or /publication_subtitles/ or /publication_annotations/
/publication/ /publication_title_head/ /publication_subtitles/ /publication_annotations/
Truth table0%0/5
A or B or C or D
A= /publication/B= /publication_title_head/C= /publication_subtitles/D= /publication_annotations/
ABCDresult
1XXX1
01XX1
001X1
00011
00000
149 /publication_title_head/ ||
150 /publication_subtitles/ ||
151 /publication_annotations/) {
152 0 my $lpar = $self->_parse_extensions_from_tail;
153 0 ▶ $self->{$_} = ($lpar) ? $lpar : undef;
Branch: 1 branch
BranchTrueFalseTotal
$lpar ? : 0 0 0
154 0 $self->reset_document_title_section;
155 0 $self->reset_name_body;
156 0 $self->reset_name;
157 0 last;
158 }
159 0 ▶ if (/page_title_head/ ||
Branch: 1 branch
BranchTrueFalseTotal
if (/page_title_head/ or /page_subtitles/ or /page_annotations/) 0 0 0
Condition0%0/6
/page_title_head/ or /page_subtitles/ or /page_annotations/
l!l&&r!l&&!r
000
/page_title_head/ or /page_subtitles/
l!l&&r!l&&!r
000
MC/DC0%0/3
/page_title_head/ or /page_subtitles/ or /page_annotations/
/page_title_head/ /page_subtitles/ /page_annotations/
Truth table0%0/4
A or B or C
A= /page_title_head/B= /page_subtitles/C= /page_annotations/
ABCresult
1XX1
01X1
0011
0000
160 /page_subtitles/ ||
161 /page_annotations/) {
162 0 my $lpar = $self->_parse_extensions_from_tail;
163 0 ▶ $self->{$_} = ($lpar) ? $lpar : undef;
Branch: 1 branch
BranchTrueFalseTotal
$lpar ? : 0 0 0
164 0 $self->reset_page_title_section;
165 0 $self->reset_name_body;
166 0 $self->reset_name;
167 0 last;
168 }
169 }
170  
171 return (@$self{'volume','basepath','directory',
172 'startdate','enddate',
173 'publication',
174 'publication_title_head','publication_subtitles',
175 'publication_annotations',
176 'startpage','endpage',
177 'page_title_head','page_subtitles','page_annotations'},
178 0 @{$self->{'extensions'}});
179 }
180  
181 #-----------------------------------------------------------------------------
182 # Set parts of document_title_section.
183  
184 0 ▶sub set_publication {my $s=shift; @$s{'publication','_dirty'}=(shift,1);
Subroutine set_publication: not called CC=1 SCAR=6.9
Pod documented
185 0 return $s;}
186  
187 sub set_publication_title_head
188 0 ▶ {my $s=shift; @$s{'publication_title_head',
Subroutine set_publication_title_head: not called CC=1 SCAR=6.9
Pod documented
189 '_dirty'}=(shift,1);
190 0 return $s;}
191  
192 sub set_publication_subtitles
193 0 ▶ {my $s=shift; @$s{'publication_subtitles',
Subroutine set_publication_subtitles: not called CC=1 SCAR=6.9
Pod documented
194 '_dirty'}=(shift,1);
195 0 return $s;}
196  
197 sub set_publication_annotations
198 0 ▶ {my $s=shift; @$s{'publication_annotations',
Subroutine set_publication_annotations: not called CC=1 SCAR=6.9
Pod documented
199 '_dirty'}=(shift,1);
200 0 return $s;}
201  
202 #-----------------------------------------------------------------------------
203 # Set parts of page_title_section
204  
205 sub set_page_title_head
206 0 ▶ {my $s=shift; @$s{'page_title_head',
Subroutine set_page_title_head: not called CC=1 SCAR=6.9
Pod documented
207 '_dirty'}=(shift,1);
208 0 return $s;}
209  
210 sub set_page_subtitles
211 0 ▶ {my $s=shift; @$s{'page_subtitles',
Subroutine set_page_subtitles: not called CC=1 SCAR=6.9
Pod documented
212 '_dirty'}=(shift,1);
213 0 return $s;}
214  
215 sub set_page_annotations
216 0 ▶ {my $s=shift; @$s{'page_annotations',
Subroutine set_page_annotations: not called CC=1 SCAR=6.9
Pod documented
217 '_dirty'}=(shift,1);
218 0 return $s;}
219  
220 #-----------------------------------------------------------------------------
221  
222 0 ▶sub reset_document_title_section {
Subroutine reset_document_title_section: not called CC=4 SCAR=30.0
Pod documented
223 0 my $self = shift;
224 0 my ($title,$del) = ("","");
225 0 my (@list) = (@$self{'publication','publication_title_head',
226 'publication_subtitles','publication_annotations'});
227 0 foreach (@list) {
228 0 ▶ $_ || next;
Branch: 1 branch
BranchTrueFalseTotal
$_ or next 0 0 0
229 0 $title .= "$del$_"; $del = "-";
230 }
231 0 ▶ return $self->{'document_title_section'} = ($title) ? $title : undef;
Branch: 1 branch
BranchTrueFalseTotal
$title ? : 0 0 0
232 }
233  
234 #-----------------------------------------------------------------------------
235  
236 0 ▶sub reset_page_title_section {
Subroutine reset_page_title_section: not called CC=4 SCAR=30.0
Pod documented
237 0 my $self = shift;
238 0 my ($pagesection,$del) = ("","");
239 0 my (@list) = (@$self{'page_title_head',
240 'page_subtitles','page_annotations'});
241 0 foreach (@list) {
242 0 ▶ $_ || next;
Branch: 1 branch
BranchTrueFalseTotal
$_ or next 0 0 0
243 0 $pagesection .= "$del$_"; $del = "-";
244 }
245 0 ▶ return $self->{'page_title_section'}
Branch: 1 branch
BranchTrueFalseTotal
$pagesection ? : 0 0 0
246 = ($pagesection) ? $pagesection : undef;
247 }
248  
249 #-----------------------------------------------------------------------------
250  
251 0 ▶sub publication {return shift->{'publication'};}
Subroutine publication: not called CC=1 SCAR=6.9
Pod documented
252 0 ▶sub publication_title_head {return shift->{'publication_title_head'};}
Subroutine publication_title_head: not called CC=1 SCAR=6.9
Pod documented
253 0 ▶sub publication_subtitles {return shift->{'publication_subtitles'};}
Subroutine publication_subtitles: not called CC=1 SCAR=6.9
Pod documented
254 0 ▶sub publication_annotations {return shift->{'publication_annotations'};}
Subroutine publication_annotations: not called CC=1 SCAR=6.9
Pod documented
255 0 ▶sub page_title_head {return shift->{'page_titles_head'};}
Subroutine page_title_head: not called CC=1 SCAR=6.9
Pod documented
256 0 ▶sub page_subtitles {return shift->{'page_subtitles'};}
Subroutine page_subtitles: not called CC=1 SCAR=6.9
Pod documented
257 0 ▶sub page_annotations {return shift->{'page_annotations'};}
Subroutine page_annotations: not called CC=1 SCAR=6.9
Pod documented
258 0 ▶sub fulltitle {return shift->{'page_title_section'};}
Subroutine fulltitle: not called CC=1 SCAR=6.9
Pod documented
259  
260 #-----------------------------------------------------------------------------
261  
262 0 ▶sub publication_title_section {
Subroutine publication_title_section: not called CC=4 SCAR=30.0
Pod documented
263 0 my $self = shift;
264 my ($title,$subtitle,$notes) =
265 0 (@$self{'publication_title_head',
266 'publication_subtitles',
267 'publication_annotations'});
268 0 ▶ defined $title || (return undef);
Branch: 1 branch
BranchTrueFalseTotal
defined $title or return undef 0 0 0
269  
270 0 my $full = $title;
271 0 ▶ defined $subtitle && ($full .= "-$subtitle");
Branch: 1 branch
BranchTrueFalseTotal
defined $subtitle and $full .= "-$subtitle" 0 0 0
272 0 ▶ defined $notes && ($full .= "-$notes");
Branch: 1 branch
BranchTrueFalseTotal
defined $notes and $full .= "-$notes" 0 0 0
273 0 return $full;
274 }
275  
276 #-----------------------------------------------------------------------------
277  
278 0 ▶sub issuename {
Subroutine issuename: not called CC=3 SCAR=24.8
Pod documented
279 0 my $self = shift;
280 0 my ($dates,$publication) = ($self->dates, $self->{'publication'});
281 0 ▶ ((defined $dates) && (defined $publication)) || (return undef);
Branch: 1 branch
BranchTrueFalseTotal
defined $dates and defined $publication or return undef 0 0 0
Condition0%0/3
defined $dates and defined $publication
!ll&&!rl&&r
000
MC/DC0%0/2
defined $dates and defined $publication
defined $dates defined $publication
Truth table0%0/3
A and B
A= defined $datesB= defined $publication
ABresult
0X0
100
111
282  
283 0 return "$dates-$publication";
284 }
285  
286 #-----------------------------------------------------------------------------
287  
288 0 ▶sub pagename {
Subroutine pagename: not called CC=3 SCAR=24.8
Pod documented
289 0 my $self = shift;
290 0 my ($issue,$pages) = ($self->issuename, $self->pages);
291 0 ▶ ((defined $issue) && (defined $pages)) ||
Branch: 1 branch
BranchTrueFalseTotal
defined $issue and defined $pages or return undef 0 0 0
Condition0%0/3
defined $issue and defined $pages
!ll&&!rl&&r
000
MC/DC0%0/2
defined $issue and defined $pages
defined $issue defined $pages
Truth table0%0/3
A and B
A= defined $issueB= defined $pages
ABresult
0X0
100
111
292 (return undef);
293  
294 0 return "$issue-p$pages";
295 }
296  
297 #=============================================================================
298 # INTERNAL: Object Methods
299 #=============================================================================
300  
301 0 ▶sub _init {
Subroutine _init: not called CC=1 SCAR=6.9
302 0 my $self = shift;
303 0 $self->SUPER::_init;
304 0 @$self{'publication',
305 'publication_title_head','publication_subtitles',
306 'publication_annotations',
307 'page_title_head','page_subtitles','page_annotations'} =
308 (undef,
309 undef,undef,
310 undef,
311 undef,undef,undef);
312 }
313
314 #=============================================================================
315 # Pod Documentation
316 #=============================================================================
317 # You may extract and format the documention section with the 'perldoc' cmd.
318  
319 =head1 NAME
320  
321 File::Spec::PublicationPage - Parse a dated and page numbered archive file name in a system independant way.
322  
323 =head1 SYNOPSIS
324  
325 use File::Spec::PublicationPage;
326  
327 ($volume, $basepath, $directory,
328 $startdate, $enddate, $publication,
329 $publication_title_head, $publication_subtitles, $publication_annotations,
330 $startpage, $endpage,
331 $page_title_head, $page_subtitles, $page_annotations,
332 @extensions) = $obj->splitpath ($filepath);
333  
334 $publication_title_section = $obj->publication_title_section;
335 $publication = $obj->publication;
336 $publication_title_head = $obj->publication_title_head;
337 $publication_subtitles = $obj->publication_subtitles;
338 $publication_annotations = $obj->publication_annotations;
339 $page_title_head = $obj->page_title_head;
340 $page_subtitles = $obj->page_subtitles;
341 $page_annotations = $obj->page_annotations;
342 $page_title_section = $obj->fulltitle;
343 $pagename = $obj->pagename;
344 $issuename = $obj->issuename;
345  
346 $obj = $obj->set_publication ($publication);
347 $obj = $obj->set_publication_title_head ($publication_title_head);
348 $obj = $obj->set_publication_subtitles ($publication_subtitles);
349 $obj = $obj->set_publication_annotations ($publication_annotations);
350 $obj = $obj->set_page_title_head ($page_title_head);
351 $obj = $obj->set_page_subtitles ($page_subtitles);
352 $obj = $obj->set_page_annotations ($page_annotations);
353  
354 $publication_title_sections = $obj->reset_document_title_section;
355 $page_title_sections = $obj->reset_page_title_section;
356  
357 =head1 Inheritance
358  
359 UNIVERSAL
360 File::Spec::Unix
361 File::Spec::BaseParse
362 File::Spec::Dated
363 File::Spec::DatedPage
364 File::Spec::PublicationPage
365  
366 =head1 Description
367  
368 Further splits a pathname string from what it's parent classes have already
369 done. Using the example publication_title_section string,
370 XMAS-Title-Subtitle-note, it will be broken down further as:
371  
372 publication: XMAS
373 publication_title_head: Title
374 publication_subtitles: Subtitle
375 publication_annotations: note
376 page_title_head: undef
377 page_subtitles: undef
378 page_annotations: undef
379  
380 Ordering is used in this parsing. The first "-" delimited element in the
381 name_body is the publication name; the second is the main title of the
382 article; the third and remaining items are subtitles of the article unless
383 the first character is lower case, in which case it is taken to be a local
384 annotation.
385  
386 Such annotations are useful for adding key words to the file name so that
387 Unix locate and find will be more useful. One might have added
388 "-iranStudentRebellion" if the publication or page title did not mention
389 Iran and one wished to be able to locate all files with information about
390 Iran.
391  
392 =head1 Examples
393  
394 use File::Spec::PublicationPage;
395  
396 my $baz = File::Spec::PublicationPage->new;
397 my @list = $baz->splitpath
398 ("/my/base/Cards/19901225-XMAS-Title-Subtitle-note.tar.gz");
399  
400 my $foo = File::Spec::PublicationPage->new
401 ("/my/base/Cards/19901225-XMAS-Title-Subtitle-note.tar.gz");
402  
403 my $startpage = $foo->startpage;
404 my $endpage = $foo->endpage;
405 my $pages = $foo->pages;
406 my $pagename = $foo->pagename;
407 my $publication = $foo->publication;
408 my $pubsection = $foo->publication_title_section;
409 my $dtitle_head = $foo->publication_title_head;
410 my $dsubtitle = $foo->publication_subtitles;
411 my $dnotes = $foo->publication_annotations;
412 my $pgsection = $foo->fulltitle;
413 my $ptitle_head = $foo->page_title_head;
414 my $psubtitle = $foo->page_subtitles;
415 my $pnotes = $foo->page_annotations;
416  
417 $foo->set_publication ("JournalOfIrreproduceableResults");
418 $foo->set_publication_title_head ("QuantumBubbling" );
419 $foo->set_publication_subtitles ("ThePintEffect");
420 $foo->set_publication_annotations ("allTheTimeInTheworldInAGuinness");
421  
422 $foo->set_page_title_head ("TheCat );
423 $foo->set_page_subtitles ("DeadOrAlive");
424 $foo->set_page_annotations ("whatWillPetaSay");
425  
426 my $docsection = $foo->reset_document_title_section;
427 my $pgsection = $foo->reset_page_title_section;
428 my $name_body = $foo->reset_name_body;
429 my $name = $foo->reset_name;
430 my $filename = $foo->reset_filename;
431 my $filepath = $foo->reset_pathname;
432 my @parts = $foo->reparse;
433  
434 =head1 Class Variables
435  
436 None.
437  
438 =head1 Instance Variables
439  
440 publication Name of the publication
441 publication_title_head The primary title of the whole document.
442 publication_subtitles Subtitles of the whole document.
443 publication_annotations Annotations on the whole document.
444 page_title_head The primary title of the page.
445 page_subtitles Subtitles of the page.
446 page_annotations Annotations on the page.
447  
448 =head1 Class Methods
449  
450 None.
451  
452 =head1 Instance Methods
453  
454 =over 4
455  
456 =item B<$page_title_section = $obj-E<gt>fulltitle>
457  
458 Return a $page_full_title string , eg "MainTitle",
459 "MainTitle-SubtitleOne-SubtitleTwo". "MainTitle-OnlySubtitle-firstNote" or
460 perhaps "MainTitle-firstNote-secondNote".
461  
462 undef if there is no page title information associated with this filespec.
463  
464 =item B<$issuename = $obj-E<gt>issuename>
465  
466 Return a $issuename string , eg "20021225-NewScientist".
467  
468 undef if there the date string or publication name is unavailable. Both are
469 required.
470  
471 =item B<$page_annotations = $obj-E<gt>page_annotations>
472  
473 Return the page annotations string.
474  
475 =item B<$page_subtitles = $obj-E<gt>page_subtitles>
476  
477 Return the page subtitles string.
478  
479 =item B<$page_title_head = $obj-E<gt>page_title_head>
480  
481 Return the page main title string.
482  
483 =item B<$pagename = $obj-E<gt>pagename>
484  
485 Return the page name string, eg "20021225-NewScientist-p010" or undef if the
486 date string, publication name or pageid string is unavailable. All are
487 required.
488  
489 =item B<$publication = $obj-E<gt>publication>
490  
491 Return the publication name string.
492  
493 =item B<$publication_annotations = $obj-E<gt>publication_annotations>
494  
495 Return the publication annotations string.
496  
497 =item B<$publication_subtitles = $obj-E<gt>publication_subtitles>
498  
499 Return the publication subtitles string.
500  
501 =item B<$publication_title_head = $obj-E<gt>publication_title_head>
502  
503 Return the publication main title string.
504  
505 =item B<$publication_title_section = $obj-E<gt>publication_title_section>
506  
507 Return the publication_title_section string:
508  
509 "publication-title-head publication-subtitles publications-annotations"
510  
511 or whatever portion is available. Return undef if there is none.
512  
513 =item B<$publication_title_sections = $obj-E<gt>reset_document_title_section >
514  
515 Regenerate the document_title_section from pieces:
516  
517 publication + publication_title_head + publication_subtitles +
518 publication_annotations -> document_title_section
519  
520 =item B<$page_title_sections = $obj-E<gt>reset_page_title_section >
521  
522 Regenerate the page_title_section from pieces:
523  
524 page_title_head + page_subtitles + page_annotations -> page_title_section
525  
526 =item B<$obj = $obj-E<gt>set_publication ($publication)>
527  
528 Unconditionally set the publication name.
529  
530 =item B<$obj = $obj-E<gt>set_publication_annotations ($publication_annotations)>
531  
532 Unconditionally set the publication annotations.
533  
534 =item B<$obj = $obj-E<gt>set_publication_subtitles ($publication_subtitles)>
535  
536 Unconditionally set the publication subtitles.
537  
538 =item B<$obj = $obj-E<gt>set_publication_title_head ($publication_title_head)>
539  
540 Unconditionally set the publication_title_head.
541  
542 =item B<$obj = $obj-E<gt>set_page_annotations ($page_annotations)>
543  
544 Unconditionally set the page annotations.
545  
546 =item B<$obj = $obj-E<gt>set_page_subtitles ($page_subtitles)>
547  
548 Unconditionally set the page subtitles.
549  
550 =item B<$obj = $obj-E<gt>set_page_title_head ($page_title_head)>
551  
552 Unconditionally set the page_title_head.
553  
554 =item B<($volume, $basepath, $directory, $startdate, $enddate, $publication, $publication_title_head, $publication_subtitles, $publication_annotations, $startpage, $endpage, $page_title_head, $page_subtitles, $page_annotations, @extensions) = $obj-E<gt>splitpath ($filepath)>
555  
556 Override and chain the parent method. Parses the filename into:
557  
558 {firstdate{-lastdate}}{-publication
559 {-publication_title_head}{-publication_subtitles}{-publication_annotations}}
560 {-startpage{-endpage}}
561 {-page_title_head}{-page_subtitles}{-page_annotations}}{.extensions}
562  
563 Returns all the elements of the pathname as a list. Completely reinitializes
564 the object for the name $filepath.
565  
566 =back 4
567  
568 =head1 Private Class Methods
569  
570 None.
571  
572 =head1 Private Instance Methods
573  
574 =over 4
575  
576 =item B<$obj = $obj-E<gt>_init>
577  
578 Internal initializer.
579  
580 This method is for the subclass initializer chaining and should not be used
581 otherwise.
582  
583 =back 4
584  
585 =head1 KNOWN BUGS
586  
587 See TODO.
588  
589 =head1 SEE ALSO
590  
591 DMA::FSM, Fault::DebugPrinter, File::Spec::DatedPage
592  
593 =head1 AUTHOR
594  
595 Dale Amon <amon@vnl.com>
596  
597 =cut
598
599 #=============================================================================
600 # CVS HISTORY
601 #=============================================================================
602 # $Log: PublicationPage.pm,v $
603 # Revision 1.4 2008-08-31 23:41:58 amon
604 # Fixed doc title problem, one colon where two were needed by CPAN.
605 #
606 # Revision 1.3 2008-08-28 23:32:45 amon
607 # perldoc section regularization.
608 #
609 # Revision 1.2 2008-08-16 17:49:06 amon
610 # Update source format, documentation; switch to Fault package
611 #
612 # Revision 1.1.1.1 2004-08-30 23:43:26 amon
613 # File Spec extensions for doc name formats.
614 #
615 # 20040821 Dale Amon <amon@islandone.org>
616 # Switched to Finite State Machine for parsing.
617 #
618 # 20040820 Dale Amon <amon@islandone.org>
619 # Split Archivist specific portions out of
620 # File::Spec::DatedPage to form
621 # File::Spec::PublicationPage
622 #
623 # 20040815 Dale Amon <amon@islandone.org>
624 # Changed from Archivist::PublicationSpec to
625 # File::Spec::PublicationPage
626 #
627 # 20021208 Dale Amon <amon@vnl.com>
628 # Hacked it apart into a Class hierarchy.
629 #
630 # 20021121 Dale Amon <amon@vnl.com>
631 # Created.
632 #
633 1 1;
« Document/PageId.pm ↑ Summary Document/TocFile.pm »