Mercurial > repos > cpt > cpt_psm_plotter
annotate lib/CPT/ParameterGroup.pm @ 1:8691c1c61a8e draft default tip
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
| author | cpt | 
|---|---|
| date | Mon, 05 Jun 2023 02:48:47 +0000 | 
| parents | |
| children | 
| rev | line source | 
|---|---|
| 
1
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
1 package CPT::ParameterGroup; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
2 use Moose; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
3 use strict; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
4 use warnings; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
5 use autodie; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
6 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
7 # A special type of a ParameterCollection (could probably be a child...ohwell) | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
8 use Moose::Util::TypeConstraints; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
9 #subtype 'TypeStr', as 'Str', where { $_ eq 'xor' || $_ eq 'or' || $_ eq 'and' }; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
10 # Replaced with the enum | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
11 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
12 has 'name' => ( is => 'rw', isa => 'Str'); | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
13 has 'description' => ( is => 'rw', isa => 'Str'); | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
14 has 'validator' => ( is => 'rw', isa => enum([qw(xor or and)])); | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
15 has 'options' => ( is => 'rw', isa => 'ArrayRef[HashRef]' ); | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
16 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
17 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
18 sub validate { | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
19 die 'Unimplemented'; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
20 } | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
21 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
22 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
23 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
24 sub set_data { | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
25 my ($self, $hash_ref) = @_; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
26 my %d = %{$hash_ref}; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
27 $self->name($d{name}); | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
28 $self->description($d{description}); | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
29 $self->validator($d{validator}); | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
30 $self->options($d{options}); | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
31 } | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
32 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
33 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
34 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
35 sub getopt { | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
36 my ($self) = @_; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
37 die 'unimplemented'; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
38 } | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
39 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
40 sub flattenOptionsArray{ | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
41 my ($self) = @_; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
42 my @opts; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
43 push(@opts, [sprintf("Option Group: %s\n%s\n[%s]", $self->name(), $self->description(), $self->_formatted_choice_str)]); | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
44 require CPT::ParameterCollection; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
45 my $pC = CPT::ParameterCollection->new(); | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
46 foreach(@{$self->options()}){ | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
47 my %z = %{$_}; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
48 my $group_name = $z{group}; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
49 my @group_opts = @{$z{options}}; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
50 push(@opts, [sprintf("Subgroup: %s", $group_name)]); | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
51 foreach(@group_opts){ | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
52 my $p = $pC->_coerce_param($_); | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
53 push(@opts, $p->getOptionsArray()); | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
54 } | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
55 } | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
56 return \@opts; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
57 } | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
58 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
59 sub _formatted_choice_str{ | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
60 my ($self) = @_; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
61 if($self->validator() eq 'xor'){ | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
62 return 'Please only use options from ONE of the groups below, and no more'; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
63 }elsif($self->validator() eq 'or'){ | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
64 return 'Please only use options from at least ONE of the groups below'; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
65 }elsif($self->validator() eq 'and'){ | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
66 return 'Please ensure values/defaults are specified for ALL of the options in the groups below'; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
67 } | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
68 return undef; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
69 } | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
70 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
71 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
72 sub populate_from_getopt { | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
73 my ( $self, $opt ) = @_; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
74 die 'unimplemented'; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
75 } | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
76 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
77 no Moose; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
78 1; | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
79 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
80 __END__ | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
81 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
82 =pod | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
83 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
84 =encoding UTF-8 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
85 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
86 =head1 NAME | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
87 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
88 CPT::ParameterGroup | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
89 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
90 =head1 VERSION | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
91 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
92 version 1.99.4 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
93 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
94 =head2 validate | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
95 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
96 $pC->validate(); | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
97 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
98 calls the validate method, which loops through and checks that user values line up with the validate method in each and every slot. | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
99 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
100 Currently unimplemented! | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
101 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
102 =head2 getopt | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
103 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
104 my @getopt_compatible_array = $pC->getopt() | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
105 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
106 Returns a getopt compatible array by looping through the array and simply returning array objects, and calling the getOptionsArray method on CPT::Parameter::* objects | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
107 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
108 =head2 populate_from_getopt | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
109 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
110 $parameterCollection->populate_from_getopt($opt); | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
111 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
112 Populate the ->value() from getopt. This is the special sauce of this portion of the module. | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
113 Our test case for this function is the connector choice problem. | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
114 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
115 { | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
116 name => 'Data Source #1', | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
117 description => "FASTA data source for our script", | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
118 type => 'xor', # must select only from one subgroup | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
119 options => [ | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
120 { | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
121 group => 'Chado Custom', | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
122 options => [ | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
123 [ 'host' => 'Hostname', { required => 1, validate => 'Str' } ], | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
124 [ 'user' => 'Username', { required => 1, validate => 'Str' } ], | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
125 [ 'pass' => 'Password', { required => 1, validate => 'Str' } ], | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
126 [ 'name' => 'Database name', { required => 1, validate => 'Str' } ], | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
127 [ 'organism' => 'organism name', { required => 1, validate => 'Str' } ], | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
128 [ 'landmark' => 'landmark name', { required => 1, validate => 'Str' } ], | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
129 ] | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
130 }, | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
131 { | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
132 group => 'Chado GMOD pre-defined connector', | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
133 options => [ | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
134 [ 'conn=s' => 'Connection Nickname', { required => 1, validate => 'Str' } ], | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
135 ] | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
136 }, | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
137 { | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
138 group => 'File', | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
139 options => [ | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
140 [ 'file|f=' => 'Input file', { required => 1, validate => 'File/Input' } ], | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
141 ] | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
142 }, | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
143 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
144 ] | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
145 }, | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
146 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
147 This should intelligently set parameters in $opt based on the passed data. The real question is how to handle password.... | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
148 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
149 =head1 AUTHOR | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
150 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
151 Eric Rasche <rasche.eric@yandex.ru> | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
152 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
153 =head1 COPYRIGHT AND LICENSE | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
154 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
155 This software is Copyright (c) 2014 by Eric Rasche. | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
156 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
157 This is free software, licensed under: | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
158 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
159 The GNU General Public License, Version 3, June 2007 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
160 | 
| 
 
8691c1c61a8e
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
 
cpt 
parents:  
diff
changeset
 | 
161 =cut | 
