/[cvs]/nfo/perl/libs/Data/Rap/Extension/PrebootParser.pm
ViewVC logotype

Annotation of /nfo/perl/libs/Data/Rap/Extension/PrebootParser.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Tue Feb 18 15:36:46 2003 UTC (21 years, 4 months ago) by joko
Branch: MAIN
+ initial commit

1 joko 1.1 ## ----------------------------------------------------------------------
2     ## $Id: Ref.pm,v 1.1 2003/01/22 17:59:22 root Exp $
3     ## ----------------------------------------------------------------------
4     ## $Log: Ref.pm,v $
5     ## ----------------------------------------------------------------------
6    
7    
8     package Data::Rap::Extension::PrebootParser;
9    
10     use strict;
11     use warnings;
12    
13    
14     use Data::Dumper;
15    
16    
17     sub _prebootparser_start {
18     my $self = shift;
19     $self->_add_inc(@_);
20     $self->_load_config(@_);
21     }
22    
23     sub _add_inc {
24     my $self = shift;
25    
26     # get some variables from preboot-config
27     my $basepath = $self->get_property('app.config.preboot.path.base');
28     my $pathlist = $self->get_property('app.config.preboot.path.libs');
29    
30     # trace
31     #$basepath = "abc";
32     #print Dumper($pathlist);
33    
34     # build list of paths to be added to @INC
35     map {
36     # make relative paths absolute (if no leading "/" or e.g. "c:\" or e.g. "c:/" is present)
37     !m/^\// && !m/^\w:[\/|\\]/ && ($_ = "$basepath/$_");
38     # substitute backslashes through slashes
39     $_ =~ s/\\/\//g;
40     $_ =~ s/\/$//;
41     } @$pathlist;
42    
43     # trace
44     #print Dumper($pathlist);
45     #exit;
46    
47     # use local modules first
48     unshift @INC, @$pathlist;
49    
50     # use modules from repository first
51     #push @INC, @pathlist;
52    
53     }
54    
55     sub _load_config {
56     my $self = shift;
57     my $args = shift;
58     my $preboot = $self->get_property('app.config.preboot');
59    
60     my $module = $preboot->{module}->{config};
61     #print Dumper($preboot);
62     #exit;
63     $self->loadFromPerlModule($module, $args->{name}, $args->{'varnames'});
64     }
65    
66    
67     =pod
68    
69     sub parseIncludePaths_old {
70    
71     my @libpaths = @{$PREBOOT->{path}{libs}};
72    
73     # build list of paths to be added to @INC
74     map {
75     # make relative paths absolute (if no leading "/" or e.g. "c:\" or e.g. "c:/" is present)
76     !m/^\// && !m/^\w:[\/|\\]/ && ($_ = "$PREBOOT->{path}{base}/$_");
77     # substitute backslashes through slashes
78     $_ =~ s/\\/\//g;
79     $_ =~ s/\/$//;
80     } @libpaths;
81    
82     my @INC_ADDITIONAL = (
83     #"$path_base/etc", "$path_base/lib", "$path_base/bin",
84     #$PREBOOT->{path}{libs},
85     @libpaths,
86     );
87    
88     addIncludePaths(@INC_ADDITIONAL);
89    
90     }
91    
92     sub addIncludePaths_old {
93    
94     my @pathlist = @_;
95    
96     # if context says we are under apache, modify @INC
97     if ($PREBOOT->{context}->{type} eq CONTEXT_APACHE ||
98     $PREBOOT->{context}->{type} eq CONTEXT_CONSOLE ||
99     $PREBOOT->{context}->{type} eq CONTEXT_HARNESS) {
100    
101     # use our libraries first!
102     # why? in case we deliver some older, but required versions -
103     # unfortunately "Class::Tangram" is such a candidate for now
104     # TODO: make a switch here to optionally use System-/CPAN-libraries first
105     # if ($use_system_libs) {
106     # push @INC, @INC_ADDITIONAL;
107     # }
108     unshift @INC, @pathlist;
109    
110    
111     # # try with "use lib" - would still be preferred method -
112     # # modifying "@INC" may cause problems!
113     # foreach my $incpath (@INC_ADDITIONAL) {
114     # print "inc: $incpath\n";
115     # if (grep(/$incpath/m, @INC)) {
116     # #print $incpath, "\n";
117     # #eval("use lib '$incpath';");
118     # }
119     # }
120    
121     }
122    
123     }
124    
125     =cut
126    
127    
128     1;
129     __END__

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