[Bio] / FigKernelPackages / FIGAttributes.pm Repository:
ViewVC logotype

Annotation of /FigKernelPackages/FIGAttributes.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download) (as text)

1 : olson 1.1
2 :     package FIGAttributes;
3 :    
4 :     require v5.6.0;
5 :    
6 :     use Exporter;
7 :     use base 'Exporter';
8 :     @EXPORT = qw(%_FunctionAttributes);
9 : parrello 1.2
10 : olson 1.1 use strict;
11 :    
12 :     no warnings 'redefine';
13 :    
14 :    
15 :     #
16 :     # We use the methods below to process the subroutine attributes.
17 :     #
18 :     # See
19 :     # http://www.perldoc.com/perl5.8.4/pod/perlsub.html
20 :     # http://www.perldoc.com/perl5.8.4/lib/attributes.html
21 :     # http://www.perldoc.com/perl5.8.4/lib/Attribute/Handlers.html
22 :     #
23 :     # for details.
24 :     #
25 :     # We take action on the following attributes:
26 :     #
27 : parrello 1.2 # Remote Allow remote access to this function.
28 :     # Scalar Function returns a scalar.
29 :     # List Function returns a list.
30 : olson 1.1 # method This function is actually a method, and expects $self as the first arg.
31 :     #
32 :     # If an attribute is set for a function in some package, we
33 :     # will update a table %Package::_FunctionAttributes which is
34 :     # keyed on the (string) for the coderef, and which has value
35 :     # of a list of attribute values.
36 :     #
37 :    
38 :     sub MODIFY_CODE_ATTRIBUTES
39 :     {
40 :     my($pkg, $sub, @attrs) = @_;
41 :    
42 :     for my $attr (@attrs)
43 :     {
44 :     set_code_attribute($pkg, $sub, $attr);
45 :     }
46 :     return ();
47 :     }
48 :    
49 :     sub set_code_attribute
50 :     {
51 :     my($package, $coderef, $attr, $data) = @_;
52 :    
53 :     # print "Set code attr for $package $coderef $attr d=$data\n";
54 :     my $str = "package $package;\n";
55 :     $str .= <<'EOE';
56 :     $_FunctionAttributes{$coderef}->{$attr} = $data;
57 :     #print "in set_code_attribute: \n", Dumper(\%_FunctionAttributes);
58 :     EOE
59 :     eval $str;
60 :     if ($@ ne "")
61 :     {
62 :     warn "EVAL failed: $@\n";
63 :     }
64 :     }
65 : parrello 1.2
66 : olson 1.1 1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3