Varnish::CLI - An interface to the Varnish CLI
Version 0.03
Varnish CLI is a great administration tool, but a bit difficult to script for. This module allows easy script interface to it.
use Varnish::CLI; my $varnish = Varnish::CLI->new( host => $host, port => $port, timeout => $timeout, secret => $secret, ); $varnish->send( 'url.purge .*' );
The Varnish::CLI can be initialised without any parameters, and will usually work for the default Varnish settings:
my $varnish = Varnish::CLI->new();
If you have started your Varnish CLI with a secret, you must will have to pass the contents of your secret file, otherwise authentication will fail... Makes sense!! :) Remember - complete contents of the secret file (including a newline if it exists!)
my $varnish = Varnish::CLI->new( secret => $secret );
has host => ( is => 'ro', isa => 'Str', required => 1, default => 'localhost' ); has port => ( is => 'ro', isa => 'Int', required => 1, default => 6082 ); has timeout => ( is => 'rw', isa => 'Int', required => 1, default => 1 ); has t => ( is => 'rw', isa => 'Net::Telnet', clearer => 'clear_t' ); has secret => ( is => 'rw', isa => 'Str' ); has connected => ( is => 'rw', isa => 'Int', default => 0, required => 1 ); has last_lines => ( is => 'rw', isa => 'ArrayRef', default => sub{ [] } ); has last_status => ( is => 'rw', isa => 'Int', );
Connect to the Varnish CLI interface
Close the connection to the Varnish CLI interface
Send a command to the Varnish CLi
Robin Clarke, <perl at robinclarke.net>
<perl at robinclarke.net>
Please report any bugs or feature requests to bug-varnish at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Varnish. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-varnish at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Varnish::CLI
You can also look for information at:
Repository on Github
https://github.com/robin13/Varnish-CLI
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Varnish
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Varnish
CPAN Ratings
http://cpanratings.perl.org/d/Varnish
Search CPAN
http://search.cpan.org/dist/Varnish/
http://www.varnish-cache.org/
Copyright 2011 Robin Clarke.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Varnish::CLI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Varnish::CLI
CPAN shell
perl -MCPAN -e shell install Varnish::CLI
For more information on module installation, please visit the detailed CPAN module installation guide.