Monks, please bear with me here, my OO vocabulary is not always accurate :P
I am concerned about one of the ways I have used to pass an object between classes, using bless.
$job is an object reference to a hash in the package oo::job
and $job is an object I am passing to the constructor oo::gui::defaultjob->new
once in the constructor,
package oo::gui::defaultjob;
use strict;
sub new {
my $self = shift;
my $job = shift;
my $oldclass = ref $job;
bless $job, $self;
# Call methods of defaultjob on $job, since they depend on
# the hash as setup by oo::job
MainLoop; # Invoke Tk, allowing user to gui'ly modify the job
return bless $job , $oldclass
}
Thus $job is returned as belonging to the oo::job package.
My question : What nastiness have I introduced here ? or is this an over-complication of an easier way.
Reading the Damian Conway's OOPerl book, which is making the cracks which flood the brain with light, but I am certainly still learning.
Constructive Abuse only pls!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.