[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] Fwd: XML::Twig error handling



Ah, yes! thanks! 

Begin forwarded message:
From: Patrick Baker <pbaker0804@gmail.com>
Subject: Re: [Omaha.pm] XML::Twig error handling
Date: October 24, 2012 12:26:09 PM CDT
To: Jay Hannah <jay@jays.net>

I use try { } catch { }; now, it seems cleaner to me.

   try {
      $twig->parse($request);
      $self->request($twig);
      my ($Body) = $twig->get_xpath("${soap_base}:Body");
      my ($request) = $Body->first_child('GroupPricing');
      $self->type($request->tag);
   } catch {
           $self->set_SOAP_Fault( faultstring => "Invalid message.",
                             detail      => '<![CDATA[' . $_ . "\n" . $request . ']]>' );
  }