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

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



On Oct 22, 2012, at 2:23 PM, Justin Esbenshade <jesbenshade@omnihotels.com> wrote:
> Lot's of if's.
> 
>   my ($PN) = $PR->first_child('Customer')->first_child('PersonName');
>   if ($PN) {
>      $Res{firstName} = $PN->first_child('c:firstName')->text if ( $PN->first_child('c:firstName') );
>      $Res{lastName} = $PN->first_child('c:lastName')->text if ( $PN->first_child('c:lastName') );
>   }
> 
>   my ($A) = $PR->first_child('Addresses');
>   my ($NA) = $A->first_child('NameAddress') if ($A);
>   if ($NA) {

Thanks. I think I'm liking Try::Tiny better...?

   my ($sql, $connection, $table);
   try { $sql =        $s->first_child('sql')->text; };
   try { $connection = $s->first_child('connection')->text; };
   try { $table =      $s->first_child('table')->text; };

Ponder,

j