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

Annotation of /FigKernelPackages/FIGAttributes.pm

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : olson 1.3 #
2 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 : olson 1.1
19 :     package FIGAttributes;
20 :    
21 : overbeek 1.4 #require v5.6.0;
22 : olson 1.1
23 :     use Exporter;
24 :     use base 'Exporter';
25 :     @EXPORT = qw(%_FunctionAttributes);
26 : parrello 1.2
27 : olson 1.1 use strict;
28 :    
29 :     no warnings 'redefine';
30 :    
31 :    
32 :     #
33 :     # We use the methods below to process the subroutine attributes.
34 :     #
35 :     # See
36 :     # http://www.perldoc.com/perl5.8.4/pod/perlsub.html
37 :     # http://www.perldoc.com/perl5.8.4/lib/attributes.html
38 :     # http://www.perldoc.com/perl5.8.4/lib/Attribute/Handlers.html
39 :     #
40 :     # for details.
41 :     #
42 :     # We take action on the following attributes:
43 :     #
44 : parrello 1.2 # Remote Allow remote access to this function.
45 :     # Scalar Function returns a scalar.
46 :     # List Function returns a list.
47 : olson 1.1 # method This function is actually a method, and expects $self as the first arg.
48 :     #
49 :     # If an attribute is set for a function in some package, we
50 :     # will update a table %Package::_FunctionAttributes which is
51 :     # keyed on the (string) for the coderef, and which has value
52 :     # of a list of attribute values.
53 :     #
54 :    
55 :     sub MODIFY_CODE_ATTRIBUTES
56 :     {
57 :     my($pkg, $sub, @attrs) = @_;
58 :    
59 :     for my $attr (@attrs)
60 :     {
61 :     set_code_attribute($pkg, $sub, $attr);
62 :     }
63 :     return ();
64 :     }
65 :    
66 :     sub set_code_attribute
67 :     {
68 :     my($package, $coderef, $attr, $data) = @_;
69 :    
70 :     # print "Set code attr for $package $coderef $attr d=$data\n";
71 :     my $str = "package $package;\n";
72 :     $str .= <<'EOE';
73 :     $_FunctionAttributes{$coderef}->{$attr} = $data;
74 :     #print "in set_code_attribute: \n", Dumper(\%_FunctionAttributes);
75 :     EOE
76 :     eval $str;
77 :     if ($@ ne "")
78 :     {
79 :     warn "EVAL failed: $@\n";
80 :     }
81 :     }
82 : parrello 1.2
83 : olson 1.1 1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3