DESCRIPTION

RoPkg::Exceptions is a collection of predefined exceptions used by all modules from RoPkg namespace.

SYNOPSIS

 #!/usr/bin/perl

use strict; use warnings;

use RoPkg::Exceptions;

sub main { eval { if ( $#ARGV == -1 ) { Param::Missing->throw('No parameter found'); } };

if ( my $e = Exception::Class->caught('Param::Missing') ) { print STDERR $e->message,$/,$e->trace,$/; } }

main();

It is very possible that you don't find a good reason for using exceptions from this example. And you are right. This example is kind of silly. But, try to use exceptions in a real project. Then, you will apreciate their real value.

DEPENDENCIES

RoPkg::Exceptions require perl 5.008 or later and the Exception::Class module.

Exceptions List

The following exceptions are defined in this class:

*) General - general pourpose exception
*) OutsideClass - raised when a method is called outside a class instance
*) File - the base for all file related exceptions . This exception has the filename parameter, who can be used to specify the path to the file. filename parameter can be used by all derivated exceptions. The following exceptions are derivated from File:
*) File::NotFound - the file was not found
*) File::Open - error while opening file
*) File::Create - could not create file
*) Dir - the base for all directory related exceptions . This exception has the dirname parameter, who can be used to specify the path to the directory. dirname parameter can be used by all derivated exceptions. The following exceptions are derivated from Dir:
*) Dir::NotFound - the directory was not found
*) Dir::Open - error while opening directory
*) Dir::Create - could not create directory
*) Param - the base for all parameters related exceptions. This exception has the name parameter, who can be used to specify the parameter name. name can be used by all derivated exceptions. The following exceptions are derivated from Param:
*) Param::Missing - the parameter was not found
*) Param::Unknown - the parameter is unknown
*) Param::Wrong - the parameter has the wrong value or is not defined
*) \s-1DB\s0 - the base for all database related exceptions. This exception has the following parameters: dsn, user and pass . This exception (and the ones derivated from her) are mostly used in RoPkg::DB class. Of course, this doesn't means that you can't use them in your application ;) .The following exceptions are derivated from \s-1DB\s0:
*) DB::Connect - raised when the connection with the database could not be established
*) DB::ConnExists - raised when a connection with the same name already exists.
*) DB::ConnNotFound - the requested connection was not found
*) DB::NoResults - the sql query returned no results

Exceptions Tree

\s-1ROOT\s0
General
OutsideClass
File
File::NotFound
File::Open
File::Create
Dir
Dir::NotFound
Dir::Open
Dir::Create
Param
Param::Missing
Param::Unknown
Param::Wrong
\s-1DB\s0
DB::Connect
DB::ConnExists
DB::ConnNotFound
DB::NoResults

RELATED TO RoPkg::Exceptions…

RoPkg::Utils

AUTHOR

Subredu Manuel <[email protected]>

VERSION

The current version is 0.2.1

DIAGNOSTICS

The tests for this module are located in t directory. To run those tests, use the following command: make test

SUBROUTINES/METHODS

This module does not have any public methods.

INCOMPATIBILITIES

None known to me

PERL CRITIC

This module is perl critic level 1 compliant with 1 exception.

BUGS AND LIMITATIONS

No known bugs. If you find one (or many) please send me a detailed report.

CONFIGURATION AND ENVIRONMENT

No configuration file or environment variables are used by this module.

LICENSE AND COPYRIGHT

Copyright (C) 2005 Subredu Manuel. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The \s-1LICENSE\s0 file contains the full text of the license.