hi,all,
I'm try my best to write a programme in using package structure. But I don't have any
experience at the side, I packed all common subroutines in a package including all
relative variables for these subroutines and my main programme, It seem wrong,
however, all these variables couldn't
> I'm try my best
And you had 99% of it right.
> package pt;
> use 5.;
> $a="ok"; #for public using
> $b="It's";
>
> # I don't know why put the newsubroutine in this package,
> # perhaps, it is a constructer, I copy from PERL's manual,
> # but it seem don't do anything.
Most of what you w
Good job I decided to write this as two posts.
> Most of what you wrote is redundant in this
> particular case. You could have written:
(I was just refering to the constructor, btw.)
> package foo;
> sub bar { bless \$qux };
> .
> .
> package waldo;
> $emerson = foo->new
MAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, June 23, 2001 7:11 PM
Subject: Re: Failed in package programme, how do I use package and object?
> > I'm try my best
>
> And you had 99% of it right.
>
> > package pt;
> > use 5.
[everyone, please keep posts on list]
> I'm programming a registration & editing produce for my site,
> I want to bind many of same subroutine into a library, and reuse
> these routines in same case.
You don't need to use objects at all. You can just use the package
and module concepts. You can
> Just a quick note; dont use $a and $b as named
> variables.. they're 'special' (used by the cmp
> operator) so to avoid ambiguity, use something
> else/more descriptive... or use $c if it makes you happy =)
Indeed, I meant to mention something about $a/$b myself.
cmp isn't really relevant.
$a