> >
> > sub copy
> > {  my $self ;
>
> This is very confusing code. $self is generally used for the instance
> you are acting on. 'copy' is also an odd choice, some prefer 'clone' (if
> that is really what you are intending but I can't tell).

Yes, I do mean Clone.

>
> >      my $x = shift;
> >      my $y = $x -> {B};
>
> Are you sure B has in it what you think? See below.

Yes, I expecting to take out {B} from the reference picking out from
$main::x or $test::load -> {B}

>
> >      $y .= $y;
> >      $self -> {YY} = $y;
> >      bless $self;
>
> perldoc -f bless
>
> I am not sure you are fully understanding bless. Generally you want to
> use the 3 argument form to provide for inheritance, and to avoid other
> issues.

What I understanding from bless is making a data reference to a package
function. But I really don't get the blessed stuff's influence scope through
out the 'main'.

>
> >      return $self;
> >  }
> >
> > sub new
> > { my $self;
> >      $self -> {A} = shift;
> >      $self -> {B} = shift;
> >
>
> Again, $self is generally (in a constructor) used to hold the class.  Do
> you really want A to be 'AAA' and B to be '111'?? Or were you expecting
> 'AAA' to be '111'.  These are very very poor names.

Is that better is I use {Class} to be 'AAA' and {Argv} to be 111 ?

<snipped>

> >
> > Question :
> > How can I make $z become another (blessed) thing ?
> > So when I modify something in $y , and not affecting $z ?
> >
>
> You can't, at least in the way I think you mean. C<bless> is just
> another function, you can bless (just about) anything. So $z is
> blessable, by just saying,
>
> bless $z;
>
> Are you talking about cloning $y?  The code you provided is just copying
> the reference to the instance.
>

Yes, I am asking about how to make $z become a stand alone new object.
on the other word, they no more using the same reference, whatever the
referenced data being copied or anything.

> Have you read the documentation on references,
>
> perldoc perlreftut
> perldoc perlref
>

I guess I got 70% of how reference and de-reference working, but in case
of OO, I can smell something weir, but I can't tell what's wrong.


<snipped>
>
> Tell us what you are really trying to do, give us real classes, method
> names, and variables.  Are you trying to clone objects? Your pseduo-code
> is very difficult to follow and does not illustrate your questions.

Sorry for none of them I can provide, it just a test, on learning level.


Remarks :
Well... thaz really my woes that I still have not much ideas on what OO is
and what OO does difference from function calls. I 've read almost stuff
that mentioned, but what I can really got are just BIG QUESTION MARKS and
EXCLAMATION MARKS. As long as the way I learnt programming, I always relay
my learning on codes, then back to documents. Just llike playing with regex,
I totally don't get anything from perldocs, but I learnt them almost from
trying in code, with pieces of hints. Just like a blind guy trying walk
through a door in a new place, just keep on hitting on the wall until get
passed. I know I really not sensiable to read documents with full of
terminologies. So I opt to try on codes. I know thaz an hard way or not the
level for me to step into the OO world, but I still would say that's a nice
try with helping from buddies from this list.

Thanks again !
Bee



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to