in reply to Re^2: Dealing with abstract methods in Perl 5.8
in thread Dealing with abstract methods in Perl 5.8

I think an END block might be a minor improvement. You could implement the search any number of ways - probably the easiest would be to create a list of packages that need checking as you go. Then when END comes around you know where to look - similar to @abstract_methods, but a single list of packages.

Another advantage of using END is that it executes once per process, not once per object. A system that uses lots of little objects could get much slower with your code... Also, it will catch missing methods for objects which are not created in the process.

-sam

  • Comment on Re^3: Dealing with abstract methods in Perl 5.8

Replies are listed 'Best First'.
Re^4: Dealing with abstract methods in Perl 5.8
by glasswalk3r (Friar) on Apr 24, 2007 at 19:13 UTC

    You got a point with END block... I didn't thought about the performance penalty that might occurs if lots of objects are used (even thought this kind of issue should happen only during developing time).

    One thing that occurred me: using END blocks will not be an issue if the program is being executed as persistent way like a server or thru mod_perl, for example?

    Alceu Rodrigues de Freitas Junior
    ---------------------------------
    "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill
      You're right about the mod_perl problem with END blocks. One solution there is to offer a method people can call from a PerlLogHandler, which will run at the end of each request.

      -sam