#!/usr/bin/perl use strict; use warnings; use LATMOS::Accounts; use LATMOS::Accounts::Bases::OCHelper; use Getopt::Long; use Pod::Usage; # $Id: ochelper 2038 2010-04-17 14:39:41Z nanardon $ GetOptions( 'c|config=s' => \my $config, 'b|base=s' => \my $base, 'o|object=s' => \my $otype, 'e|empty' => \my $empty_attr, 'fmt=s' => \my $fmt, 'filefmt=s' => \my $filefmt, 'ro' => \my $with_ro, 'no-unexp|wo-unexp' => \my $nounexp, 'with-unexp' => \my $unexp, 'help' => sub { pod2usage(0) }, ) or pod2usage(); $otype ||= 'user'; my $LA = LATMOS::Accounts->new($config, noacl => 1); my $labase = $base ? $LA->base($base) : $LA->default_base; $labase && $labase->load or die "Cannot load base"; $labase->unexported($nounexp ? 0 : 1); my $helper = $labase->ochelper($otype); my $info = undef; while (1) { my $status; ($status, $info) = $helper->step($info); if ($status ne 'NEEDINFO') { if ($status eq 'CREATED') { print "Object created\n"; } else { print "Nothing done\n"; } last; } if ($info->{name}{ask}) { print "NAME:\n"; my $line = ; chomp($line); $info->{name}{content} = $line; } foreach (@{$info->{ask} || []}) { print "$_ " . ($info->{contents}{$_} ? '(' . $info->{contents}{$_} . ')' : '-') . "\n"; my $line = ; chomp($line); $info->{contents}{$_} = $line if($line); } }