One way strikes me: just create a variable that gets set to true once the import is called. For example:
By closing on a lexical like this, it won't show up in your namespace. Not that it probably matters, but it may be a good trick to avoid this module from exporting "globals" from other packages upwards.{ my %imported; sub import { my( $class, @exports ) = @_; return if $imported{$class}++; # rest of your import here. } }
In reply to Re: Import singleton?
by Tanktalus
in thread Import singleton?
by bennymack
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |