Skip to main content.
home | support | download

Back to List Archive

Re: Avoiding errors for missing properties

From: Keith Ivey <keith(at)not-real.smokefreedc.org>
Date: Thu Jul 08 2004 - 15:16:33 GMT
Tac wrote:

>How can I stop an error from trying to get a non-existent property from the
>perl API?  I'm particular, I have
> 
>            $result->Property( "year" ),
>

You just need to wrap it in an eval block and handle the exception:

    my $year = eval { $result->Property("year") };
    if ($@) {
        # Do something with the error
    }

-- 
Keith Ivey <keith@smokefreedc.org>
Washington, DC
Received on Thu Jul 8 08:16:52 2004