Merge pull request #228 from DOCGroup/jwillemsen-patch-1
[MPC.git] / modules / WorkspaceHelper.pm
blob58ff37efdd56493beeb1b75b0a6f05d0006fbf82
1 package WorkspaceHelper;
3 # ************************************************************
4 # Description : Base class and factory for all workspace helpers
5 # Author : Chad Elliott
6 # Create Date : 9/01/2004
7 # ************************************************************
9 # ************************************************************
10 # Pragmas
11 # ************************************************************
13 use strict;
15 # ************************************************************
16 # Data Section
17 # ************************************************************
19 my %required;
21 # ************************************************************
22 # Subroutine Section
23 # ************************************************************
25 sub get {
26 my $type = shift;
28 ## Create the helper name
29 $type =~ s/Creator/Helper/;
30 $type =~ s/=HASH.*//;
32 ## If we can find a helper with this name, we will
33 ## create a singleton of that type and return it.
34 if (!$required{$type}) {
35 foreach my $inc (@INC) {
36 if (-r "$inc/$type.pm") {
37 require "$type.pm";
38 $required{$type} = $type->new();
39 last;
43 ## If we can't find the helper, we just create an
44 ## empty helper and return that.
45 $required{$type} = new WorkspaceHelper() if (!$required{$type});
48 return $required{$type};
52 sub new {
53 my $class = shift;
54 return bless {}, $class;
58 sub modify_value {
59 my($self, $name, $value) = @_;
60 return $value;
64 sub modify_libpath {
65 #my $self = shift;
66 #my $str = shift;
67 #my $reldir = shift;
68 #my $libname = shift;
69 return undef;
73 sub write_settings {
74 #my $self = shift;
75 #my $fh = shift;
76 #my @locals = @_;
77 return 1, undef;
81 sub perform_custom_processing {
82 #my $self = shift;
83 #my $fh = shift;
84 #my $creator = shift;
85 #my $toplevel = shift;