21 |
|
# hashref from a tag call |
22 |
|
# includeparse(local_parsename, objparsename, activedoc) : copy the parse from |
23 |
|
# one object to another |
24 |
+ |
# currentparser() : return the current parser object |
25 |
|
# currentparsename([name]) : get/set current parse name |
26 |
|
# getfile(url) : get a processedfile object given a url |
27 |
|
# activatedoc(url) : Return the object ref for a doc described by the given url |
42 |
|
# parseerror(string) : Report an error during parsing a file |
43 |
|
# line() : Return the current line number of the document |
44 |
|
# and the ProcessedFileObj it is in |
45 |
+ |
# |
46 |
+ |
# -- support for inheriting classes |
47 |
+ |
# _saveactivedoc(filehandle) |
48 |
+ |
# _restoreactivedoc(filehandle) |
49 |
|
|
50 |
|
package ActiveDoc::ActiveDoc; |
51 |
|
require 5.004; |
123 |
|
} |
124 |
|
} |
125 |
|
else { |
126 |
< |
print "Cannot parse - file not known\n"; |
126 |
> |
$self->error("Cannot parse $parselabel - file not known"); |
127 |
|
} |
128 |
|
} |
129 |
|
|
130 |
|
sub currentparsename { |
131 |
|
my $self=shift; |
132 |
|
@_?$self->{currentparsename}=shift |
133 |
< |
:$self->{currentparsename}; |
133 |
> |
:(defined $self->{currentparsename}?$self->{currentparsename}:""); |
134 |
> |
} |
135 |
> |
|
136 |
> |
sub currentparser { |
137 |
> |
my $self=shift; |
138 |
> |
return $self->{currentparser}; |
139 |
|
} |
140 |
|
|
141 |
+ |
|
142 |
|
sub newparse { |
143 |
|
my $self=shift; |
144 |
|
my $parselabel=shift; |
201 |
|
$self->{File}=$self->getfile(shift); |
202 |
|
$self->verbose("url downloaded to $self->{File}"); |
203 |
|
} |
204 |
< |
$self->{File}->url(); |
204 |
> |
if ( defined $self->{File} ) { |
205 |
> |
return $self->{File}->url(); |
206 |
> |
} |
207 |
> |
else { return "undefined"; } |
208 |
|
} |
209 |
|
|
210 |
|
sub copydocconfig { |
471 |
|
@_?$self->{userinterface}=shift |
472 |
|
:$self->{userinterface} |
473 |
|
} |
474 |
+ |
|
475 |
+ |
sub _saveactivedoc { |
476 |
+ |
my $self=shift; |
477 |
+ |
my $fh=shift; |
478 |
+ |
print "Storing $self\n"; |
479 |
+ |
print $fh $self->url()."\n"; |
480 |
+ |
} |
481 |
+ |
|
482 |
+ |
sub _restoreactivedoc { |
483 |
+ |
my $self=shift; |
484 |
+ |
my $fh=shift; |
485 |
+ |
|
486 |
+ |
my $url=<$fh>; |
487 |
+ |
chomp $url; |
488 |
+ |
$self->url($url); |
489 |
+ |
} |