Hi Jos,

> That's a good idea Joni,
>
> however, personally, i'd always add a constructor, no matter
> how basic...
>
> you could do something like this (add this to the file joni
> described):
>
> sub new { return bless {}, shift }

Lost me here :(

> this will indicate that this object belongs to that package you just
> wrote...
> this makes things a lot more flexible, and you can store
> information in the
> object too (it's really just a hash reference)
>
> here's how you'd use it:
>
> my $obj = new Package_name;
>
> and if you had the function 'blaa' Joni described, you would
> access that as:
>
> $obj->blaa( $arg1, $arg2 );

My function returns a hash.  How do I access it from the calling
program?

> so just like a normal subroutine, only now you got it in a
> nice and cool
> object.
>
> say you'd build lots and lots of methods in taht package
> name, you can have
> them, instead of giving return values,
> store stuff in your object (cuz it's just a hash ref remember! )
>
> like so for example:
>
> $obj->{foo} = 'bar';
>
> now every subroutine that is called in that package thru $obj
> has access to
> the value belonging to 'foo'
> or can even overwrite it...
>
> I am feeling i'm getting a bit technical here... if there's a
> desire i write
> a tutorial about basic packages, please let me know

That would be good.  I did finf some other writings on packages/modules
but they too
have left me wondering.

> you can view some other tuts i wrote on http://japh.nu already
> (or http://japh.nu/index.cgi if you want to see the
> experimental/work in
> progress stuff )
>

Thanks

Ken


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to