summary refs log tree commit diff stats
path: root/plugins/perl/lib/Xchat/Embed.pm
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/perl/lib/Xchat/Embed.pm')
-rw-r--r--plugins/perl/lib/Xchat/Embed.pm12
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/perl/lib/Xchat/Embed.pm b/plugins/perl/lib/Xchat/Embed.pm
index 1b779f80..c5857eb0 100644
--- a/plugins/perl/lib/Xchat/Embed.pm
+++ b/plugins/perl/lib/Xchat/Embed.pm
@@ -259,7 +259,7 @@ sub find_external_pkg {
 		return @frame if $frame[0] !~ /(?:^IRC$|^Xchat)/;
 		$level++;
 	}
-
+	return;
 }
 
 sub find_pkg {
@@ -281,7 +281,7 @@ sub find_pkg {
 	if( $frame[0] or $frame[1] ) {
 		my $calling_package = $frame[0];
 		if( defined( my $owner = $owner_package{ $calling_package } ) ) {
-			return $owner;
+			return ($owner, $calling_package);
 		}
 
 		$location = $frame[1] ? $frame[1] : "package $frame[0]";
@@ -294,10 +294,16 @@ sub find_pkg {
 
 }
 
+# convert function names into code references
 sub fix_callback {
-	my ($package, $callback) = @_;
+	my ($package, $calling_package, $callback) = @_;
 	
 	unless( ref $callback ) {
+		unless( $callback =~ /::/ ) {
+			my $prefix = defined $calling_package ? $calling_package : $package;
+			$callback =~ s/^/${prefix}::/;
+		}
+
 		no strict 'subs';
 		$callback = \&{$callback};
 	}