d_i_r_t_y has asked for the wisdom of the Perl Monks concerning the following question:
in each of my 258 perl modules i have a line like the follwing, corresponding to the current CVS revision:
our $CVS_REVISION = q!$Id: Action.pm,v 1.62 02/4/4 03:16:10 matt $!;
i'm trying to write a debugging routine which iterates over the keys of %INC (ie: to get the list of currently loaded modules), looking for the existence of this very $CVS_REVISION variable. I have been trying to use symbolic references (such as the code below) to achieve this, so far unsuccessfully. can anyone correct me?
{ no strict; local $^W = undef; my @versions = (); foreach my $class ( sort keys %INC ) { $class =~ s/\.pm$// or next; $class =~ s/\//::/g; my $version = ${"$class\::CVS_VERSION"} || next; push @versions, "$class -> $version"; } }
cheers, matt
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: 'reflection', aka traversing symbol tables
by Zaxo (Archbishop) on Apr 06, 2002 at 07:48 UTC | |
by d_i_r_t_y (Monk) on Apr 06, 2002 at 08:33 UTC | |
Re: 'reflection', aka traversing symbol tables
by rjray (Chaplain) on Apr 06, 2002 at 08:47 UTC | |
ITYM
by Fletch (Bishop) on Apr 06, 2002 at 13:40 UTC | |
Re: 'reflection', aka traversing symbol tables
by Anonymous Monk on Apr 06, 2002 at 21:46 UTC |