in reply to Re^2: mro's which to use for flexibility?
in thread mro's which to use for flexibility?

Your code is highly confused, or at least does not highlight where the problem you describe is.

BEGIN{unshift @ISA,"TorClient";} our $mp = Data::Vars->new(); P "main::ISA=%s", \@ISA; $mp->trm_open('trm', 'localhost:1024');

The altering of @ISA only alters @main::ISA, but the class you're dealing with is of type Data::Vars, whose inheritance you have not altered at all.

I suggest you learn about namespaces and importing subroutines instead of trying to solve problems by abusing inheritance.

What prevents you from writing a class My::TorClient, which defines all the methods you want?

Update: Also see Aggregation, which points to Object composition, and Moose::Manual::Roles. But I think in the end you will be much better served by writing simple subroutines that call the functions you want to call.

Replies are listed 'Best First'.
Re^4: mro's which to use for flexibility?
by perl-diddler (Chaplain) on Feb 07, 2016 at 11:56 UTC

    Ah... you are right about confused, but I question your usage of highly. I.e.:

    our $mp = __PACKAGE__->Data::Vars::new();

    Now on to the next problem.

    You see, this is a 6 year old program that I've been trying to modernize and re-factor over time. At one point everything was in MyBigOne::TorClient -- and it was unmaintainable spaghetti with little ability for extension.

    I needed it to be extensible, Talk to multiple TorClients, Multiple Trackers Multiple TID's... Multiple and different instances of each type of object.

    Anyway, as 1 module, it was a mess. Switch parsing was done manually, was a mess. So I started trying to break things into logical boundaries... This code was so old it used almost none of my newer routines that simplify things.

    But when you mentioned DV -- I thought it shouldn't even be trying to go there...why? Cuz it wasn't called via the parent-module name.

    Sigh. Thanks!