Gossamer Forum
Home : Products : Gossamer Mail : Development, Plugins and Globals :

GMail.pm adding a constant

Quote Reply
GMail.pm adding a constant
I've added a folder constant in GMail.pm (MYFOLDER => 5) to use in a plugin. It was also exported via @EXPORT_OK and %EXPORT_TAGS. However, when trying to use it (use GMail qw/MYFOLDER/) in Install.pm of the plugin, I get this:

Perl Said:
Install.pm syntax OK




Unable to load install file: Unable to load plugin ___ Reason: Install.pm does not compile: "MYFOLDER" is not exported by the GMail module Can't continue after import errors at (eval 443) line 19 BEGIN failed--compilation aborted at (eval 443) line 19.

Anything I did wrong ?

Thanks,

-M

Last edited by:

Jack: Nov 26, 2003, 10:50 AM
Quote Reply
Re: [MGI] GMail.pm adding a constant In reply to
It seems that the constant isn't being exported properly. Could you show the relevant code you added?

I'm not familiar with the GMail code but you should be able to do it like this:

Code:
sub import {
my $pkg = caller;
no strict 'refs';
*{$pkg . '::MYFOLDER'} = sub { 5 };
}