Data::Table isn't an object factory. The various "from" constructors are just that, constructors. Data::Table has multiple constructors, but there is nothing particularly magical about them. The SQLness of fromSQL isn't provided by a separate class, it is simply what the fromSQL constructor does.

Can you give an example of the problem you are trying to solve in the context of the following code?

use strict; use warnings; package Table; sub MakeTypeA { my ($class, %params) = @_; return $class->TypeA::new(%params); } sub MakeTypeB { my ($class, %params) = @_; return $class->TypeB::new(%params); } sub ShowType { my ($self) = @_; print "$self->{type}\n"; } package TypeA; push @TypeA::ISA, 'Table'; sub new { my ($class, %params) = @_; return bless {type => 'TypeA', %params}, $class; } sub foo { print "TypeA::foo\n"; } package TypeB; push @TypeB::ISA, 'Table'; sub new { my ($class, %params) = @_; return bless {type => 'TypeB', %params}, $class; } sub baa { print "TypeA::baa\n"; } package MiddleMan; push @MiddleMan::ISA, 'Table'; sub ShowType { my ($self) = @_; print 'MiddleMan, '; $self->SUPER::ShowType(); } sub ShowClass { my ($self) = @_; print ref $self, "\n"; } package MyClass1; push @MyClass1::ISA, 'MiddleMan'; package MyClass2; push @MyClass2::ISA, 'MiddleMan'; package main; my $obj1 = MyClass1->MakeTypeA(); my $obj2a = MyClass2->MakeTypeA(); my $obj2b = MyClass2->MakeTypeB(); $obj1->ShowType(); $obj1->ShowClass(); $obj2a->ShowType(); $obj2a->ShowClass(); $obj2b->ShowType(); $obj2b->ShowClass();
True laziness is hard work

In reply to Re^3: inheriting from Data::Table by GrandFather
in thread inheriting from Data::Table by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.