New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
ExtractSrc.pm in branches/UKMO/dev_r5518_ww3_coupling/NEMOGCM/EXTERNAL/fcm/lib/Fcm – NEMO

source: branches/UKMO/dev_r5518_ww3_coupling/NEMOGCM/EXTERNAL/fcm/lib/Fcm/ExtractSrc.pm @ 5844

Last change on this file since 5844 was 5844, checked in by jcastill, 8 years ago

Clear SVN keywords

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