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

Re: Re: OOP: Plugin Style Development

by dragonchild (Archbishop)
on Jul 22, 2002 at 21:19 UTC ( #184240=note: print w/ replies, xml ) Need Help??


in reply to Re: OOP: Plugin Style Development
in thread OOP: Plugin Style Development

That is what he's doing. We're discussing how to implement the Helper pattern. :-)

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.


Comment on Re: Re: OOP: Plugin Style Development
Re: Re: Re: OOP: Plugin Style Development
by Jenda (Abbot) on Jul 23, 2002 at 19:21 UTC

    I'm not 100% it IS what is he doing. It doesn't hurt to explain it in more detail for others even if he does.

    Anyway here's some code that implements the method checking:

    # in package ShoppingCart @required_methods = qw(GetNext GetFirst Reset ...); sub initialize { my $self = shift; my $IO = shift; croak "The first parameter to 'new ShoppingCart' must be an IO objec +t!" unless ref $IO; foreach my $method (@required_methods) { croak("The IO object passed to 'new ShoppingCart' does not impleme +nt the necessary methods!") unless $IO->can($method); } $self->{IO} = $IO; } ...

    The test is not compile time, but currently it's the best you can get. AFAIK of course.

      Jenda

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://184240]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2014-07-10 04:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (198 votes), past polls