author | MattD <mattd@symbian.org> |
Tue, 04 Aug 2009 14:40:11 +0100 | |
changeset 307 | 989c70555820 |
permissions | -rw-r--r-- |
307
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
1 |
package XML::SAX::Exception; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
2 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
3 |
use strict; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
4 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
5 |
use overload '""' => "stringify", |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
6 |
'fallback' => 1; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
7 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
8 |
use vars qw/$StackTrace $VERSION/; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
9 |
$VERSION = '1.01'; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
10 |
use Carp; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
11 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
12 |
$StackTrace = $ENV{XML_DEBUG} || 0; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
13 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
14 |
# Other exception classes: |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
15 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
16 |
@XML::SAX::Exception::NotRecognized::ISA = ('XML::SAX::Exception'); |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
17 |
@XML::SAX::Exception::NotSupported::ISA = ('XML::SAX::Exception'); |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
18 |
@XML::SAX::Exception::Parse::ISA = ('XML::SAX::Exception'); |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
19 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
20 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
21 |
sub throw { |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
22 |
my $class = shift; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
23 |
if (ref($class)) { |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
24 |
die $class; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
25 |
} |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
26 |
die $class->new(@_); |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
27 |
} |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
28 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
29 |
sub new { |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
30 |
my $class = shift; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
31 |
my %opts = @_; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
32 |
confess "Invalid options: " . join(', ', keys %opts) unless exists $opts{Message}; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
33 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
34 |
bless { ($StackTrace ? (StackTrace => stacktrace()) : ()), %opts }, |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
35 |
$class; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
36 |
} |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
37 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
38 |
sub stringify { |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
39 |
my $self = shift; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
40 |
local $^W; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
41 |
my $error; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
42 |
if (exists $self->{LineNumber}) { |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
43 |
$error = $self->{Message} . " [Ln: " . $self->{LineNumber} . |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
44 |
", Col: " . $self->{ColumnNumber} . "]"; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
45 |
} |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
46 |
else { |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
47 |
$error = $self->{Message}; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
48 |
} |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
49 |
if ($StackTrace) { |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
50 |
$error .= stackstring($self->{StackTrace}); |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
51 |
} |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
52 |
$error .= "\n"; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
53 |
return $error; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
54 |
} |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
55 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
56 |
sub stacktrace { |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
57 |
my $i = 2; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
58 |
my @fulltrace; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
59 |
while (my @trace = caller($i++)) { |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
60 |
my %hash; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
61 |
@hash{qw(Package Filename Line)} = @trace[0..2]; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
62 |
push @fulltrace, \%hash; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
63 |
} |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
64 |
return \@fulltrace; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
65 |
} |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
66 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
67 |
sub stackstring { |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
68 |
my $stacktrace = shift; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
69 |
my $string = "\nFrom:\n"; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
70 |
foreach my $current (@$stacktrace) { |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
71 |
$string .= $current->{Filename} . " Line: " . $current->{Line} . "\n"; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
72 |
} |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
73 |
return $string; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
74 |
} |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
75 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
76 |
1; |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
77 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
78 |
__END__ |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
79 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
80 |
=head1 NAME |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
81 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
82 |
XML::SAX::Exception - Exception classes for XML::SAX |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
83 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
84 |
=head1 SYNOPSIS |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
85 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
86 |
throw XML::SAX::Exception::NotSupported( |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
87 |
Message => "The foo feature is not supported", |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
88 |
); |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
89 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
90 |
=head1 DESCRIPTION |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
91 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
92 |
This module is the base class for all SAX Exceptions, those defined in |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
93 |
the spec as well as those that one may create for one's own SAX errors. |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
94 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
95 |
There are three subclasses included, corresponding to those of the SAX |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
96 |
spec: |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
97 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
98 |
XML::SAX::Exception::NotSupported |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
99 |
XML::SAX::Exception::NotRecognized |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
100 |
XML::SAX::Exception::Parse |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
101 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
102 |
Use them wherever you want, and as much as possible when you encounter |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
103 |
such errors. SAX is meant to use exceptions as much as possible to |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
104 |
flag problems. |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
105 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
106 |
=head1 CREATING NEW EXCEPTION CLASSES |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
107 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
108 |
All you need to do to create a new exception class is: |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
109 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
110 |
@XML::SAX::Exception::MyException::ISA = ('XML::SAX::Exception') |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
111 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
112 |
The given package doesn't need to exist, it'll behave correctly this |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
113 |
way. If your exception refines an existing exception class, then you |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
114 |
may also inherit from that instead of from the base class. |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
115 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
116 |
=head1 THROWING EXCEPTIONS |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
117 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
118 |
This is as simple as exemplified in the SYNOPSIS. In fact, there's |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
119 |
nothing more to know. All you have to do is: |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
120 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
121 |
throw XML::SAX::Exception::MyException( Message => 'Something went wrong' ); |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
122 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
123 |
and voila, you've thrown an exception which can be caught in an eval block. |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
124 |
|
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
125 |
=cut |
989c70555820
raptor parser.pl - adding XML::SAX perl modules (public domain code - http://www.saxproject.org/faq.html) so we don't have to patch up every single build machine.
MattD <mattd@symbian.org>
parents:
diff
changeset
|
126 |