my @attributes;
BEGIN {
- @attributes = qw/tag name version desc author email url banner/;
+ @attributes = qw<tag name version desc author email url banner>;
}
local *PH;
$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';
}
*$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<name version banner>}, sub {
$ph->flush;
if (*$ph->{atexit_id}) {
my @callbacks = sort { *$ph->{atexit}{$b} <=> *$ph->{atexit}{$a} }