Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
This got buried so I'm putting it up again at the top level.

I have a problem with a naming structure inherited from the guy who wrote a package that I'm working to supersede. Say the module/package is named XYZ::ABC. Using this package, people want to tie to names like XYZ::ABC::Scalar. The way he did this was to write out the names of the tie routines in full in ABC.pm, like this:
# Preloaded methods go here. sub XYZ::ABC::Scalar::TIESCALAR { my $class = shift; my ($val) = @_; return bless \$val, $class; }
This works in preloaded form, but it seems it can't be autoloaded.

What do can I do to keep the inherited naming structure and autoload the tie routines? Can I put multiple package statements/sections in my one ABC.pm file?

If each package needs a separate .pm file, the changes to my Makefile.PM will be extensive. Do I recall a bit in the ExtUtils::MakeMaker docs about handling multiple things in one Makefile.PM?

In all there are 6 "tie-to" names and 52 "tie interface" routines. Even though each one has a pretty simple structure like:
sub XYZ::ABC::Array::STORE { my $self = shift; abc_array_store ($self->{ARRAY}, @_); }
52 of them make autoloading seem worthwhile. Although if they are in separate packages, each one containing only the tie routines for one "tie-to" name, maybe autoloading isn't worthwhile?

Thanks to any monk who can help,
cmac
www.animalhead.com

In reply to Autoloading tie routines by cmac

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-03-28 12:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found