Exception::Like

Exception-like Error Checking
Download

Exception::Like Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Other/Proprietary Li...
  • Price:
  • FREE
  • Publisher Name:
  • Ziya Suzen
  • Publisher web site:
  • http://search.cpan.org/~ziya/

Exception::Like Tags


Exception::Like Description

Exception-like Error Checking Instead of using try-cacth method, the Exception::Like Perl module relies on good old return-value-check method. But gives its users the chance to identify error types as in handling exceptions, and stacking errors.SYNOPSIS #Package file: package Exception::LikeTest; use Exception::Like MyException=>'This is my exception'; use strict; sub new { my $this = shift; my $class = ref($this) || $this; my $self = bless {}, $class; return $self; } sub fails { err(MyException,'just felt like erroring'); return; } #Program file: use Exception::LikeTest; $a = new Exception::LikeTest; $r = $a->fails(); unless ($r) { # Error ocured! if ($a->errno() eq MyException) { warn MyException, " occured.\n"; } else { die $a->errstr(); } } #To list all the defined Exceptions (or Error IDs) use Exception::Like; print "$_\n" for Exception::Like->list_defined_exceptions(); Requirements: · Perl


Exception::Like Related Software