[NBLUG/talk] Odd CUPS issue.
Steve Johnson
srj at adnd.com
Sat Nov 1 11:51:02 PST 2003
I setup cups on my Debian box (running cid (test?)).. I setup CUPS,
setup Samba to share the printer.. Thats all I've done.
Now, when I'm in an Xterm, and I run this perl script (See below) linux
prints the last few lines of output to my printer. This happens every
time I run the script.. Its the oddest thing. The script does not open
the printer at all, and it doesn't print to anything byt STDOUT.
If I kill the cupsd daemon, the problem goes away.
Anyone have any issues like this? Oh and this script basicly prints the
From, Subject and Date from ea-mails in my mailbox. and it only fails
when I dont give the script a second argv.. (this tells it to print all
instead of just a few)
This baffeled me last night to the point where I just gave up and went
to bed. lol!
-Steve
----- Perl Script Cut Here -----
#!/usr/bin/perl
my $filename = shift;
my $list_number = shift;
open (FILE,"<$filename") || die ("Unable to open $filename \n");
$on =0; $count = 0;
while (<FILE>)
{
if (/^\n/ && $on) { $on=0; }
chomp;
if (/^From / && !$on) { $on = 1; ++$count ; s/^From //ig;
$FROM{$count} = $_;}
if (/^From:/ && $on) { s/^From: //ig; $FROM{$count} = $_; }
if (/^Date:/ && $on) { s/^Date: //ig; $DATE{$count} = $_;}
if (/^Subject:/ && $on) { s/^Subject: //ig; $SUB{$count} = $_;}
}
$ncount = 1;
while ($ncount <= $count)
{
if (!$list_number) { $list_number=$count; }
if ($ncount > ($count-$list_number) ) {
print "# $ncount\n";
print "From : $FROM{$ncount}\n";
print "Date : $DATE{$ncount}\n";
print "Subj : $SUB{$ncount}\n";
print "\n";
}
++$ncount;
}
print "Total E-Mails = $count \n";
More information about the talk
mailing list