/[cvs]/nfo/perl/libs/Data/Mungle/Code/Symbol.pm
ViewVC logotype

Diff of /nfo/perl/libs/Data/Mungle/Code/Symbol.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by joko, Tue May 13 07:33:38 2003 UTC revision 1.4 by joko, Fri Jun 6 03:25:42 2003 UTC
# Line 2  Line 2 
2  ##  $Id$  ##  $Id$
3  ## ---------------------------------------------------------------------------  ## ---------------------------------------------------------------------------
4  ##  $Log$  ##  $Log$
5    ##  Revision 1.4  2003/06/06 03:25:42  joko
6    ##  + sub alias_simple
7    ##
8  ##  Revision 1.3  2003/05/13 07:33:38  joko  ##  Revision 1.3  2003/05/13 07:33:38  joko
9  ##  enhanced: now can get symbols as list or hash  ##  enhanced: now can get symbols as list or hash
10  ##  ##
# Line 18  Line 21 
21    
22  =head1 TODO  =head1 TODO
23    
24    o Investigate: Could this functionality be replaced through Perl's core/lib/Symbol.pm?    o Investigate: Could this functionality be completely replaced through CPAN's
25         - Symbol.pm?
26         - Alias.pm?
27        
28    
29  =cut  =cut
# Line 33  require Exporter; Line 38  require Exporter;
38  our @ISA = qw( Exporter );  our @ISA = qw( Exporter );
39  our @EXPORT_OK = qw(  our @EXPORT_OK = qw(
40    export_symbols    export_symbols
41      alias_simple
42  );  );
43    
44    
45  use Data::Mungle::Code::Ref qw( get_coderef );  use Data::Mungle::Code::Ref qw( get_coderef );
46    use Symbol;
47    
48  sub export_symbols {  sub export_symbols {
49    my $symbols = shift;    my $symbols = shift;
# Line 64  sub export_symbols { Line 71  sub export_symbols {
71    }    }
72  }  }
73    
74    # Qualifies a variable identified by package name and variable
75    # name into a valid symbol, resolves that symbol and stores the
76    # result (a reference to this variable) into the designated target (slot).
77    sub alias_simple {
78      my $rule = shift;
79      my $target = $rule->{slot};
80      my $name = $rule->{alias};
81      my $sym = qualify($rule->{var_name}, $rule->{var_pkg});
82      {
83        no strict 'refs';
84        $target->{$name} = ${$sym};
85      }
86    }
87    
88  1;  1;
89    __END__

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed