source: OFFICIAL/FCM_V1.3/lib/Fcm/ExtractSrc.pm

Last change on this file was 1, checked in by fcm, 15 years ago

creation de larborescence

File size: 2.3 KB
Line 
1#!/usr/bin/perl
2# ------------------------------------------------------------------------------
3# NAME
4#   Fcm::ExtractSrc
5#
6# DESCRIPTION
7#   This class is used by the extract system to define the functionalities of a
8#   source file (or directory) in a branch.
9#
10# COPYRIGHT
11#   (C) Crown copyright Met Office. All rights reserved.
12#   For further details please refer to the file COPYRIGHT.txt
13#   which you should have received as part of this distribution.
14# ------------------------------------------------------------------------------
15
16package Fcm::ExtractSrc;
17@ISA = qw(Fcm::Base);
18
19# Standard pragma
20use warnings;
21use strict;
22
23# FCM component modules
24use Fcm::Base;
25
26# List of scalar property methods for this class
27my @scalar_properties = (
28  'cache',   # location of the cache of this file in the current extract
29  'id',      # short ID of the branch where this file is from
30  'ignore',  # if set to true, ignore this file from this source
31  'pkgname', # package name of this file
32  'rev',     # last changed revision/timestamp of this file
33  'uri',     # URL/source path of this file
34);
35
36# ------------------------------------------------------------------------------
37# SYNOPSIS
38#   $obj = Fcm::ExtractSrc->new (%args);
39#
40# DESCRIPTION
41#   This method constructs a new instance of the Fcm::ExtractSrc class. See
42#   @scalar_properties above for allowed list of properties in the constructor.
43# ------------------------------------------------------------------------------
44
45sub new {
46  my $this  = shift;
47  my %args  = @_;
48  my $class = ref $this || $this;
49
50  my $self = Fcm::Base->new (%args);
51
52  for (@scalar_properties) {
53    $self->{$_} = exists $args{$_} ? $args{$_} : undef;
54  }
55
56  bless $self, $class;
57  return $self;
58}
59
60# ------------------------------------------------------------------------------
61# SYNOPSIS
62#   $value = $obj->X;
63#   $obj->X ($value);
64#
65# DESCRIPTION
66#   Details of these properties are explained in @scalar_properties.
67# ------------------------------------------------------------------------------
68
69for my $name (@scalar_properties) {
70  no strict 'refs';
71
72  *$name = sub {
73    my $self = shift;
74
75    # Argument specified, set property to specified argument
76    if (@_) {
77      $self->{$name} = $_[0];
78    }
79
80    return $self->{$name};
81  }
82}
83
84# ------------------------------------------------------------------------------
85
861;
87
88__END__
Note: See TracBrowser for help on using the repository browser.