source: trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/OCHelper/Nethost.pm @ 2282

Last change on this file since 2282 was 1371, checked in by nanardon, 9 years ago

Create an helper for nethost

File size: 1.5 KB
Line 
1package LATMOS::Accounts::Bases::OCHelper::Nethost;
2
3# $Id: OCHelper.pm 2932 2010-08-10 17:19:21Z nanardon $
4
5use strict;
6use warnings;
7
8use base qw(LATMOS::Accounts::Bases::OCHelper);
9
10=head1 NAME
11
12LATMOS::Accounts::Bases::OCHelper - Object creation helper
13
14=head1 DESCRIPTION
15
16This module is designed to be subclassed.
17
18=head1 FUNCTIONS
19
20=cut
21
22# just return status, $info is reference
23sub _step {
24    my ($self, $info) = @_;
25
26    if ($info->{step} == 0) {
27        $info->{name}{ask} = 1;
28        @{$info->{ask}} = qw(
29            description
30            ip
31            ipFrom
32            macaddr
33            owner
34            user
35            unexported
36        );
37        $info->{step} = 1;
38        return 'NEEDINFO';
39    } elsif ($info->{step} == 1) {
40        if ($self->base->create_c_object($self->otype,
41                $info->{name}{content},
42                %{$info->{contents} || {}},
43            )) {
44            return 'CREATED';
45        } else {
46            return 'ERROR';
47        }
48    } else {
49        return undef;
50    }
51}
52
531;
54
55__END__
56
57=head1 SEE ALSO
58
59L<LATMOS::Accounts::Bases>, L<LATMOS::Accounts::Bases::Objects>
60
61=head1 AUTHOR
62
63Olivier Thauvin, E<lt>olivier.thauvin@latmos.ipsl.frE<gt>
64
65=head1 COPYRIGHT AND LICENSE
66
67Copyright (C) 2012 CNRS SA/CETP/LATMOS
68
69This library is free software; you can redistribute it and/or modify
70it under the same terms as Perl itself, either Perl version 5.10.0 or,
71at your option, any later version of Perl 5 you may have available.
72
73=cut
Note: See TracBrowser for help on using the repository browser.