Movatterモバイル変換


[0]ホーム

URL:


 / 
pyperl-1.0.3
River stage zero No dependents
/Python::Err

NAME

Python::Err - Python exception objects

SYNOPSIS

# catchingeval {  ....}if ($@ && UNIVERSAL::iso("Python::Err")) {    # deal with the exception}# raisingif (... arg is not as expected ...) {   Python:Err->Raise(Python::Err::TypeError, "a foo object expected");}

DESCRIPTION

Python exceptions are wrapped up inPython::Err objects. If perl calls some python function and this function raise an exception then $@ will end up as a reference to aPython::Err object.

The following methods are available:

$err->type

What kind of exception this is. It should usually be a reference to one of exception type objects described below.

$err->value

An assosiated value, usually just a human readable string explaining the reason for the failure.

$err->traceback

The traceback object contain stack trace information from the location where the exceptions where raised and down.

$err->as_string

Overloaded stringify. Allow python exceptions to be matched using regular expressions on $@ and to be printed. Exceptions are stringified as:

"$type: $value"
$err->as_bool

Overloaded for boolean tests and will always return TRUE, so it is not actually very useful :-)

If perl code is known to be invoked from python code, then it might want to raise native python exceptions.

Python::raise($type, $value)

The raise() function will raise a python exception of the giventype and pass with it the givenvalue.

Standard exception type objects

References to all the standard python exception type objects can be obtained using the following names.

Python::Err::Exception

The root class for all exceptions.

Python::Err::StandardError

The base class for all built-in exceptions.

Python::Err::ArithmeticError

The base class for all arithmentic exceptions.

Python::Err::LookupError

The base class for indexing and key exceptions.

Python::Err::AssertionError

Failed assert statement.

Python::Err::AttributeError

Failed attribute reference or asssignment

Python::Err::EOFError

End of file.

Python::Err::FloatingPointError
Python::Err::EnvironmentError

Base class for errors that occur outside Python.

Python::Err::IOError

Failed I/O operation.

Python::Err::OSError
Python::Err::ImportError
Python::Err::IndexError
Python::Err::KeyError
Python::Err::KeyboardInterrupt
Python::Err::MemoryError
Python::Err::NameError
Python::Err::OverflowError
Python::Err::RuntimeError
Python::Err::NotImplementedError
Python::Err::SyntaxError
Python::Err::SystemError
Python::Err::SystemExit
Python::Err::TypeError
Python::Err::UnboundLocalError
Python::Err::UnicodeError
Python::Err::ValueError
Python::Err::ZeroDivisionError

If these functions are called with a single argument then they test if the object passed in is of the given type. The argument can be either a Python exception object or a Python::Err object. The test test does not yet consider inheritance of exceptions.

COPYRIGHT

(C) 2000-2001 ActiveState

This code is distributed under the same terms as Perl; you can redistribute it and/or modify it under the terms of either the GNU General Public License or the Artistic License.

THIS SOFTWARE IS PROVIDED BY ACTIVESTATE `AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ACTIVESTATE OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

SEE ALSO

Python::Object,Python,perlmodule

Module Install Instructions

To install pyperl, copy and paste the appropriate command in to your terminal.

cpanm

cpanm pyperl

CPAN shell

perl -MCPAN -e shellinstall pyperl

For more information on module installation, please visitthe detailed CPAN module installation guide.

Keyboard Shortcuts

Global
sFocus search bar
?Bring up this help dialog
GitHub
gpGo to pull requests
gigo to github issues (only if github is preferred repository)
POD
gaGo to author
gcGo to changes
giGo to issues
gdGo to dist
grGo to repository/SCM
gsGo to source
gbGo to file browse
Search terms
module: (e.g.module:Plugin)
distribution: (e.g.distribution:Dancer auth)
author: (e.g.author:SONGMU Redis)
version: (e.g.version:1.00)

[8]ページ先頭

©2009-2025 Movatter.jp