NAME

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

VERSION

version v0.0.9

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.

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.

SEE ALSO

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

AUTHOR

Christian Garbs <mitch@cgarbs.de>

COPYRIGHT AND LICENSE

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/>.