package VCP::DefaultFilters;
=head1 NAME
VCP::DefaultFilters - Class for determining default filters
to install for a given source and dest.
=head1 SYNOPSIS
require VCP::DefaultFilters;
VCP::DefaultFilters::create_default_filters( $source, $dest );
=head1 DESCRIPTION
Given references to a vcp source and destination, determines the
default filters which would be appropriate, builds and returns a
list of lists like
[
[ $spec, @args ],
.
.
.
]
suitable for passing to load_module. Each filter has one
sub-list within the main list.
=cut
$VERSION = 0.1 ;
use strict;
use Carp;
use VCP::Debug qw( :debug );
use VCP::Logger qw( lg BUG );
sub new {
my $class = shift;
$class = ref $class || $class;
my $self = {};
return bless $self;
}
sub create_default_filters {
my VCP::DefaultFilters $self = shift;
croak "usage create_default_filters <source>, <dest>"
unless @_ == 2;
my ($source, $dest) = ( $_[0]->repo_scheme, $_[1]->repo_scheme );
my $wizard = "${source}2${dest}_default_filters";
my @filters;
eval {
warn "calling $wizard...\n";
@filters = $self->$wizard;
};
if( $@ =~ /Can't locate object method "$wizard" via/i ) {
lg "no default filters defined for $source to $dest conversion";
}
else {
BUG "create_default_filters: $@\n" if $@;
}
return @filters;
}
sub cvs2p4_default_filters {
## this looks like .vcp config file format, but it's not parsed by that.
## we're just using qw() to put the args into an array.
my @args = qw(
Map:
(...)<> main/$1
(...)<(*)> $2/$1
);
return @args;
}
=back
=head1 COPYRIGHT
Copyright 2000, Perforce Software, Inc. All Rights Reserved.
This module and the VCP package are licensed according to the terms given in
the file LICENSE accompanying this distribution, a copy of which is included in
L<vcp>.
=cut
1;
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #4 | 4496 | Barrie Slaymaker | - minor POD cleanups to prevent nags when building VCP::Help | ||
| #3 | 4021 | Barrie Slaymaker |
- Remove all phashes and all base & fields pragmas - Work around SWASHGET error |
||
| #2 | 3554 | John Fetkovich |
added p42cvs_default_filters sub. Corrected documentation. |
||
| #1 | 3548 | John Fetkovich | Load default filters when vcp interactive ui is run. |