ARCv2

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

lib/Arc.pm
lib/Arc.pod
lib/Arc/Command.pm
lib/Arc/Command.pod
lib/Arc/Command/Get.pm
lib/Arc/Command/Put.pm
lib/Arc/Command/Test.pm
lib/Arc/Command/Uptime.pm
lib/Arc/Command/Whoami.pm
lib/Arc/Command/Help.pm
lib/Arc/Connection.pm
lib/Arc/Connection.pod
lib/Arc/Connection/Client.pm
lib/Arc/Connection/Client.pod
lib/Arc/Connection/Server.pm
lib/Arc/Connection/Server.pod
lib/Arc/Server.pm

META.yml  view on Meta::CPAN

    Authen::SASL:                  2.06
    Authen::SASL::Cyrus:           0.10
    Config::IniFiles:              0.0
    IO::Pipe:                      0.0
    IO::Select:                    0.0
    IO::Socket::INET:              0.0
    MIME::Base64:                  0.0
    Net::Server::PreFork:          0.85
    Term::ReadKey:                 0.0
    Term::ReadLine:                0.0
    Test::More:                    0.0

distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.17

Makefile.PL  view on Meta::CPAN

    'DISTNAME'		=> 'ARCv2',
    'NAME'		=> 'Arc',
    'VERSION_FROM'	=> 'lib/Arc.pm', # finds $VERSION
    'PREREQ_PM'		=> { 
		'Authen::SASL' => '2.06',
		'Authen::SASL::Cyrus' => '0.10',
		'IO::Pipe' => '0.0',
		'MIME::Base64' => '0.0',
		'IO::Socket::INET' => '0.0',
		'IO::Select' => '0.0',
		'Test::More' => '0.0',
		'Config::IniFiles' => '0.0',
		'Term::ReadKey' => '0.0',
		'Net::Server::PreFork' => '0.85',
		'Term::ReadLine' => '0.0',
    },
    dist		=> {
		COMPRESS => 'gzip --best',
		SUFFIX   => 'gz',
		PREOP => 'make -C doc'
    }, 

lib/Arc/Command.pod  view on Meta::CPAN

 {
  my $this = shift;
  my $pw = <>;
  if ($pw ne "klaus") {
	  return $this->_SetError("Wrong password.");
  }
 }
 
In ARCv2 some standard commands are already implemented: C<Arc::Command::Get>,
C<Arc::Command::Put>, C<Arc::Command::Uptime>, C<Arc::Command::Whoami>,
C<Arc::Command::Test>.

By default, these classes are mapped to B<Command Names> as follows (in the 
default arcxd.conf for arcxd):
  uptime => Arc::Command::Uptime,
  whoami => Arc::Command::Whoami,
  copy   => Arc::Command::Get,
  cp     => Arc::Command::Get,
  get    => Arc::Command::Get,
  put    => Arc::Command::Put,
  test   => Arc::Command::Test,
  help   => Arc::Command::Help,
 
B<Caution>: Especially take care of the C<Arc::Command::Get> and 
C<Arc::Command::Put> in production environment. As ARCv2 will probably
run as root and by default the Get and Put command do NOT have an access
control, everyone can get or put any files from/to your ARCv2 server.

There are some member variables, which contain information about the 
client. See 'Class VARIABLES' for a complete list of them. These values 
are filled by Arc::Connection::Server, when the client wants to run a command.

lib/Arc/Command/Test.pm  view on Meta::CPAN

package Arc::Command::Test;

use strict;
use warnings;
use Carp;
use Arc::Command;

@Arc::Command::Test::ISA = qw(Arc::Command);

sub members 
{
	my $this = shift;
	return { %{$this->SUPER::members},
		# private:
		# protected:
	};
}

lib/arcxd.pod  view on Meta::CPAN

 PLAIN
 EOM

 [commands]
   uptime = Arc::Command::Uptime
   whoami = Arc::Command::Whoami
   copy = Arc::Command::Get
   cp = Arc::Command::Get
   get = Arc::Command::Get
   put = Arc::Command::Put
   test = Arc::Command::Test
   help = Arc::Command::Help
   h = Arc::Command::Help
   hlp = Arc::Command::Help

 [logging]
   level = 7
   destination = syslog

The configuration file is based on .ini format, known from Windows (sorry). 
In perl we can parse it, using Config::IniFiles. The configuration file is divided into

scripts/arcxd.conf  view on Meta::CPAN

	
[commands]
	uptime = Arc::Command::Uptime
	whoami = Arc::Command::Whoami
	copy = Arc::Command::Get
	cp = Arc::Command::Get
	get = Arc::Command::Get
	put = Arc::Command::Put
	crontab = Arc::Command::Acrontab
	acrontab = Arc::Command::Acrontab
	test = Arc::Command::Test
	help = Arc::Command::Help
	h = Arc::Command::Help
	hlp = Arc::Command::Help
	rpc = Arc::Command::Rpc

	fs = Fs
	
	vos = Fs

	pv = Pv

t/arc1.t  view on Meta::CPAN

use Test::More tests => 17;
use strict;

# To work as a client/server we have to fork

my $pid = fork();

my $user = "mannfred";
my $pass = "klaus";

if ($pid == 0) { # Child
	
	use Arc::Server;
	use Arc::Connection::Server;

	my $server = new Arc::Server (
				loglevel => 0,
				logdestination => 'stderr',
				server => {
					port => [30001], # Testport
					host => "localhost", 
				},
				connection_vars => {
					loglevel => 0,
					logdestination => 'stderr',
					sasl_mechanisms => ['PLAIN'],
					sasl_cb_checkpass => \&checkpass,
					sasl_cb_getsecret => \&getsecret,
					service => "arc",
					commands => { 
						test => 'Arc::Command::Test',
						whoami => 'Arc::Command::Whoami',
						uptime => 'Arc::Command::Uptime',
					}
				}
	);

	$server->Start();

	exit 0;
} elsif ($pid) { # Parent
	use Arc::Connection::Client;
	ok(1); #1
	
	sleep(3); # Wait for the server to get ready

	my $client = new Arc::Connection::Client (
				server => "localhost",
				port => 30001, # Testport
				loglevel => 0,
				logdestination => 'stderr',
				service => 'arc',
				sasl_mechanism => "PLAIN",
				sasl_cb_user => $user,
				sasl_cb_auth => $user,
				sasl_cb_pass => $pass,
	) or ok(0);
	ok(1); #2

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.565 second using v1.00-cache-2.02-grep-82fe00e-cpan-585fae043c8 )