Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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
[thepkd]: ??
[GotToBTru]: I would think temporary variables would help in making the real life meaning of your structure clear
[choroba]: the problems start when you want to "skip a level", i.e. the arrays for all the keys
[LanX]: what are temps?
[moritz]: oh, the question was about creation, not indexing
[thepkd]: temporary variables
[moritz]: [ { a => [ { b => 1 } ] } ]
[choroba]: dereference ne creation
[choroba]: at least in my lingo
[moritz]: .oO( oh temps, oh moritz )

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (13)
As of 2016-12-06 13:18 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (104 votes). Check out past polls.