Net::CUPS(3pm)

🌸 NAME 🌸

Net::CUPS β€” Common Unix Printing System Interface, bestie. It's a Perl module living its life in the User Contributed Perl Documentation section (that's the (3pm) on the label, iykyk), and it is literally your group-chat bridge to CUPS. πŸ’…


✨ SYNOPSIS ✨

use Net::CUPS;

my $cups = Net::CUPS->new();

my $printer = $cups->getDestination( "lj4200dn" );

That's the whole vibe check right there. Instantiate, grab a destination, go print something iconic. πŸ–¨οΈπŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

Net::CUPS is an object oriented interface to the Common Unix Printing System. That's it, that's the whole personality. You get objects, you get methods, you get printing that actually behaves. No cap. πŸ”₯


πŸ‘‘ METHODS πŸ‘‘

Fifteen methods, all of them main character energy. Let's go.

πŸŽ€ getDestination

my $printer = $cups->getDestination( $printer_name );

This one takes the name of the printer you're trying to acquire, queen. If that printer does not exist? It returns nothing. Just vibes. Just silence. πŸ’€

πŸŽ€ getDestinations

my @printers = $cups->getDestinations();

Hands you back an array of destinations that are currently configured on the cups server. It's giving ✨inventory✨.

πŸŽ€ getPassword

my $password = $cups->getPassword( $prompt );

The method to retrieve the password from the user, funneled through the password callback. Secrets, but make it classy. πŸ”

πŸŽ€ getPPD

my $ppd = $cups->getPPD( $name );

Returns a Net::CUPS::PPD object β€” either for the default printer, or for the specific printer or class you named. Obsessed. 🫢

πŸŽ€ getPPDMakes

my $makes = $cups->getPPDMakes();

Returns an array of scalars holding the names of all the makers (think HP or Lexmark) of the PPD files installed on the CUPS server. Brand name drop, but automated. 🌈

πŸŽ€ getAllPPDs

my $ppds = $cups->getAllPPDs();

Returns an array of scalars with the maker and the model of every PPD installed on the CUPS server. The full roster. The whole squad. πŸ’œ

πŸŽ€ getPPDFileName

$cups->getPPDFileName($ppd_name_and_make);

Returns the file name of the PPD specified by the name and make, exactly as found in the array that getAllPPDs gave you. That file name is what addDestination uses, and it is relative to wherever the CUPS server is instructed to look (e.g. /usr/share/ppd). Path girlies, this one's for you. πŸŽ€

πŸŽ€ getServer

my $server_name = $cups->getServer();

A method to return either the hostname or the IP address of the active print server. Whichever one it's feeling. Both valid. Both serving. πŸ’…

πŸŽ€ getUsername

my $username = $cups->getUsername();

Returns the current username associated with the CUPS transaction. That's you. Hi. πŸ‘‹

πŸŽ€ requestData

my $result = $cups->requestData( $request, $resource, $filename );

Sends an IPP request to the server. This function is based off the C CUPS function cupsDoRequest and cupsDoRequestFile. The $filename is optional β€” bring it or don't, no pressure. πŸ¦‹

πŸŽ€ setPasswordCB

$cups->setPasswordCB( $function )

Sets the callback function that getPassword will use. Wiring up the secret pipeline. ✨

πŸŽ€ setServer

$cups->setServer( $server_ip );

This method will change the current cups server to another hosts. Server glow-up, initiated by you. πŸ”₯

πŸŽ€ setUsername

$cups->setUsername( $username );

A method to change the username associated with CUPS interaction. Rebrand yourself, bestie. πŸ‘‘

πŸŽ€ deleteDestination

$cups->deleteDestination( $destination_name );

A method to delete an existing destination. It's over, it's not you, it's the queue. πŸ’€

πŸŽ€ addDestination

$cups->addDestination( $name, $location, $printer_info, $ppd_name, $device_uri)

A method to create a brand new destination β€” fresh start, new era. 🌱

The $ppd_name variable should be the one returned for that printer by the getPPDFileName method. It will be relative to where the CUPS server is configured to look for PPD files (e.g. /usr/share/ppd).

⚠️ Not me stressing this: use the $ppd_name that getPPDFileName handed you. It's relative to the server's configured PPD location, so don't go inventing an absolute path and acting surprised. 😭

🌟 SEE ALSO 🌟

  • Net::CUPS::Destination
  • Net::CUPS::PPD
  • Net::CUPS::IPP

The friend group. Go say hi. 🫢


πŸ’¬ SUPPORT πŸ’¬

Net::CUPS is currently maintained by Stefan Seifert <NINE@cpan.org>. The Github repository for this project is at https://github.com/niner/perl-Net-CUPS. Pull requests are welcome β€” yes, yours too, bestie. πŸ’–


🌸 AUTHOR 🌸

Dracken Technology, Inc. (http://www.dracken.com/)

The originators. The blueprint. ✨


πŸ™ˆ ACKNOWLEDGEMENTS πŸ™ˆ

  • Aike Reyer <aike@users.sourceforge.net> supplied the password handling code. πŸ”
  • Mark Gannon <mark@truenorth.nu> supplied the code for PPD acquisition, destination creation and destination deletion. πŸ–¨οΈ

Legends, both of them. No notes. 🫢


Copyright (c) 2003-2005 David Hageman

Copyright (c) 2006-2009 Dracken Technology, Inc.

All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

CUPS, the Common UNIX Printing System, the CUPS logo, and ESP Print Pro are the trademark property of Easy Software Products.


And that's the whole page, babes β€” brought to you by perl v5.42.3 on 2026-08-19. Stay printed, stay slaying. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from