Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

I'm clueless. How to subclass Palm::Raw

by Skeeve (Vicar)
on Jun 27, 2006 at 23:00 UTC ( #557890=perlquestion: print w/replies, xml ) Need Help??
Skeeve has asked for the wisdom of the Perl Monks concerning the following question:


I never ever got really friend with OO-style. I use it with XML::Twig and I could manage to read Palm Pilot Databases with CPAN Module PALM::Raw.

But now I seek your advice. Or maybe even instruction?

I have one palm database that I'd like to mangle with. I managed to read it with Palm::Raw. Now I'd love to make my own Palm::AGsu module that will handle these databases. The way should be to subclass Palm::Raw, I guess. But how do I start? Where do I put my methods like ->get_field_by_name('name') and what ever else I might need.


Replies are listed 'Best First'.
Re: I'm clueless. How to subclass Palm::Raw
by leriksen (Curate) on Jun 28, 2006 at 00:05 UTC
    in ( I suggest ) lib/Palm/
    package Palm::AGsu; use strict; use warnings; use base qw(Palm::Raw); sub get_field_by_name { my ($self, $name) = @_; .... } sub you_other_methods_here { my ($self, $param1, $param2,...) = @_; .... } .... 1;
    In t/Palm/AGsu.t
    #!/usr/bin/perl -w use Test::More qw(no_plan); # for now ... BEGIN { use_ok('Palm::AGsu') or die "cannot use Palm::AGsu'; }; require_ok('Palm::AGsu'); my pa = Palm::AGsu->new(...whatever...); isa_ok($pa, 'Palm::AGsu'); is($pa->get_field_by_name('some field'), 'some value', 'some field == +some value'); ...

    Then you can do this

    prove -vl t/Palm/AGsu.t ...<output from test harness>...

    ...reality must take precedence over public relations, for nature cannot be fooled. - R P Feynmann

Re: I'm clueless. How to subclass Palm::Raw
by Skeeve (Vicar) on Jun 28, 2006 at 14:58 UTC

    Many, many thanks!

    A final question: What should I do so that others can review and criticize my modules? Shall I post it here? Are there any monks around wanting to check what I did?

      Well, you can post a Meditation here and label it 'RFC' (Request For Comment). You will get a fair bit of commentary and critique initially. For longer term feed-back, get your self a PAUSE ID and build a CPAN distribution. I know, that's a lot more work, but....

      I Go Back to Sleep, Now.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://557890]
Approved by Hue-Bond
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2018-05-27 18:00 GMT
Find Nodes?
    Voting Booth?