#------------------------------------------------------------------------------- # Copyright (c) 2008-2012, Perforce Software, Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE SOFTWARE, INC. BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #------------------------------------------------------------------------------- package P4::Progress; =pod =head1 NAME P4::Progress =head1 SYNOPSIS use P4; package MyProgress; { use base qw( P4::Progress ); # type: 1 SENDFILE, 2 RECEIVEFILE, 3 TRANSFER, 4 COMPUTATION sub Init { my $self = shift; my $type = shift; print( "SubmitProgress::init\n" ); } # units: 1 percent, 2 files, 3 KBytes, 4 MBytes sub Description { my $self = shift; my $desc = shift; my $units = shift; print( "SubmitProgress::description: $desc, $units\n" ); } sub Update { my $self = shift; my $progress = shift; print( "SubmitProgress::update: $progress\n" ); } sub Total { my $self = shift; my $total = shift; print( "SubmitProgress::total: $total\n" ); } sub Done { my $self = shift; my $fail = shift; print( "SubmitProgress::done: $fail\n" ); } } 1; package main; $p4 = P4->new(); $progress = new MyProgress; $p4->SetProgress($progress); $p4->Connect() or die( "Failed to connect to Perforce" ); $p4->RunSync("-q", "//..."); ... =head1 DESCRIPTION P4::Progress is a class for handling Perforce progress callbacks =head1 METHODS =over =item new() Constructs a new P4::Progress object. For example: $p4 = P4::Progress->new(); =back =cut sub new { my $class = shift; my $self = {}; bless( $self, $class ); return $self; } =pod =over =item Init() =over Called when object constructed, arg 'type' =back =back =cut sub Init { my $self = shift; my $type = shift; $self->{type} = $type; } =pod =over =item Description() =over Invoked with arguments 'description' and 'units' =back =back =cut sub Description { my $self = shift; my $description = shift; my $units = shift; $self->{description} = $description; $self->{units} = $units; } =pod =over =item Total() =over Invoked with argument 'total' =back =back =cut sub Total { my $self = shift; my $total = shift; $self->{total} = $total; } =pod =over =item Update() =over Invoked with argument 'position' =back =back =cut sub Update { my $self = shift; my $position = shift; $self->{position} = $position; } =pod =over =item Done() =over Invoked with argument fail (0:1) =back =back =cut sub Done { my $self = shift; my $fail = shift; } =pod =head1 SEE ALSO L<P4|P4>, L<P4::Message|P4::Message> =head1 COPYRIGHT Copyright (c) 2008-2012, Perforce Software, Inc. All rights reserved. =cut 1; __END__
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 19591 | jmash |
Additional updates (pbp / perlcritic). Also updated pod with missing methods found with podchecker, though some of them are empty stubs right now (I will look to update these in the future). |
||
#4 | 19590 | jmash | Convert uses of indirect object construction syntax to use direct syntax, and update documentation to reflect the preference. | ||
#3 | 19587 | jmash | Addressed some pod syntax issues and updated some links based on general best-practices. | ||
#2 | 19586 | jmash | Added space below package declarations so Dist::Zilla can automatically insert the version number into each of the packages (making it easier to figure out what version of the P4Perl API you're running in scripts). | ||
#1 | 19582 | jmash | Initial fork of P4Perl. | ||
//guest/perforce_software/p4perl/main/P4/Progress.pm | |||||
#2 | 19372 | Paul Allen | Update with P16.1 changes. | ||
#1 | 15920 | Matt Attaway | Move p4perl files into the main directory | ||
//guest/perforce_software/p4perl/P4/Progress.pm | |||||
#1 | 8486 | Paul Allen |
Initial population of P4PERL from: //depot/main/p4-perl/...@565514 //depot/main/p4-doc/user/p4perlnotes.txt@565514 |