Listing 1. Cookie Quality Control Program
#!/usr/bin/perl
# Chef Marcel's Interactive Cookie Quality
# Control Program. Written : January 2000
$make_new = `touch $ENV{HOME}/.netscape/cookies.new';
$cookiesnew = "ENV{HOME}/.netscape/cookies.new";
open (COOKIESNEW,"+> $cookiesnew") or die
"Can not open $cookiesnew file. : $!";
$make_bak = `touch $ENV{HOME}/.netscape/cookies.back';
$cookiesbak = "$ENV{HOME}/.netscape/cookies.back";
open (COOKIESBAK,"+> $cookiesbak") or die
"Can not open $cookiesbak file. : $!";
$cookies = "$ENV{HOME}/.netscape/cookies";
open (COOKIES,"< $cookies") or die
"Can not open $cookies file. : $!\n";
# Starting cookie quality control checks
print "Now sampling through cookies for good ones.";
while ($line = <COOKIES>)
{
print " $line";
# Make a backup of the cookies files as we go along
printf COOKIESBAK ("%s", $line);
# Good cookie or bad cookie? #
print "Accept or Delete this cookie? (A/D)";
$decision = (<STDIN>);
chomp $decision;
if ($decision eq "A") {
print "I accept this cookie.\n";
printf COOKIESNEW ("%s", $line); }
}
close COOKIES; close COOKIESNEW;
close COOKIESBAK;
print "Are you happy with your decisions? (Y/N) :";
$happy = (<STDIN>);
chomp $happy;
if ($happy eq "Y") {
$make_the_switch =
rename("$ENV{HOME}/.netscape/cookies.new","$ENV{HOME}/.netscape/cookies");
print "New cookies file installed.\n";
} else {
print "Your cookies are untouched.\n";
}
exit (0);
Copyright © 1994 - 2018 Linux Journal. All rights reserved.