Skip Menu |

This queue is for tickets about the Package-Variant CPAN distribution.

Report information
The Basics
Id: 119779
Status: new
Priority: 0/
Queue: Package-Variant

People
Owner: Nobody in particular
Requestors: djerius [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Expose the package which is invoking generator to make_variant()
Currently make_variant() isn't aware of which package calls the variant generator. For example, package My::Variant { use Package::Variant; sub make_variant { ... } } package Foo { use My::Variant; my $new_variant_package = Variant( @variant_arguments ); } My::Variant::make_variant() doesn't know anything about Foo. In my application, make_variant() requires access to Foo in order to discover which operators are overloaded. Currently I'm passing the name of the invoking package as an argument to the generator, e.g. package Foo { use My::Variant; my $new_variant_package = Variant( package => __PACKAGE_, @variant_arguments ); } which is rather ugly. It'd be preferable if make_variant() were given access to that information directly. One approach to implementing this without breaking the API is to pass that information via a variable localized to the generator's namespace. The generator routine and the generated build_variant() routine would set it prior to calling build_variant_of(), and build_variant_of() would set it if not already set (to accomodate calling build_variant_of() directly). Localized variables are sort of ugly; one could create a method in the generator's namespace (similar to how the install() method is created) to perform the same function. Any interest in this? Thanks, Diab