NAME

Net::Fritz::Data - wraps various response data

SYNOPSIS

my $fritz    = Net::Fritz::Box->new();
my $device   = $fritz->discover();
my $service  = $device->find_service('DeviceInfo:1');
my $response = $service->call('GetSecurityPort');

# $response is Net::Fritz::Data
printf "SSL communication port is %d\n",
       $response->data->{NewSecurityPort};


my $service_list = $device->find_service_names('DeviceInfo:1');

# service_list is Net::Fritz::Data
printf "%d services found\n",
       scalar @{$service_list->data};

DESCRIPTION

This class wraps the return data from a Net::Fritz::Service call. This is only done for consistent error checks: Net::Fritz::Data does the role Net::Fritz::IsNoError, so it is possible to check for errors during the service call with $response->error and $response->errorcheck (see Net::Fritz::Error for details).

Apart from that the response data from the service call is passed through unaltered, so you have to know with which data type the services answers.

This wrapper class is also used in some other methods that return things that need to be error-checkable, like "find_service_names" in Net::Fritz::Device.

ATTRIBUTES (read-only)

data

Returns the response data of the service call. For lists and hashes, this will be a reference.

error

See "error" in Net::Fritz::IsNoError.

METHODS

new

Creates a new Net::Fritz::Data 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:

data

set the data to hold

With only one parameter (in fact: any odd value of parameters), the first parameter is automatically mapped to data.

get

Kind of an alias for $response-data>: Returns the data attribute.

dump(indent)

Returns some preformatted multiline information about the object. Useful for debugging purposes, printing or logging. The optional parameter indent is used for indentation of the output by prepending it to every line.

errorcheck

See "errorcheck" in Net::Fritz::IsNoError.

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.