in reply to Re: Hiding Internal Classes ?
in thread Hiding Internal Classes ?
use v5.6.1; #ActiveState build 626 use strict; use warnings; package Foo; sub bar { print "Foo::bar has been called\n"; } sub new { my $s= 0; return bless \$s, "Foo"; } package main; *newFoo= \&Foo::new; my $x1= new Foo::; $x1->bar(); # OK print "before:", join (' ', keys %main::), "\n"; delete $main::{"Foo::"}; print "after:", join (' ', keys %main::), "\n"; $x1->bar(); # still works! my $x2= newFoo(); # works $x2->bar(); # can't find "Foo"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(tye)Re2: Hiding Internal Classes ?
by tye (Sage) on Jul 11, 2001 at 01:46 UTC | |
by John M. Dlugosz (Monsignor) on Jul 11, 2001 at 01:55 UTC | |
by tye (Sage) on Jul 11, 2001 at 01:58 UTC | |
by John M. Dlugosz (Monsignor) on Jul 11, 2001 at 02:02 UTC |