App-Siesh

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


        If you specify *** (asterisk) as first argument to delete, the
        active script is deactivated and all scripts are deleted.

        Synonyms: rm

    edit *script-name*
        Edits a script on the server without downloading it explicitly to
        your disk first. Under the hood it creates a temporary file, puts
        the script content in it and calls $ENV{EDITOR} on it. After that
        the script is uploaded back. It's also possible to create and edit a
        new script with this command.

        If your script is syntactical incorrect, you will be prompted to
        re-edit the file or throw away your changes.

        Synonyms: vi

    copy *script-name* *script-name*
        Copies the contents of the source script-name to a target script.
        The contents of the target script are overridden.

lib/App/Siesh.pm  view on Meta::CPAN

If you specify I<*> (asterisk) as first argument to delete, the active
script is deactivated and B<all> scripts are deleted.

Synonyms: B<rm>

=item B<edit> I<script-name>

Edits a script on the server without downloading it explicitly to your
disk first. Under the hood it creates a temporary file, puts the script
content in it and calls C<$ENV{EDITOR}> on it. After that the script is
uploaded back. It's also possible to create and edit a new script with
this command.

If your script is syntactical incorrect, you will be prompted to
re-edit the file or throw away your changes.

Synonyms: B<vi>

=item B<copy> I<script-name> I<script-name>

Copies the contents of the source script-name to a target  script.

lib/Net/ManageSieve/Siesh.pm  view on Meta::CPAN


Net::ManageSieve::Siesh - Expanding Net::ManagieSieve beyond the pure protocol

=head1 VERSION

Version 0.05

=head1 SYNOPSIS

Net::ManageSieve::Siesh expands Net::ManagieSieve beyond just implementing
the core RFC protocol. There are functions to upload and download files,
deactivating scripts, copy and move them etc.

    use Net::ManageSieve::Siesh;

    my $sieve = Net::ManageSieve::Siesh->new();
    $sieve->copy('script1','script2');
    $sieve->mv('script2','script3');
    $sieve->put('../script.txt','script4');
    $sieve->get('script1','../script.txt');

t/01-basic.t  view on Meta::CPAN

    ok(
        my $sieve =
          Net::ManageSieve::Siesh->new( $config->{host}, tls => 'require' ),
        'connecting to sieve server'
    );

    ok( $sieve->login( $config->{user}, $config->{password} ), 'logging in' );

    BAIL_OUT('Existing scripts would be deleted. Please use an empty account for testing.') if $sieve->listscripts();

    ok( $sieve->putfile( $tempfile, 'bar' ), 'uploading script' );
    ok( $sieve->script_exists('bar'), 'script was really uploaded' );
    ok( $sieve->copyscript( 'bar', 'foo' ), 'copying script' );
    ok( $sieve->script_exists('foo'), 'script was really copied' );
    ok( $sieve->movescript( 'bar', 'foo' ), 'renaming script' );
    ok( !$sieve->script_exists('bar'), 'script was really moved' );

    ok( $sieve->getfile( 'foo', $tempfile ), 'downloading script' );

    ok( !$sieve->is_active('foo'), "foo is not active" );
    ok( $sieve->activate('foo'),   "activating foo" );
    ok( $sieve->is_active('foo'),  "foo is really active" );

t/02-batch.t  view on Meta::CPAN

	}

	my ($fh,$tempfile) = tempfile( UNLINK => 1 );
        print {$fh} <DATA>;
	close $fh;

	execute('rm *');
	stdout_is( sub { execute('ls') },'','rm * succeeded, no files left.');

	execute("put $tempfile foo" );
	stdout_is( sub { execute('ls') },"foo\n",'foo was uploaded');

	execute('cp foo bar');
	stdout_is( sub { execute('ls') },"bar\nfoo\n",'copied foo to bar');

	execute('mv foo quux');
	stdout_is( sub { execute('ls') },"bar\nquux\n",'moved foo to quux');

	execute('activate bar');
	stdout_is( sub { execute('ls') },"bar *\nquux\n",'activated bar');



( run in 2.814 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )