
Net::IPP::IPPRequest - Perl extension for IPP Requests

use Net::IPP::IPPRequest qw(:all);
my $request = {
&URL => "http://localhost:631/printers/test",
&REQUEST_ID => 1,
&OPERATION => &IPP_GET_PRINTER_ATTRIBUTES,
&GROUPS => [
{
&TYPE => &OPERATION_ATTRIBUTES,
"attributes-charset" => "utf-8",
"attributes-natural-language" => "en",
"printer-uri" => $url,
}
]
};
my $response = ippRequest($request);

To install this module type the following:
perl Makefile.PL make make test make install

To run all tests in the t/ directory type the following:
make test
For more details while running the tests type:
make TEST_VERBOSE=1 test

After installation all programs in the sample directory should run without problems. To run the sample programs without installing this package use the blib module:
perl Makefile.PL make cd samples perl -Mblib sampleprogram.pl [arguments]

+------------+
| IPPMethods |
+------------+
^
|
+------------+
| IPPRequest |
+------------+
^
|
+-------------+---+-----------+
| | |
+--------------+ +---------+ +-----+
| IPPAttribute | | IPPUtil | | IPP |
+--------------+ +---------+ +-----+

The API did not find a default IPP type for attribute xyz in the hash Net::IPP::IPPAttribute::attributeTypes.
Method 1 (workaround): Look in [RFC 2911] which type attribute xyz has. It may f.e. have the type XYZ. If you used something like
"xyz" => "value",
in the IPP request before, substitute that with
"xyz" => { &TYPE => &XYZ,
&VALUE => "value" },
Method 2 (permanent solution): Find the attribute type like in Method 1. Insert the line
"xyz" => &XYZ,
into the hash Net::IPP::IPPAttribute::attributeTypes.
While de- or encoding a unknown IPP type was encountered. To permanently add this type to the API search for the name of this type in the RFCs and add this type to the IPP type in IPP.pm. You also have to write transform methods for this IPP type. All value transformations between IPP byte encoding and Perl encoding are done in transformValue in IPPAttribute.pm. A additional testcase n t/transform.t would be nice, too.
Alternatively you can ignore this warning if you don't need the value of attribute xyz or if the value does not need to be transformed.
The length check in testLengths() went wrong, the decoding became probably totally confused some bytes earlier.
Bad Luck, the printer encoded the IPP response wrong (or you just found a bug in this API). This error simply says that a length field contained a greater length than the remaining bytes in the response. The API became probably totally confused much earlier than the offset states.
If the printer is from HP you can try to run the same IPP request with the HP_BUGFIX option turned on.
Implement the collection syntax ;-)

LWP: IPPRequest.pm uses LWP::UserAgent to send the HTTP Request.

None by default.

implements most of the IPP RFCs

Author
Matthias Hilbig <bighil@cpan.org>

Copyright
Copyright (c) 2004 Matthias Hilbig <bighil@cpan.org> All rights reserved.
This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.