Rand Stats

X::Intl

zef:guifa

X::Intl

A simple module providing an error and warning role to be used in internationalization contexts. Generally intended to be used as a part of modules in the Intl:: or related namespaces.

Applying the role

Use the appropriate submodule to install the roles in the current scope. Note the MRO (method resolution order) showing the class/role hierarchy:

use X::Intl;
class Foo does X::Intl { } 
    # role  X::Intl
    # class Exception

use CX::Warn::Intl;
class Bar does CX::Warn::Intl { }
    # role  CX::Warn::Intl
    # class CX::Warn
    # role  X::Control
    # class Exception

Despite the above example, it is highly recommended to use namespaces in any types applying the roles.
For instance, X::Intl::Foo and CX::Warn::Intl::Bar would be preferable (that is how they are designed in most modules in the Intl:: namespace).

Catching errors and warnings

The roles are designed to allow for easy handling of generic internationalization errors and warnings.

Errors, of course, are caught with CATCH:

use X::Intl;

CATCH {
    when X::Intl { ... }
}

Warnings, however, are caught with CONTROL:

use CX::Warn::Intl;

CONTROL {
    when CX::Warn::Intl { ... }
}

Version History

* **0.1** - Initial release