X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=Xchat%2FXPI.pm;h=1d9236454c1ef9d715d77a50c30ce55654b5aee0;hb=73947ac5d6fffbe5b5ad7f86a9d57d5ada557e6b;hp=7481f5c0ac88c395510243a5a5758e5f39fcea70;hpb=80f827633d7173e4388bfce83f6bb304f37cecab;p=perl%2Fscripts%2Fxchat.git diff --git a/Xchat/XPI.pm b/Xchat/XPI.pm index 7481f5c..1d92364 100644 --- a/Xchat/XPI.pm +++ b/Xchat/XPI.pm @@ -13,7 +13,7 @@ use constant { COLOR_TAG => "\00307" }; my @attributes; BEGIN { - @attributes = qw/tag name version desc author email url banner/; + @attributes = qw; } local *PH; @@ -23,7 +23,8 @@ sub new { $class = ref($class) || $class; my %opts = @_; - my $caller = (caller 0)[0]; + my ($caller, $file) = (caller 0)[0, 1]; + unless (defined $opts{tag}) { $opts{tag} = ($caller =~ /([^:]*):*$/) ? $1 : 'UNKNOWN'; } @@ -52,7 +53,11 @@ sub new { *$ph->{$_} = $opts{$_} for @attributes; *$ph->{buf} = ''; - Xchat::register(@opts{qw/name version banner/}, sub { + my $internal_pkg = Xchat::Embed::file2pkg($file); + no warnings 'redefine'; + local *Xchat::Embed::find_pkg = sub { $internal_pkg, $caller }; + local *HexChat::Embed::find_pkg = sub { $internal_pkg, $caller }; + Xchat::register(@opts{qw}, sub { $ph->flush; if (*$ph->{atexit_id}) { my @callbacks = sort { *$ph->{atexit}{$b} <=> *$ph->{atexit}{$a} }