in reply to Abstract Factory

Hi,

Have a look at this Perl.com article on Design patterns.

Hope this helps

Martin

Replies are listed 'Best First'.
Re^2: Abstract Factory
by Khatri (Scribe) on Oct 03, 2005 at 22:49 UTC
    I've already seen it http://www.perl.com/pub/a/1999/09/refererents.html

      What part don't you understand?

      Steve
      --
        package Greet::Repeat; sub new { my $class = shift; my $self = { greeting => shift, repeat => shift, }; return bless $self, $class; } sub greet { my $self = shift; print ($self->{greeting} x $self->{repeat}); } 1;
        doesn't understand the role of shift and bless, completely; where we have greeting and repeat are being shift.
        #!/bin/perl package first; use strict; use warnings; sub new{ my $class = shift; my $type = shift; return bless \$type, $class; } sub greet { my $type = shift; print "\n hello got something .. $$type \n"; } 1; package AFactory; use strict; use warnings; sub get_new { my $class = shift; my $type = shift; return $class->new(@_); } 1; my $greeter = AFactory->get_new("first","dow dow"); $greeter->greet(); print "hellow\n";
        !!!error is : Can't locate object method "new" via package "AFactory" at new.pl line 31.