Verby::Config::Source::ARGV - L<Verby::Config::Data> fields from the command line


Verby documentation Contained in the Verby distribution.

Index


Code Index:

NAME

Top

Verby::Config::Source::ARGV - Verby::Config::Data fields from the command line

SYNOPSIS

Top

	use Verby::Config::Source::ARGV;

	my $argv = Verby::Config::Source::ARGV->new
	my $config_hub = Verby::Config::Data->new($argv, $other_source);

Use a field

	sub do {
		my ($self, $c) = @_;
		print $c->handbag;
	}

And then on the command line, set it:

	my_app.pl --handbag=gucci

DESCRIPTION

Top

This module is useful for getting some global keys set or perhaps overridden on the command line.

METHODS

Top

new

BUGS

Top

None that we are aware of. Of course, if you find a bug, let us know, and we will be sure to fix it.

CODE COVERAGE

Top

We use Devel::Cover to test the code coverage of the tests, please refer to COVERAGE section of the Verby module for more information.

SEE ALSO

Top

AUTHOR

Top

Yuval Kogman, <nothingmuch@woobling.org>

COPYRIGHT AND LICENSE

Top


Verby documentation Contained in the Verby distribution.

#!/usr/bin/perl

package Verby::Config::Source::ARGV;
use Moose;

extends qw/Verby::Config::Data/;

our $VERSION = "0.05";

use Getopt::Casual;

sub BUILD {
	my $self = shift;

	my %data = map {
		(my $key = $_) =~ s/^-+//; # Getopt::Casual exposes '--foo', etc.
		$key => $ARGV{$_};
	} keys %ARGV;

	$self->data( \%data );
}

__PACKAGE__

__END__