Bonjour,
Je rencontre depuis peu une erreur pour le peu étrange :
run.pl ne contient que ceci :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 ~$ perl5.10.1 run.pl Loading conf from /usr/opt/caacrinolas2/caacrinolas.cfg :card.freenode.net NOTICE * :*** Looking up your hostname... :card.freenode.net NOTICE * :*** Checking Ident zsh: segmentation fault perl5.10.1 run.pl
Et voici la portion de code qui semble causer problème :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 #!/usr/bin/perl use BotIRC; $bot = new BotIRC(); $bot->loadConf(); $bot->init();
C'est même plus spécifiquement cette ligne :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 # Lance le bot sub init { my ($self) = @_; $sock = IO::Socket::INET->new( PeerHost => "$self->{server}", PeerPort => $self->{port}, Proto => "tcp" ) or die "could not make the connection: $!"; binmode($sock, ":encoding(iso-8859-15)"); while ($line = <$sock>) { print $line; if($line =~ /.*\*\*\*.*(checking ident)/i){ print $sock "NICK $self->{nick}\nUSER $self->{conf}->{ident} 0 0 :just a bot\n"; last; } } while ($line = <$sock>) { # Si le serveur nous ping, on repond if($line =~ /^PING/){ print $sock "PONG :" . (split(/ :/, $line))[1]; } if($line =~ /(376|422)/i){ print $sock "NICKSERV :identify $self->{conf}->{pwd}\r\n"; last; } } sleep 3; $self->connect(); } sub connect { my ($self) = @_; $controls{ping} = async { $self->ping(); }; foreach (split(';',$self->{chan})) { print $sock "JOIN $_\r\n"; $self->listen($_); } }
Pourtant, tout fonctionnait. (J'ai apporté 2-3 modifs au reste du code, mais je n'ai pas touché aux threads).
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 $controls{ping} = async { $self->ping(); };
Quelqu'un a-t-il déjà rencontré ce problème ? Quelle serait la solution ?
Partager