CatalystX::Usul::Shells - Access the available shells list


CatalystX-Usul documentation Contained in the CatalystX-Usul distribution.

Index


Code Index:

Name

Top

CatalystX::Usul::Shells - Access the available shells list

Version

Top

0.3.$Revision: 576 $

Synopsis

Top

   use CatalystX::Usul::Shells

   $model  = CatalystX::Usul::Shells->new( $app, $config );
   $shells = $model->retrieve;

Description

Top

Subroutines/Methods

Top

retrieve

Returns the list of available shells by reading the contents of /etc/shells. Adds /bin/false if it is not present

Diagnostics

Top

None

Configuration and Environment

Top

None

Dependencies

Top

CatalystX::Usul

Incompatibilities

Top

There are no known incompatibilities in this module

Bugs and Limitations

Top

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Author

Top

Peter Flanigan, <Support at RoxSoft.co.uk>

License and Copyright

Top


CatalystX-Usul documentation Contained in the CatalystX-Usul distribution.

# @(#)$Id: Shells.pm 576 2009-06-09 23:23:46Z pjf $

package CatalystX::Usul::Shells;

use strict;
use warnings;
use version; our $VERSION = qv( sprintf '0.3.%d', q$Rev: 576 $ =~ /\d+/gmx );
use parent qw(CatalystX::Usul);

__PACKAGE__->config( default => q(/bin/ksh), path => q(/etc/shells), );

__PACKAGE__->mk_accessors( qw(default path shells) );

sub retrieve {
   my $self = shift; my $class = ref $self || $self;

   my $new = bless { default => $self->default, shells => [] }, $class;

   for my $line ($self->io( $self->path )->chomp->getlines) {
      if ($line and $line !~ m{ \A \# }mx and $line !~ m{ /bin/false }mx) {
         push @{ $new->shells }, $line;
      }
   }

   @{ $new->shells } = sort @{ $new->shells };
   unshift @{ $new->shells }, q(/bin/false);
   return $new;
}

1;

__END__

# Local Variables:
# mode: perl
# tab-width: 3
# End: