Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/Perl/droyer_irc/gen_fcts.pl

(Deskargatu)
#!/usr/bin/perl -w
#
opendir(DIR,"./fcts") or die("ERROR");
my @fichiers = grep { /^[^.]/ and -f "fcts/$_" } readdir(DIR);
my (@contenu,$ouverts);
$ouverts = 0;

open(WRITE,">./fonctions.pl") or die("ERROR WRITE $!");
print WRITE '#!/usr/bin/perl -w


sub foncts(@)
{
	($chan,$fullpower,$nick,$texte) = ($_[0],$_[1],$_[2],$_[3]);
if ($texte =~ /\\@time/) { print "PRIVMSG $chan :$nick: Feignant!\n"; }
';


foreach (@fichiers)
{
	 open (INFO ,"fcts/$_") or die("ERROR");
	 @contenu = <INFO>;
	 close INFO;




	shift @contenu;
	
	$contenu[0] =~ s/\n$//;
	
	print WRITE "\telsif (\$fullpower =~ / \$nick / and \$texte =~ /^$contenu[0]/) { \n";
	shift @contenu;
	
	foreach (@contenu) { 
		print WRITE "\t\t$_"; 
	}
	
	print WRITE "\t}\n";

}

print WRITE "}  \n return 1;";
close WRITE;



return 1;