Re: capture exception

Peng Yonghua <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Thanks for everyone's reply.

I got the idea from 
https://stackoverflow.com/questions/4006267/what-is-the-best-way-to-handle-exceptions-in-perl 
,

The consensus of the Perl community seems to be thatTry::Tiny 
<http://search.cpan.org/perldoc?Try::Tiny>is the preferred way of doing 
exception handling. The "lenient policy" you refer to is probably due to 
a combination of:

  * Perl not being a fully object-oriented language. (e.g. in contrast
    to Java where you can't avoid dealing with exceptions.)
  * The background of many Perl developers. (Languages like C^1 and
    shell don't have exception mechanisms.)
  * The kind of tasks people tend to use Perl for. (Small scripts for
    text munging and report generation where exception handling isn't
    needed.)
  * Perl not having a (good) built-in exception mechanism.

Note that the last item means that you'll see a lot of code like this:

|eval{something()};if($@){warn "Oh no! [$@]\n";}|

That's exception handling even though it doesn't use try/catch syntax. 
It's fragile, though, and will break in a number of subtle edge cases 
that most people don't think about. Try::Tiny and the other exception 
handling modules on CPAN were written to make it easier to get right.


On 2017/6/1 星期四 0:38, Hiram Gibbard wrote:
> So when we say "from the internet" does that include intranet?  What I 
> have is a form that lists all the members of a group defined in LDAP. 
> The call to get the members for the group is all internal and our 
> companies internal ldap server. is that considered "from internet". I 
> didn't write this app, just trying to make adjustments. Currently if 
> you hit a member of the group that has been terminated/removed from 
> ldap, the app errors out because the its it a member of the group in 
> which its trying to execute a look on while listing.
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.