On Fri, Aug 04, 2017 at 05:45:08PM +0200, hw wrote:
> Paul Johnson wrote:
> > On Thu, Aug 03, 2017 at 08:44:45PM +0200, hw wrote:
> > >
> > > Hi,
> > >
> > > suppose I have a class FOO and a class BAR. The parent of BAR is FOO.
> > >
> > > I would like FOO to /use/ BAR because BAR has some meth
://modernperlbooks.com/books/modern_perl_2016/index.html if you want more
details of other parts of Perl
Duncs
-Original Message-
From: hw [mailto:h...@gc-24.de]
Sent: 04 August 2017 17:31
To: beginners@perl.org
Subject: Re: OOP: a class using a class that is descended from it?
Shawn H Corey
On Fri, 4 Aug 2017 17:51:01 +0200
hw wrote:
> Huh? How many package statements is a module supposed to contain?
> And doesn´t a package statement turn a module into a package?
Convention is:
* One package per module.
* One module per package.
But if come across bad code, you may see more than
>
> What happens when you bless something in a module?
>
In Perl 5 an object is a reference that has been blessed (with a package
name). The namespace of that package is used to find the methods
associated with the object. If no methods can be found, then the @ISA
package variable is checked to
On Fri, Aug 4, 2017 at 11:52 AM hw wrote:
> > Often you will see a module that contains one package statement which
> leads to the confusion.
>
> Huh? How many package statements is a module supposed to contain?
> And doesn´t a package statement turn a module into a package?
>
No, package statem
Shawn H Corey wrote:
On Fri, 4 Aug 2017 15:23:21 +0200
hw wrote:
Now I´m confused as to what is a module and a package. Both are
files.
> [...]
This is very confusing so the convention is that one module has one
package. I'm telling you this because the terms module and package are
not in
On 08/04/2017 11:51 AM, hw wrote:
Huh? How many package statements is a module supposed to contain?
And doesn´t a package statement turn a module into a package?
package statements and files are independent!
a package statement only sets the default namespace for code that
follows it until
Chas. Owens wrote:
On Fri, Aug 4, 2017 at 9:25 AM hw mailto:h...@gc-24.de>> wrote:
snip
Now I´m confused as to what is a module and a package. Both are files.
No, packages are not files. A package is created by a package statement:
package Foo;
This I put into a file.
If you do no
Paul Johnson wrote:
On Thu, Aug 03, 2017 at 08:44:45PM +0200, hw wrote:
Hi,
suppose I have a class FOO and a class BAR. The parent of BAR is FOO.
I would like FOO to /use/ BAR because BAR has some methods needed by FOO.
BAR is /decended/ from FOO because FOO has many methods needed by BAR.
On Fri, 4 Aug 2017 15:23:21 +0200
hw wrote:
> Now I´m confused as to what is a module and a package. Both are
> files.
>
> In any case, it is my intention to keep everything that one class
> requires within one file which starts with 'package FOO'. Due to
> increasing complexity, I´m using POD
Илья Рассадин wrote:
Hi!
It's strange design decision.
If FOOR is ancestor for BAR, why can't you just place methods into FOO?
It´s because not both of FOO and BAR can have all the same methods. Yet
there is functionality programs using FOO and/or BAR require from both of
them from different
On Fri, Aug 4, 2017 at 9:25 AM hw wrote:
snip
> Now I´m confused as to what is a module and a package. Both are files.
>
No, packages are not files. A package is created by a package statement:
package Foo;
If you do not explicitly create a package with a package statement, then
you are in t
Andrew Solomon wrote:
On Thu, Aug 3, 2017 at 8:48 PM, hw mailto:h...@gc-24.de>> wrote:
Andrew Solomon wrote:
My instinct before trying this would be to move the methods which FOO
needs back into FOO (removing them from BAR).
Is there a reason this won't work for you?
Shawn H Corey wrote:
On Thu, 3 Aug 2017 20:44:45 +0200
hw wrote:
Hi,
suppose I have a class FOO and a class BAR. The parent of BAR is FOO.
I would like FOO to /use/ BAR because BAR has some methods needed by
FOO. BAR is /decended/ from FOO because FOO has many methods needed
by BAR.
Is th
On Thu, Aug 03, 2017 at 08:44:45PM +0200, hw wrote:
>
> Hi,
>
> suppose I have a class FOO and a class BAR. The parent of BAR is FOO.
>
> I would like FOO to /use/ BAR because BAR has some methods needed by FOO.
> BAR is /decended/ from FOO because FOO has many methods needed by BAR.
>
> Is th
Hi!
It's strange design decision.
If FOOR is ancestor for BAR, why can't you just place methods into FOO?
03.08.17 21:44, hw пишет:
Hi,
suppose I have a class FOO and a class BAR. The parent of BAR is FOO.
I would like FOO to /use/ BAR because BAR has some methods needed by FOO.
BAR is /
On Thu, 3 Aug 2017 20:44:45 +0200
hw wrote:
>
> Hi,
>
> suppose I have a class FOO and a class BAR. The parent of BAR is FOO.
>
> I would like FOO to /use/ BAR because BAR has some methods needed by
> FOO. BAR is /decended/ from FOO because FOO has many methods needed
> by BAR.
>
> Is this p
On Thu, Aug 3, 2017 at 8:48 PM, hw wrote:
> Andrew Solomon wrote:
>
>> My instinct before trying this would be to move the methods which FOO
>> needs back into FOO (removing them from BAR).
>>
>> Is there a reason this won't work for you?
>>
>
> Hmm. I haven´t thought of that because they don´t
Andrew Solomon wrote:
My instinct before trying this would be to move the methods which FOO needs
back into FOO (removing them from BAR).
Is there a reason this won't work for you?
Hmm. I haven´t thought of that because they don´t belong into FOO.
They also won´t work in FOO because both FO
My instinct before trying this would be to move the methods which FOO needs
back into FOO (removing them from BAR).
Is there a reason this won't work for you?
On Thu, Aug 3, 2017 at 7:44 PM, hw wrote:
>
> Hi,
>
> suppose I have a class FOO and a class BAR. The parent of BAR is FOO.
>
> I would
On 03/09/2011 12:22, Ron Weidner wrote:
I'm trying to add a object to an array of objects. The code below is
wrong.
sub add_widget
{
my $self = shift;
my $new_widget = shift;
push ( @($self->{WIDGETS}), $new_widget );
}
Hi Ron
You probably want
push @{$self->{WIDGETS}}, $n
> ""Jeff" == "Jeff Pang" <[EMAIL PROTECTED]> writes:
"Jeff> but the second one is recommended, it looks more like the OO way.
It's more than just recommended. The indirect object form is actively
discouraged, because we've been finding more and more examples where
the inherent imbiguity in i
On Feb 15, 2008 11:56 PM, howa <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Currently I have seen two way to create objects in Perl:
>
> 1. my $a = new Apple...
> 2. my $a = Apple->new();
>
> What are the differences, and which one is recommended?
>
Both are fine:
$ perl -le 'package A;sub new{print shif
Ken Farmer am Donnerstag, 8. Dezember 2005 02.28:
[...]
> I agree that I need a perl object book.
Not necessarily - it could even be better to buy a book that contains the OO
paradigmas independent from any programming language. The details of the
language (or the focus on implementation) cou
Ken Farmer wrote:
>
> Wiggins d'Anconia <[EMAIL PROTECTED]> wrote:
>
> See the other posters responses as well, but I think it might help if
> you read through some docs on OOP programming, check out:
>
> perldoc perlboot
> perldoc perltoot
> perldoc perltooc
>
> And issuing,
>
> perldoc perl
Wiggins d'Anconia <[EMAIL PROTECTED]> wrote:
See the other posters responses as well, but I think it might help if
you read through some docs on OOP programming, check out:
perldoc perlboot
perldoc perltoot
perldoc perltooc
And issuing,
perldoc perl
Thanks for the response, and the other res
Ken Farmer wrote:
> I have tried this question in a couple of other places but the answers are
> far above my current level of understanding of oop - which is the level of
> very interested newbie - real newbie. So here goes again.
>
> I make an empty (of data) perl object1 with an included m
> "Xavier" == Xavier Noria <[EMAIL PROTECTED]> writes:
Xavier> package class2;
Xavier> use base 'class1';
Except of course, lowercase package names are reserved for pragmata.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
http://www.stonehenge.com/
On Dec 7, 2005, at 4:36, Ken Farmer wrote:
I have tried this question in a couple of other places but the
answers are far above my current level of understanding of oop -
which is the level of very interested newbie - real newbie. So
here goes again.
I make an empty (of data) perl objec
For such simple class (no inheritance ...), you can just
use the standard module Class::Struct,
it will built constructor and accessors for you.
Then like Paul said :
"Just write a method (called 'init' in the example below)
which accepts the string,splits on the semi-colon,
and assigns the result
Well I use the AUTOLOAD when Such a thing is required
write a single function
sub AUTOLOAD {
my $self = shift;
my ($parameter)=shift;
my ($value)=shift;
$self->{$parameter} = $value if($value);
return $self->{$parameter};
}
Now U can use $obj->CNAME("ABC");
But we warned
--- Nicole Seitz <[EMAIL PROTECTED]> wrote:
> Hi there!
>
> I've just started to learn OOP with Perl.With the help of perltoot I wrote a
> class Person and some methods(see below).
'perltoot' is great, but there are a few things that can be done differently.
Admittedly, it's
aimed at beginners
On Wed, Nov 27, 2002 at 12:12:46AM +, Nicole Seitz wrote:
> Hi there!
>
> I've just started to learn OOP with Perl.With the help of perltoot I wrote a
> class Person and some methods(see below).
>
> package Person;
[ snip implementation ]
> To store some data in my object I did the follwi
There is an on-line forum for people who have read
Damian Conway's book, at
http://www.manning.com/getpage.html?project=conway&filename=forum.html
And anyone who is serious about OO Perl will read that book.
--
Peter Scott
http://www.perldebugged.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED
LRMK wrote:
Can any body tell me a address of a OOP mailing list for perl
Surprisingly I didn't see one specifically for that topic. Although most
questions on this topic could certainly be posed to the beginners list
as it is pretty general.
There is a nice list of lists at: http://lists.
Lakka,
Why are you passing the scalar object reference by reference to your
function? Just pass it as per normal and it will save you dereferencing
it with $$. Also, why do you have a '\' char before $_[0]? You're
creating another reference there. And are you actually blessing
$dxfInstance into a
> -Original Message-
> From: Lakka Sami [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 22, 2001 8:51 AM
> To: [EMAIL PROTECTED]
> Subject: OOP & Perl. References to methods
>
>
> Hi,
>
> I'm having problems with OOP and Perl. I have an class
> named DXFobject and an other class th
37 matches
Mail list logo