in reply to Re^3: Abstract Factory
in thread Abstract Factory
!!!error is : Can't locate object method "new" via package "AFactory" at new.pl line 31.#!/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";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Abstract Factory
by Happy-the-monk (Canon) on Oct 06, 2005 at 19:22 UTC |