vee/sample-hooks/vee-hook.pl

23 lines
497 B
Perl
Executable File

#!/bin/env perl
use strict;
use warnings;
# toy filter that replaces USC with an img tag
my $FORMAT_FUNC = $ARGV[0]; # name of format function is passed in
while(<STDIN>) {
chomp;
if ($_ =~ s/USC/<img src=http:\/\/www.emaspro.com\/Portals\/0\/images\/Logo\%20-\%20USC.jpg>/g ) {
# argv[0] is the name of the formatting function
if ($FORMAT_FUNC =~ m/groff/) {
printf("'nf\n%s\n'fi\n",$_);
} else {
printf("%s\n",$_);
}
} else {
printf("%s\n",$_);
}
}