mirror of
https://github.com/duncs/clusterssh.git
synced 2025-07-03 18:03:23 +00:00
Document Range module methods
This commit is contained in:
parent
0ecf12256d
commit
33fa9b9911
1 changed files with 30 additions and 6 deletions
|
@ -7,26 +7,50 @@ package App::ClusterSSH::Range;
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
use App::ClusterSSH::Range;
|
use App::ClusterSSH::Range;
|
||||||
my $range=App::ClusterSSH::Range->new();
|
my $range=App::ClusterSSH::Range->new();
|
||||||
my @list = $range->expand('range{0..5}');
|
my @list = $range->expand('range{0..5}');
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
This module adds in the numbered range specification as found in Bash
|
Perform string expansion looking for ranges before then finishing off
|
||||||
EXPANSIONS (see the bash S<man> page) before putting the same string
|
using C<File::Glob::bsd_glob>.
|
||||||
through C<bsd_glob>.
|
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
use File::Glob ':bsd_glob';
|
use File::Glob ':bsd_glob';
|
||||||
|
|
||||||
|
=head1 METHODS
|
||||||
|
|
||||||
|
=over 4
|
||||||
|
|
||||||
|
=item $range = App::ClusterSSH::Range->new();
|
||||||
|
|
||||||
|
Create a new object to perform range processing
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ( $class, %args ) = @_;
|
my ( $class, %args ) = @_;
|
||||||
my $self = {%args};
|
my $self = {%args};
|
||||||
return bless $self, $class;
|
return bless $self, $class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
=item @expanded = $range->expand(@strings);
|
||||||
|
|
||||||
|
Expand the given strings. Ranges are checked for and processed. The
|
||||||
|
resulting string is then put through File::Glob::bsd_glob before being returned.
|
||||||
|
|
||||||
|
Ranges are of the form:
|
||||||
|
|
||||||
|
base{start..stop}
|
||||||
|
a{0..3} => a0 a1 a2 a3
|
||||||
|
b{4..6,9,12..14} => b4 b5 b6 b9 b12 b13 b14
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
sub expand {
|
sub expand {
|
||||||
my ( $self, @items ) = @_;
|
my ( $self, @items ) = @_;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue