NAME

Net::Fritz::IsNoError - a Moo::Role discerning all other Net::Fritz objects from a Net::Fritz::Error object

SYNOPSIS

$root_device = Net::Fritz::Box->new->discover;
$root_device->errorcheck;

or

$root_device = Net::Fritz::Box->new->discover;
if ($root_device->error) {
    die "error: " . $root_device->error;
}

DESCRIPTION

All valid (non-error) Net::Fritz classes do the Net::Fritz::IsNoError role, the only exception being of course) Net::Fritz::Error. All Net::Fritz objects thus support error and errorcheck

If you want your code to just die() on any error, call $obj-errorcheck> on every returned object (see first example above).

If you just want to check for an error and handle it by yourself, call $obj->error. All non-errors will return 0 (see second example above).

You don't have to check for errors at all, but then you might run into problems when you want to invoke methods on an Net::Fritz::Error object that don't exist (because you expected to get eg. an Net::Fritz::Service object instead).

ATTRIBUTES (read-only)

error

Returns an empty string to pass any if($obj->error) { ... } checks.

METHODS

errorcheck

A no-op, so that calling $obj->errorcheck just succeeds and carries on.

COPYRIGHT

Copyright (C) 2015 by Christian Garbs <mitch@cgarbs.de>

LICENSE

Licensed under GNU GPL v2 or later, see <http://www.gnu.org/licenses/gpl-2.0-standalone.html>

AUTHOR

Christian Garbs <mitch@cgarbs.de>

SEE ALSO

See Net::Fritz for general information about this package, especially "INTERFACE" in Net::Fritz for links to the other classes.