Sign in to PrePAN

PerlPOS::RPI Receipt Printer Interface for Perl

In Review


    my $printer = PerlPOS::RPI->new(driver => 'U220D', 
                                                         device => '/dev/usb/lp0', 
                                                          mode => 'raw' # raw or shell.  for shell device is command to print
                                                      commands => 'ESC/POS'

    $printer->finish(); # activate cutter if applicable, etc.
    $printer->open_cash_drawer; # Open cash drawer if connected to printer
    if ($printer->has_error){
       warn $printer->err_str;


Receipt printers are often not controlled through print spool frameworks in point of sale environments. This is for a number of reasons including the need for highly responsive printers which often control other hardware, such as cash drawers, through themselves. For this reason, one would typically echo or read commands directly to the device port.

PerlPOS::RPI is intended to provide a DBI-like interface (in the sense of commonality across lower level components) to receipt printers in point of sales environments. It is intended to support both integration with command-line printing operations (like lp, lpq) and direct to port printing. The former would typically occur in restaurant settings where kitchen printers might require CUPS to manage queuing, while the latter would be more typical at the actual point of sale, particularly where the cash drawer is controlled through the printer (using CUPS in such an environment would mean, effectively, waiting for a print job to spool so you could get into a cash drawer).

The design is modular. Modes, and drivers are modular. Command sets are also intended to be modular, but printer drivers may override parts or all of them since there may be incompatibilities between command sets. Commands are not used for preprocessing input, but only for basic printer functions like activating the autocut bar. Command modules are intended to be eventually useful for other things as well, such as preprocessing, but that would not be used by these drivers here.

I am intending to put:

print drivers in PerlPOS::RPD::*

mode drivers in PerlPOS::RPM::* (will support CUPS and raw first)

command sets in PerlPOS::RPC::* (ESC/POS offered by first)


I wrote a Module for receipt printers on ESC/POS spec called Printer::Thermal. Perhaps you could improve with your ideas there?

Please sign up to post a review.