> The way I read your post had the encapsulation bells ringing.
>
> Again, symbolic references offer a possible solution:-
>
> <code>
>
> package Root;
> $me = 'How much?';
>
> package main;
> use strict;
> use warnings;
>
> my $package = 'Root';
> my $var_name = 'me';
>
> # And ducking the rotten tomatoes he continues with
> no strict 'refs';     
> print 'I was quibbed with "' . ${"${package}::$var_name"} . qq{"\n};
>
> ${"${package}::$var_name"} = 'For you? Ten dollars';
>
> print 'So I replied "' . ${"${package}::$var_name"} . '"';
>
> </code>
>
> Typeglobs and aliasing may be more revered though.
Thanks Justin, your sample codes did the trick. Damn, I didn't know it 
requires so many quotes!

Regarding your (hint) on encapsulation, can you encapsulate class variables?

I've always treated typeglobs as a not-if-i-can-help-it kind of feature, 
but if you've a sample code to demonstrate an alternative (if not 
better) way, I'd like to keep my options open.

But in any case, you did in 5 min what ramming my head against the wall 
couldn't. :)


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to