Changeset 1023 for trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Utils.pm
- Timestamp:
- 05/29/12 10:25:51 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Utils.pm
r959 r1023 11 11 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 12 12 13 =head1 NAME 14 15 LATMOS::Accounts::Utils - Utils functions 16 17 =head1 FUNCTIONS 18 19 =cut 20 13 21 @ISA = qw(Exporter); 14 22 @EXPORT = qw(to_ascii exec_command switch_user run_via_sudo); 15 23 @EXPORT_OK = qw(to_ascii exec_command switch_user run_via_sudo); 24 25 =head2 to_ascii($text) 26 27 Replace in C<$text> non ascii caracters from iso-8859-15 table to ascii 28 equivalent caracter. 29 30 =cut 16 31 17 32 sub to_ascii { … … 26 41 $text 27 42 } 43 44 =head2 exec_command($command, $env) 45 46 Execute C<$command> and redirect output to log system. 47 48 C<$env> is a hashref containing environment variable to set, all variables are 49 prefixed by 'LA_'. 50 51 =cut 28 52 29 53 sub exec_command { … … 80 104 } 81 105 106 =head2 parse_obj_file($handle) 107 108 Read file content from C<$handle> and return hash containing parsed attributes 109 110 =cut 111 82 112 sub parse_obj_file { 83 113 my ($handle) = @_; … … 107 137 } 108 138 139 =head2 dump_read_temp_file($writecb, $readcb) 140 141 Create a temporary file, call C<$writecb()> function, run editor and if file get 142 modified call C<$readcb>. 143 144 =cut 145 109 146 sub dump_read_temp_file { 110 147 my ($writecb, $readcb) = @_; … … 137 174 } 138 175 176 =head2 check_oid_validity($name) 177 178 Check C<$name> is suitable to be used as object identifier. Return the error 179 text, undef if no error. 180 181 =cut 182 139 183 sub check_oid_validity { 140 184 my ($name) = @_; … … 145 189 return; 146 190 } 191 192 =head2 check_ug_validity($name) 193 194 Check C<$name> is suitable to used as user or group identifier. 195 196 =cut 147 197 148 198 sub check_ug_validity { … … 157 207 return check_oid_validity($name); 158 208 } 209 210 =head2 switch_user($runas) 211 212 Switch effective id of the process to user named C<$runas> 213 214 =cut 159 215 160 216 sub switch_user { … … 173 229 } 174 230 231 =head2 run_via_sudo($runas) 232 233 Rerun current programme as C<$runas> user using sudo 234 235 =cut 236 175 237 sub run_via_sudo { 176 238 my ($runas) = @_; … … 186 248 187 249 1; 250 251 __END__ 252 253 =head1 SEE ALSO 254 255 L<sudo> 256 257 =head1 AUTHOR 258 259 Olivier Thauvin, E<lt>olivier.thauvin@aerov.jussieu.frE<gt> 260 261 =head1 COPYRIGHT AND LICENSE 262 263 Copyright (C) 2008, 2009, 2010, 2011, 2012 CNRS SA/CETP/LATMOS 264 265 This library is free software; you can redistribute it and/or modify 266 it under the same terms as Perl itself, either Perl version 5.10.0 or, 267 at your option, any later version of Perl 5 you may have available. 268 269 =cut
Note: See TracChangeset
for help on using the changeset viewer.