UI.pm #7

  • //
  • guest/
  • perforce_software/
  • revml/
  • lib/
  • VCP/
  • UI.pm
  • View
  • Commits
  • Open Download .zip Download (2 KB)
package VCP::UI ;

=head1 NAME

VCP::UI - User interface framework for interactive mode VCP.

=head1 SYNOPSIS

    $ vcp

=head1 DESCRIPTION

When VCP is run with no source or destination specifications, it loads
and launches an interactive user interface.

The current default is a text user interface, but this may change
to be a graphical UI on some platforms in the future.

UI.pm is a UI manager for UI::Machines and front-end implementations
like UI::Text.  These do not derive from UI, they are managed by UI.

TODO: Rename UI.pm to UIManager.pm, then factor stuff out of UI::Text
into a new UI.pm.

=head1 METHODS

=over

=cut

$VERSION = 0.1 ;

use strict ;

use fields (
   'UIImplementation',  ## The VCP::UI::* to use
   'TersePrompts',      ## don't output description for any prompt if true.
) ;


=item new

   my $ui = VCP::UI->new;

=cut

sub new {
   my VCP::UI $self = fields::new( shift );

   %$self = @_;

   return $self ;
}

=item run

Runs the UI.  Selects the appropriate user interface (unless one has
been passed in) and runs it.

=cut

sub run {
    my VCP::UI $self = shift;

    $self->{UIImplementation} = "VCP::UI::Text"
        unless defined $self->{UIImplementation};

    unless ( ref $self->{UIImplementation} ) {
        eval "require $self->{UIImplementation}" or die "$@ loading $self->{UIImplementation}";
    }

    $self->{UIImplementation}->new( UIManager => $self, @_ )->run;
}


=back

=head1 COPYRIGHT

Copyright 2000, Perforce Software, Inc.  All Rights Reserved.

This module and the VCP::UI package are licensed according to the terms given in
the file LICENSE accompanying this distribution, a copy of which is included in
L<vcp>.

=head1 AUTHOR

Barrie Slaymaker <barries@slaysys.com>

=cut

1
# Change User Description Committed
#8 4021 Barrie Slaymaker - Remove all phashes and all base & fields pragmas
- Work around SWASHGET error
#7 4012 Barrie Slaymaker - Remove dependance on pseudohashes (deprecated Perl feature)
#6 3666 Barrie Slaymaker - vcp can now edit existing .vcp files, for VSS sources and revml dests
#5 3640 Barrie Slaymaker - xmllint no longer require to build UI
- UI now offers multiple choices where appropriate
#4 3567 John Fetkovich - added the field UIManager in VCP::UI::Text.pm
- added the fields UIImplementation and TersePrompts in UI.pm
- removed Source and Dest fields in VCP::UI.pm
- UI.pm now returns the result of running the UI implementation.
- VCP::UI::Text->run return a list of (source, dest)
  all future UI implementations must do the same.
- bin/vcp gets (source, dest) list from VCP::UI->run.
- added --terse (or -t) command line option to vcp
  to remove verbose help from interactive UI.
#3 3362 John Fetkovich revml source and dest now works through interactive UI
#2 3244 Barrie Slaymaker Integrate VCP::UI with bin/vcp.
       Type 'vcp' to run the UI.
#1 3237 Barrie Slaymaker More work on the UI StateML conventions