Created
May 10, 2019 18:22
-
-
Save wisnij/b1bbae0dcf6ae479589d3e9b0b8ab77c to your computer and use it in GitHub Desktop.
A simple script to make printers display a silly message
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use IO::Socket::INET; | |
my ($host, $msg) = @ARGV; | |
$host ||= '...'; | |
$msg ||= 'FEED ME A STRAY CAT'; | |
my $port = 9100; | |
print "setting message on $host to '$msg'\n"; | |
my $sock = IO::Socket::INET->new( PeerAddr => $host, | |
PeerPort => $port, | |
Proto => 'tcp' ) | |
or die "$0: $host:$port: $!\n"; | |
print $sock qq(\x1B%-12345X\@PJL RDYMSG DISPLAY = "$msg"\r\n\x1B%-12345X\r\n); | |
print "done\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment