1 |
williamc |
1.2 |
#
|
2 |
|
|
# ScramFunctions.pm
|
3 |
|
|
#
|
4 |
|
|
# Written by Christopher Williams
|
5 |
|
|
#
|
6 |
|
|
# Description
|
7 |
|
|
#
|
8 |
|
|
# Interface
|
9 |
|
|
# ---------
|
10 |
|
|
# new() : A new ScramCommands object
|
11 |
|
|
# project(urlstring,dir[,areaname]): Create a project from the given url file
|
12 |
|
|
# return the area
|
13 |
|
|
# satellite(name,version,installdirectory[,areaname]): create a satellite
|
14 |
|
|
# project from the specified name version
|
15 |
|
|
# addareatoDB(ConfigArea[,name[,version]]) : add area to the db
|
16 |
|
|
# globalcache([cachedirectory])) : return the global cache object/set at dir.
|
17 |
|
|
# scramprojectdb() : return the scram project DB object
|
18 |
|
|
# areatoolbox(ConfigArea) : return the toolbox of the specified area
|
19 |
|
|
# setuptoolsinarea($area[,$toolname[,$toolversion[,toolfile]) : setup
|
20 |
|
|
# arch() : get/set the architecture string
|
21 |
williamc |
1.6 |
# scramobjectinterface(Class) : print out the interface of a scram class
|
22 |
williamc |
1.10 |
# webget(area,url) : get the url into the cache of the specified area
|
23 |
williamc |
1.8 |
# getversion() : return the current scram version
|
24 |
|
|
# spawnversion(version,@args) : spawn the scram version with the given args
|
25 |
williamc |
1.10 |
# classverbose(classstring,setting) : Set the class verbosity level
|
26 |
|
|
# toolruntime(ConfigArea): Get a runtime object withthe settings from
|
27 |
|
|
# the specified toolbox
|
28 |
williamc |
1.2 |
|
29 |
|
|
package Scram::ScramFunctions;
|
30 |
|
|
use URL::URLcache;
|
31 |
|
|
use Utilities::Verbose;
|
32 |
|
|
require 5.004;
|
33 |
|
|
|
34 |
|
|
@ISA=qw(Utilities::Verbose);
|
35 |
|
|
|
36 |
sashby |
1.11 |
sub new
|
37 |
|
|
{
|
38 |
|
|
my $class=shift;
|
39 |
|
|
$self={};
|
40 |
|
|
bless $self, $class;
|
41 |
|
|
# -- default settings
|
42 |
|
|
$self->{cachedir}=$ENV{HOME}."/.scramrc/globalcache";
|
43 |
|
|
$self->{scramprojectsdbdir}=$ENV{SCRAM_LOOKUPDB};
|
44 |
|
|
($self->{scram_top})=( $ENV{SCRAM_HOME}=~/(.*)\//) ;
|
45 |
|
|
|
46 |
|
|
return $self;
|
47 |
|
|
}
|
48 |
williamc |
1.2 |
|
49 |
williamc |
1.10 |
sub classverbose {
|
50 |
|
|
my $self=shift;
|
51 |
|
|
my $class=shift;
|
52 |
|
|
my $val=shift;
|
53 |
|
|
|
54 |
|
|
$ENV{"VERBOSE_".$class}=$val;
|
55 |
|
|
}
|
56 |
|
|
|
57 |
williamc |
1.2 |
sub project {
|
58 |
|
|
my $self=shift;
|
59 |
|
|
my $url=shift;
|
60 |
|
|
my $installarea=shift;
|
61 |
|
|
|
62 |
|
|
my $areaname="";
|
63 |
|
|
if ( @_ ) {
|
64 |
|
|
$areaname=shift;
|
65 |
|
|
}
|
66 |
|
|
require Configuration::BootStrapProject;
|
67 |
|
|
my $bs=Configuration::BootStrapProject->
|
68 |
|
|
new($self->globalcache(),$installarea);
|
69 |
|
|
$self->verbose("BootStrapping $url");
|
70 |
|
|
my $area=$bs->boot($url,$areaname);
|
71 |
|
|
if ( ! defined $area ) {
|
72 |
|
|
$self->error("Unable to create project area");
|
73 |
|
|
}
|
74 |
|
|
$area->archname($self->arch());
|
75 |
|
|
|
76 |
|
|
# -- download all tool description files
|
77 |
|
|
my $req=$self->arearequirements($area);
|
78 |
|
|
if ( defined $req ) {
|
79 |
|
|
$req->download($self->areatoolbox($area));
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
return $area;
|
83 |
|
|
}
|
84 |
|
|
|
85 |
sashby |
1.18 |
sub setuptoolsinarea
|
86 |
|
|
{
|
87 |
|
|
my $self=shift;
|
88 |
|
|
my $area=shift;
|
89 |
sashby |
1.19 |
|
90 |
sashby |
1.18 |
# -- initialise
|
91 |
|
|
print "Initialising setup procedure......","\n";
|
92 |
|
|
$self->_allprojectinitsearcher();
|
93 |
|
|
|
94 |
|
|
# -- create a new toolbox object
|
95 |
|
|
my $toolbox=$self->areatoolbox($area);
|
96 |
|
|
$toolbox->searcher($self->_allprojectinitsearcher());
|
97 |
|
|
|
98 |
|
|
if ( @_ )
|
99 |
|
|
{
|
100 |
|
|
# -- specific tool specified
|
101 |
|
|
if ( my $rv=$toolbox->toolsetup(@_) )
|
102 |
|
|
{
|
103 |
|
|
if ( $rv eq 1 )
|
104 |
|
|
{
|
105 |
|
|
print "Unknown tool $toolname @ARGV\n";
|
106 |
|
|
exit 1;
|
107 |
|
|
}
|
108 |
|
|
}
|
109 |
|
|
}
|
110 |
|
|
else
|
111 |
|
|
{
|
112 |
|
|
# -- setup all tools specified in the requirements doc
|
113 |
|
|
print "Going to set up all tools....","\n\n";
|
114 |
|
|
my $reqs=$self->arearequirements($area);
|
115 |
|
|
$self->verbose("Setup ToolBox from Requirements doc ($reqs)");
|
116 |
|
|
# reqs is a BuildSystem::Requirements object:
|
117 |
|
|
$reqs->setup($toolbox);
|
118 |
|
|
}
|
119 |
|
|
}
|
120 |
williamc |
1.2 |
|
121 |
|
|
sub satellite {
|
122 |
|
|
my $self=shift;
|
123 |
|
|
my $name=shift;
|
124 |
|
|
my $version=shift;
|
125 |
|
|
my $installarea=shift;
|
126 |
|
|
|
127 |
williamc |
1.4 |
my $areaname=undef;
|
128 |
williamc |
1.2 |
if ( @_ ) {
|
129 |
|
|
$areaname=shift;
|
130 |
|
|
}
|
131 |
|
|
|
132 |
|
|
# -- look up scram database for location
|
133 |
|
|
my $relarea=$self->_lookupareaindb($name,$version);
|
134 |
|
|
if ( ! defined $relarea ) {
|
135 |
|
|
$self->error("Unable to Find Project $name $version");
|
136 |
williamc |
1.4 |
}
|
137 |
|
|
|
138 |
|
|
# -- fix for old broken areas
|
139 |
|
|
if ( (! defined $relarea->version()) || ($relarea->version() eq "") ) {
|
140 |
|
|
$relarea->version($version);
|
141 |
williamc |
1.2 |
}
|
142 |
|
|
|
143 |
|
|
# -- create satellite
|
144 |
|
|
my $area=$relarea->satellite($installarea,$areaname);
|
145 |
|
|
$area->archname($self->arch());
|
146 |
|
|
|
147 |
|
|
# -- copy toolbox
|
148 |
|
|
my $rtb=$self->areatoolbox($relarea);
|
149 |
|
|
my $tb=$self->areatoolbox($area);
|
150 |
|
|
$rtb->copytools($tb);
|
151 |
|
|
|
152 |
|
|
# -- copy configuration directory
|
153 |
|
|
if ( ! -d $area->location()."/".$area->configurationdir() ) {
|
154 |
|
|
use Utilities::AddDir;
|
155 |
|
|
AddDir::copydir($relarea->location()."/".$relarea->configurationdir(),
|
156 |
|
|
$area->location()."/".$area->configurationdir() );
|
157 |
|
|
}
|
158 |
|
|
|
159 |
|
|
# -- copy RequirementsDoc
|
160 |
|
|
if ( ! -f $area->requirementsdoc() ) {
|
161 |
williamc |
1.3 |
use File::Copy;
|
162 |
williamc |
1.2 |
copy( $relarea->requirementsdoc() , $area->requirementsdoc());
|
163 |
|
|
}
|
164 |
|
|
|
165 |
|
|
return $area;
|
166 |
williamc |
1.7 |
}
|
167 |
|
|
|
168 |
williamc |
1.10 |
sub toolruntime {
|
169 |
williamc |
1.7 |
my $self=shift;
|
170 |
|
|
my $area=shift;
|
171 |
|
|
|
172 |
williamc |
1.10 |
my $name=$area->location();
|
173 |
|
|
if ( ! defined $self->{toolruntime}{$name} ) {
|
174 |
|
|
require Runtime;
|
175 |
|
|
my $toolbox=$self->areatoolbox($area);
|
176 |
|
|
$self->{toolruntime}{$name}=Runtime->new();
|
177 |
|
|
|
178 |
|
|
# -- add scram area specific runtimes
|
179 |
|
|
$self->{toolruntime}{$name}->addvar("LD_LIBRARY_PATH",
|
180 |
|
|
$area->location()."/lib/".$self->arch(),"path");
|
181 |
|
|
$self->{toolruntime}{$name}->addvar("PATH",
|
182 |
|
|
$area->location()."/bin/".$self->arch(),"path");
|
183 |
|
|
if ( defined $area->linkarea() ) {
|
184 |
|
|
my $reltop=$area->linkarea()->location();
|
185 |
|
|
$self->{toolruntime}{$name}->addvar("LD_LIBRARY_PATH",
|
186 |
|
|
$reltop."/lib/".$self->arch(),"path");
|
187 |
|
|
$self->{toolruntime}{$name}->addvar("PATH",
|
188 |
|
|
$reltop."/bin/".$self->arch(),"path");
|
189 |
|
|
}
|
190 |
|
|
|
191 |
|
|
# -- get the runtime environment from all the tools
|
192 |
|
|
my $tool;
|
193 |
|
|
foreach $toolname ( $toolbox->tools() ) {
|
194 |
|
|
$tool=$toolbox->gettool($toolname);
|
195 |
|
|
if ( defined $tool ) {
|
196 |
|
|
# -- get runtime paths
|
197 |
|
|
foreach $f ( $tool->listtype("runtime_path")) {
|
198 |
|
|
foreach $val ( $tool->getfeature($f) ) {
|
199 |
|
|
$self->{toolruntime}{$name}->addvar($f,$val,"path");
|
200 |
|
|
}
|
201 |
|
|
}
|
202 |
|
|
# -- get runtime vars
|
203 |
|
|
foreach $f ( $tool->listtype("runtime")) {
|
204 |
|
|
foreach $val ( $tool->getfeature($f) ) {
|
205 |
|
|
$self->{toolruntime}{$name}->addvar($f,$val);
|
206 |
|
|
}
|
207 |
|
|
}
|
208 |
|
|
}
|
209 |
|
|
}
|
210 |
|
|
|
211 |
|
|
# -- Get the project level environment
|
212 |
|
|
my $runtimefile=$area->location()."/".$area->configurationdir()
|
213 |
|
|
."/Runtime";
|
214 |
|
|
if ( -f $runtimefile ) {
|
215 |
|
|
$self->{toolruntime}{$name}->file($runtimefile);
|
216 |
|
|
}
|
217 |
|
|
}
|
218 |
|
|
return $self->{toolruntime}{$name};
|
219 |
|
|
}
|
220 |
|
|
|
221 |
|
|
sub webget {
|
222 |
|
|
my $self=shift;
|
223 |
|
|
my $area=shift;
|
224 |
|
|
my $url=shift;
|
225 |
|
|
|
226 |
|
|
require URL::URLhandler;
|
227 |
|
|
my $handler=URL::URLhandler->new($area->cache());
|
228 |
|
|
return ($handler->download($url));
|
229 |
williamc |
1.2 |
}
|
230 |
|
|
|
231 |
|
|
sub addareatoDB {
|
232 |
|
|
my $self=shift;
|
233 |
|
|
my $area=shift;
|
234 |
|
|
my $tagname=shift;
|
235 |
|
|
my $version=shift;
|
236 |
|
|
|
237 |
|
|
# -- create defaults if necessary
|
238 |
|
|
if ( (! defined $version) || ( $version eq "") ) {
|
239 |
|
|
$version=$area->version();
|
240 |
|
|
}
|
241 |
|
|
if ( (! defined $tagname) || ( $tagname eq "") ) {
|
242 |
|
|
$tagname=$area->name();
|
243 |
|
|
}
|
244 |
|
|
|
245 |
|
|
# -- Add to the DB
|
246 |
|
|
$self->scramprojectdb()->addarea($tagname,$version,$area);
|
247 |
|
|
}
|
248 |
|
|
|
249 |
sashby |
1.13 |
|
250 |
|
|
sub removeareafromDB
|
251 |
|
|
{
|
252 |
|
|
###############################################################
|
253 |
|
|
# removearefromDB() #
|
254 |
|
|
###############################################################
|
255 |
|
|
# modified : Thu Jun 14 10:46:22 2001 / SFA #
|
256 |
|
|
# params : projectname, projectversion #
|
257 |
|
|
# : #
|
258 |
|
|
# : #
|
259 |
|
|
# : #
|
260 |
|
|
# function : Remove project <projectname> from DB file. #
|
261 |
|
|
# : #
|
262 |
|
|
# : #
|
263 |
|
|
###############################################################
|
264 |
|
|
my $self=shift;
|
265 |
|
|
my $projname=shift;
|
266 |
|
|
my $version=shift;
|
267 |
|
|
|
268 |
|
|
# -- Remove from the DB:
|
269 |
|
|
$self->scramprojectdb()->removearea($projname,$version);
|
270 |
|
|
}
|
271 |
|
|
|
272 |
|
|
|
273 |
sashby |
1.12 |
sub spawnversion
|
274 |
|
|
{
|
275 |
sashby |
1.15 |
###############################################################
|
276 |
|
|
# spawnversion #
|
277 |
|
|
###############################################################
|
278 |
|
|
# modified : Fri Aug 10 15:42:08 2001 / SFA #
|
279 |
|
|
# params : #
|
280 |
|
|
# : #
|
281 |
|
|
# : #
|
282 |
|
|
# : #
|
283 |
|
|
# function : Check for version of scram to run, and run it. #
|
284 |
|
|
# : #
|
285 |
|
|
# : #
|
286 |
|
|
###############################################################
|
287 |
|
|
|
288 |
sashby |
1.12 |
my $self=shift;
|
289 |
|
|
my $version=shift;
|
290 |
|
|
my $rv=0;
|
291 |
|
|
|
292 |
|
|
my $thisversion=$self->getversion();
|
293 |
williamc |
1.8 |
|
294 |
sashby |
1.12 |
if ( defined $version )
|
295 |
|
|
{
|
296 |
|
|
if ( $version ne $thisversion )
|
297 |
|
|
{
|
298 |
|
|
# first try to use the correct version
|
299 |
|
|
if ( -d $self->{scram_top}."/".$version )
|
300 |
|
|
{
|
301 |
|
|
$ENV{SCRAM_HOME}=$self->{scram_top}."/".$version;
|
302 |
|
|
$ENV{TOOL_HOME}="$ENV{SCRAM_HOME}/src";
|
303 |
|
|
$self->verbose("Spawning SCRAM version $version");
|
304 |
sashby |
1.17 |
|
305 |
sashby |
1.12 |
my $rv=system("scram", @_)/256;
|
306 |
|
|
exit $rv;
|
307 |
|
|
}
|
308 |
|
|
else
|
309 |
|
|
{ # if not then simply warn
|
310 |
|
|
print "******* Warning : scram version inconsistent ********\n";
|
311 |
|
|
print "This version: $thisversion; Required version: $version\n";
|
312 |
|
|
print "*****************************************************\n";
|
313 |
|
|
print "\n";
|
314 |
|
|
}
|
315 |
|
|
}
|
316 |
|
|
}
|
317 |
|
|
else
|
318 |
|
|
{
|
319 |
|
|
$self->error("Undefined value for version requested");
|
320 |
|
|
$rv=1;
|
321 |
|
|
}
|
322 |
|
|
return $rv;
|
323 |
|
|
}
|
324 |
williamc |
1.8 |
|
325 |
williamc |
1.2 |
sub globalcache {
|
326 |
|
|
my $self=shift;
|
327 |
|
|
if ( @_ ) {
|
328 |
|
|
$self->{cachedir}=shift;
|
329 |
|
|
}
|
330 |
|
|
if ( ! defined $self->{globalcache} ) {
|
331 |
|
|
$self->{globalcache}=URL::URLcache->new($self->{cachedir});
|
332 |
|
|
}
|
333 |
|
|
return $self->{globalcache};
|
334 |
|
|
}
|
335 |
|
|
|
336 |
|
|
|
337 |
|
|
sub scramprojectdb {
|
338 |
|
|
my $self=shift;
|
339 |
|
|
if ( @_ ) {
|
340 |
|
|
$self->{scramprojectsdbdir}=shift;
|
341 |
|
|
}
|
342 |
|
|
if ( ! defined $self->{scramprojectsdb} ) {
|
343 |
|
|
require Scram::ScramProjectDB;
|
344 |
|
|
$self->{scramprojectsdb}=Scram::ScramProjectDB->new(
|
345 |
|
|
$self->{scramprojectsdbdir} );
|
346 |
|
|
$self->{scramprojectsdb}->verbosity($self->verbosity());
|
347 |
|
|
}
|
348 |
|
|
return $self->{scramprojectsdb};
|
349 |
|
|
}
|
350 |
williamc |
1.8 |
|
351 |
|
|
sub getversion {
|
352 |
|
|
my $self=shift;
|
353 |
|
|
|
354 |
|
|
my $thisversion;
|
355 |
|
|
($thisversion=$ENV{SCRAM_HOME})=~s/(.*)\///;
|
356 |
|
|
my $scram_top=$1;
|
357 |
|
|
my $scram_version=$thisversion;
|
358 |
|
|
# deal with links
|
359 |
|
|
my $version=readlink $ENV{SCRAM_HOME};
|
360 |
|
|
if ( defined $version) {
|
361 |
|
|
$scram_version=$version;
|
362 |
|
|
}
|
363 |
|
|
return $scram_version;
|
364 |
|
|
}
|
365 |
williamc |
1.2 |
|
366 |
|
|
sub areatoolbox {
|
367 |
|
|
my $self=shift;
|
368 |
|
|
my $area=shift;
|
369 |
|
|
|
370 |
|
|
my $name=$area->location();
|
371 |
|
|
if ( ! defined $self->{toolboxes}{$name} ) {
|
372 |
|
|
# -- create a new toolbox object
|
373 |
|
|
require BuildSystem::ToolBox;
|
374 |
williamc |
1.8 |
$self->{toolboxes}{$name}=BuildSystem::ToolBox->new($area,
|
375 |
|
|
$self->arch());
|
376 |
williamc |
1.2 |
$self->{toolboxes}{$name}->verbosity($self->verbosity());
|
377 |
|
|
}
|
378 |
|
|
return $self->{toolboxes}{$name};
|
379 |
|
|
}
|
380 |
|
|
|
381 |
|
|
sub arearequirements {
|
382 |
|
|
my $self=shift;
|
383 |
|
|
my $area=shift;
|
384 |
|
|
|
385 |
|
|
my $name=$area->location();
|
386 |
|
|
if ( ! defined $self->{requirements}{$name} ) {
|
387 |
|
|
# -- create a new toolbox object
|
388 |
|
|
require BuildSystem::Requirements;
|
389 |
|
|
my $doc=$area->requirementsdoc();
|
390 |
|
|
my $cache=$area->cache();
|
391 |
|
|
my $db=$area->objectstore();
|
392 |
|
|
require ActiveDoc::ActiveStore;
|
393 |
|
|
my $astore=ActiveDoc::ActiveStore->new($db,$cache);
|
394 |
|
|
$self->{requirements}{$name}=
|
395 |
|
|
BuildSystem::Requirements->new($astore,"file:".$doc,
|
396 |
|
|
$ENV{SCRAM_ARCH});
|
397 |
|
|
$self->{requirements}{$name}->verbosity($self->verbosity());
|
398 |
|
|
$self->verbose("Requirements Doc (".$self->{requirements}{$name}.
|
399 |
|
|
") for area :\n $name\n initiated from $doc");
|
400 |
|
|
}
|
401 |
|
|
else {
|
402 |
|
|
$self->verbose("Requirements Doc (".$self->{requirements}{$name}.")");
|
403 |
|
|
}
|
404 |
|
|
return $self->{requirements}{$name};
|
405 |
|
|
}
|
406 |
|
|
|
407 |
|
|
sub arch {
|
408 |
|
|
my $self=shift;
|
409 |
|
|
|
410 |
|
|
@_?$self->{arch}=shift
|
411 |
|
|
:$self->{arch};
|
412 |
williamc |
1.6 |
}
|
413 |
|
|
|
414 |
|
|
sub scramobjectinterface {
|
415 |
williamc |
1.10 |
my $self=shift;
|
416 |
|
|
my $class=shift;
|
417 |
williamc |
1.6 |
|
418 |
williamc |
1.10 |
my $file;
|
419 |
|
|
($file=$class."\.pm")=~s/::/\//g;
|
420 |
|
|
$file=$ENV{TOOL_HOME}."/".$file;
|
421 |
williamc |
1.6 |
|
422 |
williamc |
1.10 |
if ( ! -f $file ) {
|
423 |
|
|
$self->error("Unable to find $class in ".$ENV{TOOL_HOME});
|
424 |
|
|
}
|
425 |
|
|
print "--------------------- $class ------------------\n";
|
426 |
|
|
my $fh=FileHandle->new();
|
427 |
williamc |
1.6 |
$fh->open("<$file");
|
428 |
|
|
while ( <$fh> ) {
|
429 |
|
|
if ( $_=~/#\s*Interface/g ) {
|
430 |
|
|
$intregion=1;
|
431 |
|
|
next;
|
432 |
|
|
}
|
433 |
|
|
if ( $intregion ) { # if we are in the interface documentation
|
434 |
|
|
if ( ( $_!~/^#/ ) || ( $_=~/^#\s?-{40}/ ) ) { #moving out of Int doc
|
435 |
|
|
$intregion=0;
|
436 |
|
|
next;
|
437 |
|
|
}
|
438 |
|
|
print $_;
|
439 |
|
|
if ( $_=~/^#\s*(.*)\((.*)\)?:(.*)/ ) {
|
440 |
|
|
$interface=$1;
|
441 |
|
|
$args=$2;
|
442 |
|
|
$rest=$3;
|
443 |
|
|
next if ($interface eq "");
|
444 |
|
|
push @interfaces,$interface;
|
445 |
|
|
$interfaceargs{$interface}=$args;
|
446 |
|
|
}
|
447 |
|
|
}
|
448 |
|
|
}
|
449 |
|
|
print "\n";
|
450 |
williamc |
1.10 |
undef $fh;
|
451 |
williamc |
1.2 |
}
|
452 |
|
|
|
453 |
|
|
# -------------- Support Routines ------------------------------
|
454 |
|
|
|
455 |
|
|
|
456 |
|
|
sub _allprojectinitsearcher {
|
457 |
|
|
if ( ! defined $self->{projsearcher} ) {
|
458 |
|
|
my $search=_projsearcher();
|
459 |
|
|
foreach $proj ( $self->scramprojectdb()->list() ) {
|
460 |
|
|
$search->addproject($$proj[0],$$proj[1]);
|
461 |
|
|
}
|
462 |
|
|
}
|
463 |
williamc |
1.10 |
return $self->{projsearcher};
|
464 |
williamc |
1.2 |
}
|
465 |
|
|
|
466 |
|
|
sub _projsearcher {
|
467 |
|
|
if ( ! defined $self->{projsearcher} ) {
|
468 |
|
|
require Scram::ProjectSearcher;
|
469 |
|
|
$self->{projsearcher}=Scram::ProjectSearcher->new(
|
470 |
|
|
$self->scramprojectdb());
|
471 |
|
|
}
|
472 |
|
|
return $self->{projsearcher};
|
473 |
|
|
}
|
474 |
|
|
|
475 |
|
|
|
476 |
|
|
sub _lookupareaindb {
|
477 |
|
|
my $self=shift;
|
478 |
|
|
|
479 |
|
|
my $area=undef;
|
480 |
|
|
# -- Look up the area in the databse
|
481 |
|
|
my @areas=$self->scramprojectdb()->getarea(@_);
|
482 |
|
|
if ( $#areas > 0 ) { #ambigous
|
483 |
|
|
# could ask user - for now just error
|
484 |
|
|
$self->error("Ambigous request - please be more specific");
|
485 |
|
|
}
|
486 |
|
|
elsif ( $#areas != 0 ) { #not found
|
487 |
|
|
$self->error("The project requested has not been found");
|
488 |
|
|
}
|
489 |
|
|
else {
|
490 |
|
|
$area=$areas[0];
|
491 |
|
|
}
|
492 |
|
|
return $area;
|
493 |
|
|
}
|