Thanks for the suggestion. I'll test these modules, a quickly look in the code shows that they use a different approach to declare abstract methods (using import) but the idea is basically the same.
In the other hand Class::Virtually::Abstract will not work with code generator modules and it uses eval, something I prefer not to use.
Updated
Here it goes the test description. First I modified the original code to use Class::Virtual in the Animal class:
Then I changed the test.pl script:
Finally, the results:
C:\>test.pl
Atila says "bark bark!"
Animal::Duck forgot to implement get_sound at C:\test.pl line 12.
Animal::Duck forgot to implement get_sound() at C:\test.pl line 14
While using the method virtual_methods looks more simple to use than having to type several times sub something :Abstract the module forces you to use more code (using the missing_methods method) just to check if you didn't forgot something.
I think I'll change the Attribute::Abstract to use something like virtual_methods: while using Attribute::Handlers looks fancy, is not really necessary.
Alceu Rodrigues de Freitas Junior
---------------------------------
"You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill
|