App-GSD
view release on metacpan or search on metacpan
METHODS
new ( \%args )
The following arguments are accepted:
block
An arrayref of hostnames to block, without a 'www.' prefix (if
present) as these will be blocked automatically.
hosts_file
Path to the hosts file (e.g. '/etc/hosts'), overriding the module's
guess based on current operating system.
network_command
A reference to an array passable to "system()" that will restart the
network, e.g.
['/etc/init.d/network', 'restart']
work
Set work mode - block the sites specified.
bin/get-shit-done view on Meta::CPAN
=head2 block
List of hostnames to block, without 'www.' prefix (if any). For example,
if 'reddit.com' is provided, both 'reddit.com' and 'www.reddit.com' will
be blocked.
=head2 hosts_file
Path to the system hosts file, e.g. /etc/hosts. If not supplied, a default
is guessed based on operating system.
=head2 network_command
A command to flush DNS and/or restart the network. If not supplied, a
default is guessed based on OS.
=head1 FLUSHING THE DNS CACHE
C<get-shit-done> attempts to support Mac OS X and Linux (patches for other
operating systems are more than welcome). For the former, it flushes the
DNS directly. On Linux, it will flush nscd or unscd caches if they are
present, and restart the network via one of the following methods:
=over
lib/App/GSD.pm view on Meta::CPAN
# Return DNS flush command for Linux. It needs to support a few scenarios:
# Ubuntu e.g. '/etc/init.d/networking restart' (or via upstart: 'restart networking')
# Arch using network module: '/etc/rc.d/network restart'
# Arch using NetworkManager or wicd: '/etc/rc.d/$foo restart'
sub _flush_dns_linux {
my $self = shift;
my $cmd;
if (-x '/usr/sbin/rc.d') {
# Try to guess the user's preferred network module by looking for AUTO
my $services = `/usr/sbin/rc.d list | fgrep AUTO`;
for my $service (qw(networkmanager wicd network)) {
if ($services =~ /^\[STARTED\]\[AUTO\] $service$/m) {
$cmd = ['/usr/sbin/rc.d', 'restart', $service];
last;
}
}
if (!defined $cmd) {
croak "You appear to be using rc.d but I can't figure out which network module you are using.";
}
lib/App/GSD.pm view on Meta::CPAN
=over
=item block
An arrayref of hostnames to block, without a 'www.' prefix (if
present) as these will be blocked automatically.
=item hosts_file
Path to the hosts file (e.g. '/etc/hosts'), overriding the
module's guess based on current operating system.
=item network_command
A reference to an array passable to C<system()> that will restart
the network, e.g.
['/etc/init.d/network', 'restart']
=back
( run in 0.401 second using v1.01-cache-2.11-cpan-702932259ff )