Skip to content

Commit

Permalink
correct name (SAX, not Sax) and load separately for better messages
Browse files Browse the repository at this point in the history
  • Loading branch information
xsawyerx committed Nov 4, 2010
1 parent 4cf24d0 commit 02e8767
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions lib/Dancer/Serializer/XML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,22 @@ sub to_xml {

# class definition

sub loaded {
# we need either XML::Parser or XML::Sax too
Dancer::ModuleLoader->load('XML::Simple') &&
(
Dancer::ModuleLoader->load('XML::Parser') or
Dancer::ModuleLoader->load('XML::Sax')
);
sub loaded_xmlsimple {
Dancer::ModuleLoader->load('XML::Simple');
}

sub loaded_xmlbackends {
# we need either XML::Parser or XML::SAX too
Dancer::ModuleLoader->load('XML::Parser') or
Dancer::ModuleLoader->load('XML::SAX');
}

sub init {
my ($self) = @_;
die 'XML::Simple is needed and is not installed'
unless $self->loaded;
unless $self->loaded_xmlsimple;
die 'XML::Simple needs XML::Parser or XML::SAX and neither is installed'
unless $self->loaded_xmlbackends;
$_xs = XML::Simple->new();
}

Expand Down

0 comments on commit 02e8767

Please sign in to comment.