Old stuff/Perl/droyer_irc/Ircvar.pm
(Deskargatu)
#!/usr/bin/perl -w
package Ircvar;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw($bot_nick $nick $texte $action $server $port $bot_nick register_irc $chan join_chan $fullpower $fichiers_a_charger $bigfont_char);
$home =$ENV{'HOME'};
our ($bot_nick,$nick,$texte,$action,$server,$port,$fullpower);
print "Config:\n";
do "config" or die("Config Error: $!");
open(PID,"$home/.bot/pid");
$pid = <PID>;
close PID;
if ($pid and kill 0 => $pid) { print "Pid present et reactif\n"; die; }
else {
open(PID,">$home/.bot/pid") or die $!;
print PID $$;
close PID;
}
#$server="localhost";
#$port=6667;
#$bot_nick="tfe_b";
#$chan = "#perl";
#$fullpower=" tfe ciel "; # Importance de l espace au debut et a la fin ...
sub register_irc
{
print STDOUT "**** Logging\n";
print "USER tfe_b 0 0 :un_bot\n";
print "NICK $bot_nick\n";
}
sub join_chan
{
print STDOUT "**** Joining\n";
@chans = split/ /,$chans;
foreach(@chans)
{
select(undef,undef,undef,0.3);
print "JOIN $_\n";
}
print "JOIN $debug\n";
}
return 1;