Alan Campbell schrieb:
> hello folks,
> 
> 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)
>     importPackage(Packages.abc.def.ghi.scripting.logging)
>     script = new ScriptingEnvironment()    // equiv of 
> Packages.abc.def.ghi..scripting.ScriptingEnvironment
>     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;

      use aliased 'My::Company::Namespace::Preferred::Customer' =>
'Preferred';
      my $pref = Preferred->new;


      # Variable interface
      use aliased;
      my $Customer  = alias "My::Other::Namespace::Customer";
      my $cust      = $Customer->new;

      my $Preferred = alias "My::Other::Namespace::Preferred::Customer";
      my $pref      = $Preferred->new;
</quote>

Don't know how this behaves with Inline::Java though ...

HTH,

Andreas Puerzer

-- 
perl -mAcme::JAPH

Reply via email to