The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#
# (c) Jan Gehring <jan.gehring@gmail.com>
#
# vim: set ts=2 sw=2 tw=0:
# vim: set expandtab:

package Rex::Interface::Shell;
{
  $Rex::Interface::Shell::VERSION = '0.55.3';
}

use strict;
use warnings;

use Rex::Logger;

sub create {
  my ( $class, $shell ) = @_;

  $shell =~ s/[\r\n]//gms;    # sometimes there are some wired things...

  my $klass = "Rex::Interface::Shell::\u$shell";
  eval "use $klass";
  if ($@) {
    Rex::Logger::info(
      "Can't load wanted shell: '$shell' ('$klass'). Using default shell.",
      "warn" );
    Rex::Logger::info(
      "If you want to help the development of Rex please report this issue in our Github issue tracker.",
      "warn"
    );
    $klass = "Rex::Interface::Shell::Default";
    eval "use $klass";
  }

  return $klass->new;
}

1;