CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Using Java-like URL-based namespaces

 



GullyBurns
New User

May 6, 2002, 11:03 AM

Post #1 of 2 (1980 views)
Using Java-like URL-based namespaces Can't Post

Hello,

This is my first post, and I'm a looking for an elegant solution to organizing my Perl code into a namespace structure that fits well into the way that my java code is laid out.

Basically, I want to code and distribute a package called

edu::usc::kmrg::vpdmf

(based on the same URL as the Java package edu.usc.kmrg.vpdmf)

but then just get these horrendous strings whenever I create a new object. Imagine having

$a = edu::usc::kmrg::vpdmf::blahblahblah->new() scattered around your code.

Is this the only way? I've thought of separating the definition of the library file from the name of the package so I'd put the definition

package blahblahblah;

into the file: ./edu/usc/kmrg/vpdmf/blahblahblah; and then make sure that the package names are all unique, but I'm worried that this will break the Makefile generation process under perl Makefile.PL.

Any suggestions/ideas?

best

Gully


Paul
Enthusiast

May 7, 2002, 3:46 AM

Post #2 of 2 (1974 views)
Re: [GullyBurns] Using Java-like URL-based namespaces [In reply to] Can't Post

You could shorten it by creating a global...eg...

use vars qw/$obj/;

$obj = 'edu::usc::kmrg::vpdmf::blahblahblah';

Then you can just use:

$a = $obj->new()

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives