The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tk::Copy::Mac - simulate a Macintosh Classic copy dialog.

SYNOPSIS

 use Tk::Copy::Mac;
 $cd = $parent->Copy(-option => value);

DESCRIPTION

This widget simulates a Macintosh Classic copy dialog using Tk::ProgressBar::Mac and CollapsableFrame widgets.

OPTIONS

The following option/value pairs are supported:

-bufsize

The copy buffer size in bytes (default is 2,097,152 bytes). The value of this option can only be set during widget creation.

METHODS

copy(from, to)

Copies 'from' to 'to'.

ADVERTISED WIDGETS

Component subwidgets can be accessed via the Subwidget method. Valid subwidget names are listed below.

Name: progressbar, Class: ProgressBar
  ProgressBar widget reference.
Name: collapsableframe, Class: CollapsableFrame
  CollapsableFrame widget reference.

EXAMPLE

 #!/usr/local/bin/perl -w
 use Tk;
 use Tk::Copy::Mac;
 use strict;

 die "Usage: copy.pl from to" unless $#ARGV == 1;

 my $mw = MainWindow->new;

 my $mc = $mw->Copy(-bufsize => 4 * 1_048_576);

 my $b = $mw->Button(
     -text    => "Push me to copy all files in '$ARGV[0]' to '$ARGV[1]'.",
     -command => sub {$mc->copy($ARGV[0],  $ARGV[1])},
 )->pack;
 $mw->Button(-text => 'Quit', -command => \&exit)->pack;

 $mc->Subwidget('collapsableframe')->open;

 MainLoop;

BUGS

There are two phases to a Copy operation. First, we do a pre-scan to compute a file count and total byte count using File::Find, followed by the actual copy using File::NCopy. The pre-scan phase is blocking - we haven't made any changes to that core module to keep Tk events flowing.

We don't verify that there is sufficient room in the destination for the copy to succeed.

AUTHOR and COPYRIGHT

sol0@Lehigh.EDU

Copyright (C) 2000 - 2002, Stephen O. Lidie

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

KEYWORDS

Apple, CollapsableFrame, Copy, ProgressBar