diff plugins/perl/common/Gaim.pm @ 6588:7f5f57dd5cac

[gaim-migrate @ 7110] I'm breaking debug. I cannot for the life of me figure out the enum stuff in perl XSUB. Everything is ending up 0 (in other words, it's probably not finding them). So, people can use debug_info and such. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 24 Aug 2003 01:08:32 +0000
parents cbd24b37350d
children 47744949513f
line wrap: on
line diff
--- a/plugins/perl/common/Gaim.pm	Sat Aug 23 23:09:14 2003 +0000
+++ b/plugins/perl/common/Gaim.pm	Sun Aug 24 01:08:32 2003 +0000
@@ -3,8 +3,10 @@
 use 5.008;
 use strict;
 use warnings;
+use Carp;
 
 require Exporter;
+use AutoLoader;
 
 our @ISA = qw(Exporter);
 
@@ -27,6 +29,25 @@
 
 our $VERSION = '0.01';
 
+sub AUTOLOAD {
+	# This AUTOLOAD is used to 'autoload' constants from the constant()
+	# XS function.
+
+	my $constname;
+	our $AUTOLOAD;
+	($constname = $AUTOLOAD) =~ s/.*:://;
+	croak "&Gaim::constant not defined" if $constname eq 'constant';
+	my ($error, $val) = constant($constname);
+	if ($error) { croak $error; }
+	{
+		no strict 'refs';
+
+		*$AUTOLOAD = sub { $val };
+	}
+
+	goto &$AUTOLOAD;
+}
+
 require XSLoader;
 XSLoader::load('Gaim', $VERSION);
 
@@ -79,7 +100,7 @@
 
 =head1 AUTHOR
 
-Christian Hammond, E<lt>chipx86@localdomainE<gt>
+Christian Hammond, E<lt>chipx86@gnupdate.orgE<gt>
 
 =head1 COPYRIGHT AND LICENSE