Skip Menu |

This queue is for tickets about the Net-CUPS CPAN distribution.

Report information
The Basics
Id: 35696
Status: resolved
Priority: 0/
Queue: Net-CUPS

People
Owner: Nobody in particular
Requestors: GWOLF [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.55
Fixed in: (no value)



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.
From: dhageman [...] dracken.com
Valid complaint. Fixed in the latest release and credit given. Thanks for your feedback. On Wed May 07 12:34:00 2008, GWOLF wrote: Show quoted text
> 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.