[Israel.pm] package aliasing?

Shmuel Fomberg semuelf at 012.net.il
Fri Feb 2 04:29:49 PST 2007


Hello There.

A quick look inside Package::Alias, reveal the trick:
BEGIN { *A:: = \*B::; }

It have to be inside a begin block. (make sense - all the binding
happens  in compile time)

Thanks to all.
Shmuel.

-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
Behalf Of Adriano Ferreira
Sent: Wednesday, January 31, 2007 8:50 PM
To: Perl in Israel
Subject: Re: [Israel.pm] package aliasing?

On 1/31/07, Shmuel Fomberg <semuelf at 012.net.il> wrote:
> Can I make one package an alias of another?
> I want that all the variables and subs called through package A will
be
> actually answered by package B.
> Something like: *A:: = *B::
> Can I?

It is more like this:

*A:: = \*B::

or you can use CPAN modules like Package::Alias:

use Package::Alias A => 'B';

There are others, but I cannot find them right now.

Adriano Ferreira.
_______________________________________________
Perl mailing list
Perl at perl.org.il
http://perl.org.il/mailman/listinfo/perl


-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.19/663 - Release Date:
01/02/2007 14:28





More information about the Perl mailing list