Subject: | Needs traditionally unnecessary manual inclusion of Net::CUPS::Destination module |
A Net::CUPS server object can be queried, according to the
documentation, for the destinations it offers. However, those
destinations lack their methods unless Net::CUPS::Destination is
explicitly 'use'd. A test case:
gwolf@mosca/tmp$ perl -mNet::CUPS -e '$cups=Net::CUPS->new; for
$printer ($cups->getDestinations) { print ref($printer),"\n"; print
$printer->getName,"\n" }'
Net::CUPS::Destination
Can't locate object method "getName" via package
"Net::CUPS::Destination" at -e line 1.
However, just adding Net::CUPS::Destination to the modules list makes
this work:
gwolf@mosca/tmp$ perl -mNet::CUPS -mNet::CUPS::Destination -e
'$cups=Net::CUPS->new; for $printer ($cups->getDestinations) { print
ref($printer),"\n"; print $printer->getName,"\n" }'
Net::CUPS::Destination
inv-1-der-ac
Net::CUPS::Destination
inv-1-izq-ac
Net::CUPS::Destination
sectec
I am unaware if this happens as well with the other Net::CUPS sub-modules.
Probably the easiest (and, granted, dirtiest) way to solve this would be
to include the modules at Net::CUPS load time. If there are any
inconveniences to this (i.e. memory size or whatnot), they could be
loaded at any function that instantiates an object of that type.
Yes, this is not per-sè a grave bug, as the module _does_ work - but it
works a bit backwards when thinking about the generalized Perl culture.
The module, as it is, is instantiating bastardized objects.