$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} = '';
+ 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}) {