Net::Fritz::Error - wraps any error from the Net::Fritz modules
version v0.0.9
$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; }
Whenever any of the Net::Fritz modules detects an error, it returns an Net::Fritz::Error object. All valid (non-error) objects also implement error and errorcheck via the role Net::Fritz::IsNoError, so calling both methods always works for any Net::Fritz object.
error
errorcheck
If you want your code to just die() on any error, call $obj-errorcheck> on every returned object (see first example above).
die()
$obj-
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).
$obj->error
0
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).
Contains the error message as a string. Don't set this to anything resembling false or you will trick your tests.
Creates a new Net::Fritz::Error object. You propably don't have to call this method, it's mostly used internally. Expects parameters in key => value form with the following keys:
key => value
set the error message
With only one parameter (in fact: any odd value of parameters), the first parameter is automatically mapped to error.
Immediately die(), printing the error text.
Returns some preformatted information about the object. Useful for debugging purposes, printing or logging.
See Net::Fritz for general information about this package, especially "INTERFACE" in Net::Fritz for links to the other classes.
Christian Garbs <mitch@cgarbs.de>
Copyright (C) 2017 Christian Garbs
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
To install Net::Fritz, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Fritz
CPAN shell
perl -MCPAN -e shell install Net::Fritz
For more information on module installation, please visit the detailed CPAN module installation guide.