I just realized that you can use deterministic finalization in Perl just like C++. Yay!
{
package Brackets;
# my first attempt to use determinsitic finalization in Perl;
sub name {
my $self = {};
$self->{name} = shift @_;
bless $self;
print "{name}>\n";
return $self;
}
sub DESTROY {
my $self = shift @_;
print "{name}>\n";
}
}
Note that I use my "pseudo-XML" notation:
<TEST START name>
...
</TEST END name>
It's not nice to violate the standard, but IMHO this is a alot easirr to read than
<TEST context="START" name="name">
...
</TEST context="END" name="name">
and readability is a concern - since I plop these things in test output read by my human coworkers.
Human coworkers who really don't like XML because it is so ugly.
I can readily translate my pseudo XML into real XML, in case I wanted to use any real XML tools.
And can do many operations without such translation.
Unfortunately, there aren't many real XML tools to be used withot a lot of work :-(.
I need to fix up my pseudo-XML UNIX command line tools, suitable fr use in pipezs and so on.
No comments:
Post a Comment