#!/usr/bin/perl -w

#&validateArgs;

# read int he list of files

#print "Listing the PHP Name space:\n";
@func_names = ();
    
while (<>) {

    $file = $_;
    # print "examining $file";
    chomp($file);
    open(SRC,"<$file") or die "File $file does not exist\n";

    # your processing code goes here

    while (<SRC>) {
        if ( /^ *function +shn_(\w+)\(/ ) {
            push @func_names, ($1);
        }
    }
    close(SRC);
}

foreach $i (sort @func_names) {
    print "$i\n"; 
}
 


sub validateArgs {
    if ( $#ARGV < 1 ) {
        &showUsageNotice;
        die "Invalid number of arguments \n";
    }
}

sub showUsageNotice {
print <<"END";
    Replace string command
    <file list command> | replacestr <from string> <to string>

    example usage:
        ls | replacestr this that
        find . | replacestr foo bar

END

}

