[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Kill Sherlock Ads from Plugins



(A copy of this message has also been posted to the following newsgroups:
comp.sys.mac.programmer.misc)

This will hunt down and remove the banner tags from your Sherlock
plugins.  Make backups, no warranties expressed or implied.  :-)  MacPerl
required (but you already have it installed, right?).

#!perl -w
# killsherlockbanners.plx
# by pudge@pobox.com

use strict;
use Mac::Files;

chdir(FindFolder(kOnSystemDisk, kSystemFolderType)
    . ':Internet Search Sites:') or die "Can't find plugin directory: $!\n";
my @files = <*.src>;

foreach my $f (@files) {
    local $/;
    open(FILE, "+<$f") or die "Can't open $f: $!\n";
    my $file = <FILE>;
    (my $new = $file) =~ s/^\s*banner(start|end)\b.*$//mgi;
    if ($new ne $file) {
        truncate(FILE, 0);
        seek(FILE, 0, 0);
        print FILE $new;
        $f =~ s/\.src$//;
        print "Killed ads in $f\n";
    }
    close(FILE);
}

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch