1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| #!/usr/bin/perl
#
# Supa Bot IRC
#
#########################################################
use strict;
use warnings;
# Supa modules
use Divers;
# Global vars
my $bot;
&loadconf(); # Lecture du fichier de configuration
&sockopen($bot->{'serv'}, $bot->{'port'}); # Lancement du socket
# Fin
Je me sert du fichier Divers.pm pour les fonctions:
Le voici:
#!/usr/bin/perl
use strict;
use warnings;
use Main;
# loadconf();
# Initialisation de la configuration
sub loadconf {
my $path = "supa.conf";
open(FILE,$path) or die("Impossible d'ouvrir $path : $!");
while (defined(my $text = <FILE>)) {
chomp($text);
if ($text =~ /^bot_([^ ]*) (.*)/) {
$bot->{$1} = $2;
}
}
close(FILE);
}
sub sockopen {
my $serv = shift;
my $port = shift;
print "Connexion sur $serv $port\n";
} |