perl backend and back-channel data

hans peter verne hanspv+cups at usit.uio.no
Fri Mar 20 08:18:00 PDT 2009


Hi,

I'm tinkering with a CUPS backend in perl which simply pumps a print job
in to our legacy print system.  Works fine, most of the time.

However, sometimes it is unable to transfer the print file, and I'd like
a way to inform the user about this.  I'd like a piece of text to pop up
in the users interface with an "OK" button or something like that.

I can print DEBUG/ERROR/NOTICE etc. to stderr and have stuff appear
in the log, but most users don't read log files.  The ERROR message
appears in the printer selection box next time the user wants to
print, which is OK, but not quite what I wanted.


The backend(7) manual suggests I can write to file descriptor 3 to
relay "back-channel data" to the filter, but the manuals I've found
doesn't say much about what this data should be, or what is expected
to happen with this data.  I tried something like the snippet below,
but printing in firefox or evince showed nothing out of the ordinary.

  open(FOO,">&",3) || die("DEBUG: ERROR can't open fd 3 ");
  select FOO;
  $| = 1;      # make unbuffered
  print "Here is some text to fd 3\n";
  print STDERR "DEBUG: This comes in the log after printing to fd 3.\n";

The open is successful, the first print returns 1 (success), and the
debug message comes in the log.  But the "some text" part to fd 3
disappears.  I have also tried >>&, >&= and >>&= as open-modes.


Any hints, pointers or suggestions?

Regards,
Hans Peter





More information about the cups-devel mailing list