Mercurial > repos > cpt > cpt_psm_plotter
comparison lib/CPT/Parameter/Option.pm @ 1:8691c1c61a8e draft default tip
planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
author | cpt |
---|---|
date | Mon, 05 Jun 2023 02:48:47 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:54c7a3ea81e2 | 1:8691c1c61a8e |
---|---|
1 package CPT::Parameter::Option; | |
2 use Moose::Role; | |
3 use strict; | |
4 use warnings; | |
5 use autodie; | |
6 with 'CPT::Parameter'; | |
7 | |
8 has 'options' => ( is => 'rw', isa => 'HashRef' ); | |
9 # stored as {short => "some long text"} | |
10 | |
11 | |
12 sub galaxy_input { | |
13 my ( $self, $xml_writer ) = @_; | |
14 $self->handle_possible_galaxy_input_repeat_start($xml_writer); | |
15 my %params = $self->get_default_input_parameters('select'); | |
16 $xml_writer->startTag( | |
17 'param', | |
18 %params, | |
19 ); | |
20 my %options = %{ $self->options() }; | |
21 foreach ( sort( keys(%options)) ) { | |
22 my %p = (value => $_); | |
23 if(defined $_ && defined $self->default() && $_ eq $self->default()){ | |
24 $p{selected} = 'True'; | |
25 } | |
26 $xml_writer->startTag( 'option', %p); | |
27 $xml_writer->characters( $options{$_} ); | |
28 $xml_writer->endTag('option'); | |
29 } | |
30 $xml_writer->endTag('param'); | |
31 $self->handle_possible_galaxy_input_repeat_end($xml_writer); | |
32 } | |
33 | |
34 | |
35 sub galaxy_output { | |
36 | |
37 } | |
38 | |
39 sub validate_individual { | |
40 my ($self, $val) = @_; | |
41 my %options = %{ $self->options() }; | |
42 if($options{$val}){ | |
43 return 1; | |
44 }{ | |
45 push(@{$self->errors()}, sprintf( "Unknown value [%s] supplied to a option %s", $val,$self->name())); | |
46 return 0; | |
47 } | |
48 } | |
49 | |
50 | |
51 sub getopt_format { | |
52 return '=s'; | |
53 } | |
54 | |
55 no Moose::Role; | |
56 1; | |
57 | |
58 __END__ | |
59 | |
60 =pod | |
61 | |
62 =encoding UTF-8 | |
63 | |
64 =head1 NAME | |
65 | |
66 CPT::Parameter::Option | |
67 | |
68 =head1 VERSION | |
69 | |
70 version 1.99.4 | |
71 | |
72 =head2 galaxy_input | |
73 | |
74 $file_param->galaxy_input($xml_writer); # where $file_param is a CPT::Parameter::* | |
75 | |
76 Utilises the $xml_writer to add a <data> block in the <output> section | |
77 | |
78 =head2 galaxy_output | |
79 | |
80 $file_param->galaxy_output($xml_writer); # where $file_param is a CPT::Parameter::* | |
81 | |
82 Utilises the $xml_writer to add a <data> block in the <output> section | |
83 | |
84 =head2 getopt_format | |
85 | |
86 Returns the format character for a given CPT::Parameter::* type | |
87 | |
88 =head1 AUTHOR | |
89 | |
90 Eric Rasche <rasche.eric@yandex.ru> | |
91 | |
92 =head1 COPYRIGHT AND LICENSE | |
93 | |
94 This software is Copyright (c) 2014 by Eric Rasche. | |
95 | |
96 This is free software, licensed under: | |
97 | |
98 The GNU General Public License, Version 3, June 2007 | |
99 | |
100 =cut |