Perl Type Issues |
|||||||||||||||||
In Perl there are is one single value type, the scalar. A scalar can represent a string, an integer or a double, and it is implementation uses these C types. But from Perl you can't tell which one it is using. Perl switches the format based on the usage context. For comparison of values, Perl has two sets of operators; string and numeric:
Here's how I resolve it in the AlternatePerlImplementation:
package Plusser; use base 'Test::FIT::ColumnFixture';This demonstrates that I have a high level of control in my fixture, and am able to do the right thing no matter what my situation. But this is terribly verbose. Fortunately I can make this much cleaner by upstreaming all the generic code into my base class. Here's the shorter revision:
package Plusser; use base 'Test::FIT::ColumnFixture'; use Test::FIT qw(attribute);This is about as clean as I can get it, and still retain the control I need. Actually if 'a' and 'b' were 'x' and 'y', I could omit them because I keep a general purpose 'x', 'y', and 'z' in my base Fixture.pm class since they come up often :)
|
|||||||||||||||||
Last edited April 21, 2003 Return to WelcomeVisitors |