(reposted subset of context since old thread...sorry)

> I'm trying to create a .pl using Inline::Java that closely mirrors the .js 
> equivalent implementation. 
> In .js we can alias the namespace for shorter names via: -
>     importPackage(Packages.abc.def.ghi.scripting.logging)
>     script.traceSetFileLevel(TraceLevel.ALL)   // equiv of 
> Packages.abc.def.ghi.scripting.logging.TraceLevel.ALL
> 
> Was hoping I could do same in perl via typeglobs i.e. something like: -
>     *traceLevel = "main::abc::def::ghi::scripting::logging::TraceLevel";     
> # implicit runtime glob
>     $script->traceSetFileLevel($traceLevel::ALL);

Maybe this does what you want ( sorry, no typeglobs involved ;-> ):
(http://search.cpan.org/~ovid/aliased-0.20/lib/aliased.pm)
<quote>
SYNOPSIS
      # Class name interface
      use aliased 'My::Company::Namespace::Customer';
      my $cust = Customer->new;
<snip>

--
Alas, I tried namespace, aliased, type-globbing all to no avail. Its possibly 
because its not a method, but instead a constant field i.e. its documented as: -
main::abc::def::ghi::scripting::logging::TraceLevel
    public static final     Java.lang.string    ALL

Hence obviously cant do TraceLevel->ALL as above-mentioned modules desire. Pity 
cos everything else in Inline::Java works a treat for me (APIs, exceptions, 
instance members etc).

If anyone can think of any other ideas that'd be great - I'm sure others have 
to access more than just Java methods from classes they're using...and 
$big::long::name is evil!

Thanks again, Alan


 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

Reply via email to