r29028 - in /trunk/libcurses-ui-perl: ./ debian/ inc/Module/ inc/Module/Install/ lib/Curses/ lib/Curses/UI/ t/
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Thu Jan 1 17:02:14 UTC 2009
Author: gregoa
Date: Thu Jan 1 17:02:11 2009
New Revision: 29028
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=29028
Log:
New upstream release.
Modified:
trunk/libcurses-ui-perl/Changes
trunk/libcurses-ui-perl/META.yml
trunk/libcurses-ui-perl/Makefile.PL
trunk/libcurses-ui-perl/debian/changelog
trunk/libcurses-ui-perl/inc/Module/Install.pm
trunk/libcurses-ui-perl/inc/Module/Install/AutoInstall.pm
trunk/libcurses-ui-perl/inc/Module/Install/Base.pm
trunk/libcurses-ui-perl/inc/Module/Install/Can.pm
trunk/libcurses-ui-perl/inc/Module/Install/Fetch.pm
trunk/libcurses-ui-perl/inc/Module/Install/Include.pm
trunk/libcurses-ui-perl/inc/Module/Install/Makefile.pm
trunk/libcurses-ui-perl/inc/Module/Install/Metadata.pm
trunk/libcurses-ui-perl/inc/Module/Install/Win32.pm
trunk/libcurses-ui-perl/inc/Module/Install/WriteAll.pm
trunk/libcurses-ui-perl/lib/Curses/UI.pm
trunk/libcurses-ui-perl/lib/Curses/UI/Common.pm
trunk/libcurses-ui-perl/lib/Curses/UI/Notebook.pm
trunk/libcurses-ui-perl/lib/Curses/UI/Popupmenu.pm
trunk/libcurses-ui-perl/t/05pod.t
trunk/libcurses-ui-perl/t/08common.t
trunk/libcurses-ui-perl/t/13notebook.t
Modified: trunk/libcurses-ui-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/Changes?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/Changes (original)
+++ trunk/libcurses-ui-perl/Changes Thu Jan 1 17:02:11 2009
@@ -1,4 +1,17 @@
Changelog for the Curses::UI distribution:
+
+Version 0.9607
+==============
+ - Curses::UI::set_timer no longer calls int() on passed time value,
+ allowing Time::HiRes support, thanks to Gilmar Santos, Jr. (RT#29026)
+ - Fixed ancient bug in Popupmenu.pm, thanks to Davide Chiarini
+ and Michael Arlt (RT#38211,25885)
+ - POD testing bug introduced in last version now fixed
+
+Version 0.9606
+==============
+ - Patch to Notebook.pm from Dominque Dumont (RT#39915)
+ - Test::POD no longer required for install
Version 0.9605
==============
Modified: trunk/libcurses-ui-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/META.yml?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/META.yml (original)
+++ trunk/libcurses-ui-perl/META.yml Thu Jan 1 17:02:11 2009
@@ -2,15 +2,12 @@
abstract: 'A curses based OO user interface framework'
author:
- 'Shawn Boyette C<< <mdxi at cpan.org> >>'
-build_requires:
- Test::More: 0
- Test::Pod: 0
distribution_type: module
-generated_by: 'Module::Install version 0.75'
+generated_by: 'Module::Install version 0.77'
license: perl
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.3.html
- version: 1.3
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
name: Curses-UI
no_index:
directory:
@@ -18,8 +15,9 @@
- inc
- t
- examples
- - examples
requires:
Curses: 0
Term::ReadKey: 0
-version: 0.9605
+resources:
+ license: http://dev.perl.org/licenses/
+version: 0.9607
Modified: trunk/libcurses-ui-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/Makefile.PL?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/Makefile.PL (original)
+++ trunk/libcurses-ui-perl/Makefile.PL Thu Jan 1 17:02:11 2009
@@ -8,8 +8,6 @@
# Specific dependencies
requires 'Curses' => 0;
requires 'Term::ReadKey' => 0;
-build_requires 'Test::More' => 0;
-build_requires 'Test::Pod' => 0;
no_index 'directory' => 'examples';
Modified: trunk/libcurses-ui-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/debian/changelog?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/debian/changelog (original)
+++ trunk/libcurses-ui-perl/debian/changelog Thu Jan 1 17:02:11 2009
@@ -1,7 +1,9 @@
-libcurses-ui-perl (0.9605-2) UNRELEASED; urgency=low
+libcurses-ui-perl (0.9607-1) UNRELEASED; urgency=low
* debian/control: Changed: Switched Vcs-Browser field to ViewSVN
(source stanza).
+
+ * New upstream release.
-- gregor herrmann <gregoa at debian.org> Sun, 16 Nov 2008 20:41:08 +0100
Modified: trunk/libcurses-ui-perl/inc/Module/Install.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/inc/Module/Install.pm?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/inc/Module/Install.pm (original)
+++ trunk/libcurses-ui-perl/inc/Module/Install.pm Thu Jan 1 17:02:11 2009
@@ -30,7 +30,7 @@
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '0.75';
+ $VERSION = '0.77';
*inc::Module::Install::VERSION = *VERSION;
@inc::Module::Install::ISA = __PACKAGE__;
@@ -125,8 +125,10 @@
goto &$code unless $cwd eq $pwd;
}
$$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
- unshift @_, ( $self, $1 );
- goto &{$self->can('call')} unless uc($1) eq $1;
+ unless ( uc($1) eq $1 ) {
+ unshift @_, ( $self, $1 );
+ goto &{$self->can('call')};
+ }
};
}
@@ -339,7 +341,10 @@
close FH or die "close($_[0]): $!";
}
-sub _version {
+# _version is for processing module versions (eg, 1.03_05) not
+# Perl versions (eg, 5.8.1).
+
+sub _version ($) {
my $s = shift || 0;
$s =~ s/^(\d+)\.?//;
my $l = $1 || 0;
@@ -348,6 +353,17 @@
return $l + 0;
}
+# Cloned from Params::Util::_CLASS
+sub _CLASS ($) {
+ (
+ defined $_[0]
+ and
+ ! ref $_[0]
+ and
+ $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*$/s
+ ) ? $_[0] : undef;
+}
+
1;
# Copyright 2008 Adam Kennedy.
Modified: trunk/libcurses-ui-perl/inc/Module/Install/AutoInstall.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/inc/Module/Install/AutoInstall.pm?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/inc/Module/Install/AutoInstall.pm (original)
+++ trunk/libcurses-ui-perl/inc/Module/Install/AutoInstall.pm Thu Jan 1 17:02:11 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.75';
+ $VERSION = '0.77';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: trunk/libcurses-ui-perl/inc/Module/Install/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/inc/Module/Install/Base.pm?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/inc/Module/Install/Base.pm (original)
+++ trunk/libcurses-ui-perl/inc/Module/Install/Base.pm Thu Jan 1 17:02:11 2009
@@ -1,7 +1,7 @@
#line 1
package Module::Install::Base;
-$VERSION = '0.75';
+$VERSION = '0.77';
# Suspend handler for "redefined" warnings
BEGIN {
@@ -45,6 +45,8 @@
$_[0]->_top->{admin} or Module::Install::Base::FakeAdmin->new;
}
+#line 101
+
sub is_admin {
$_[0]->admin->VERSION;
}
@@ -67,4 +69,4 @@
1;
-#line 138
+#line 146
Modified: trunk/libcurses-ui-perl/inc/Module/Install/Can.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/inc/Module/Install/Can.pm?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/inc/Module/Install/Can.pm (original)
+++ trunk/libcurses-ui-perl/inc/Module/Install/Can.pm Thu Jan 1 17:02:11 2009
@@ -11,7 +11,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.75';
+ $VERSION = '0.77';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
@@ -39,6 +39,7 @@
return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
+ next if $dir eq '';
my $abs = File::Spec->catfile($dir, $_[1]);
return $abs if (-x $abs or $abs = MM->maybe_command($abs));
}
@@ -79,4 +80,4 @@
__END__
-#line 157
+#line 158
Modified: trunk/libcurses-ui-perl/inc/Module/Install/Fetch.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/inc/Module/Install/Fetch.pm?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/inc/Module/Install/Fetch.pm (original)
+++ trunk/libcurses-ui-perl/inc/Module/Install/Fetch.pm Thu Jan 1 17:02:11 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.75';
+ $VERSION = '0.77';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: trunk/libcurses-ui-perl/inc/Module/Install/Include.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/inc/Module/Install/Include.pm?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/inc/Module/Install/Include.pm (original)
+++ trunk/libcurses-ui-perl/inc/Module/Install/Include.pm Thu Jan 1 17:02:11 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.75';
+ $VERSION = '0.77';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: trunk/libcurses-ui-perl/inc/Module/Install/Makefile.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/inc/Module/Install/Makefile.pm?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/inc/Module/Install/Makefile.pm (original)
+++ trunk/libcurses-ui-perl/inc/Module/Install/Makefile.pm Thu Jan 1 17:02:11 2009
@@ -7,7 +7,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.75';
+ $VERSION = '0.77';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
@@ -36,9 +36,9 @@
sub makemaker_args {
my $self = shift;
- my $args = ($self->{makemaker_args} ||= {});
- %$args = ( %$args, @_ ) if @_;
- $args;
+ my $args = ( $self->{makemaker_args} ||= {} );
+ %$args = ( %$args, @_ );
+ return $args;
}
# For mm args that take multiple space-seperated args,
@@ -116,7 +116,13 @@
# Make sure we have a new enough
require ExtUtils::MakeMaker;
- $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION );
+
+ # MakeMaker can complain about module versions that include
+ # an underscore, even though its own version may contain one!
+ # Hence the funny regexp to get rid of it. See RT #35800
+ # for details.
+
+ $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ );
# Generate the
my $args = $self->makemaker_args;
@@ -175,7 +181,9 @@
my $user_preop = delete $args{dist}->{PREOP};
if (my $preop = $self->admin->preop($user_preop)) {
- $args{dist} = $preop;
+ foreach my $key ( keys %$preop ) {
+ $args{dist}->{$key} = $preop->{$key};
+ }
}
my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
@@ -242,4 +250,4 @@
__END__
-#line 371
+#line 379
Modified: trunk/libcurses-ui-perl/inc/Module/Install/Metadata.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/inc/Module/Install/Metadata.pm?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/inc/Module/Install/Metadata.pm (original)
+++ trunk/libcurses-ui-perl/inc/Module/Install/Metadata.pm Thu Jan 1 17:02:11 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.75';
+ $VERSION = '0.77';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
@@ -17,9 +17,7 @@
abstract
author
version
- license
distribution_type
- perl_version
tests
installdirs
};
@@ -33,11 +31,18 @@
resources
};
-sub Meta { shift }
-sub Meta_ScalarKeys { @scalar_keys }
-sub Meta_TupleKeys { @tuple_keys }
-
-foreach my $key (@scalar_keys) {
+my @resource_keys = qw{
+ homepage
+ bugtracker
+ repository
+};
+
+sub Meta { shift }
+sub Meta_ScalarKeys { @scalar_keys }
+sub Meta_TupleKeys { @tuple_keys }
+sub Meta_ResourceKeys { @resource_keys }
+
+foreach my $key ( @scalar_keys ) {
*$key = sub {
my $self = shift;
return $self->{values}{$key} if defined wantarray and !@_;
@@ -46,12 +51,30 @@
};
}
+foreach my $key ( @resource_keys ) {
+ *$key = sub {
+ my $self = shift;
+ unless ( @_ ) {
+ return () unless $self->{values}{resources};
+ return map { $_->[1] }
+ grep { $_->[0] eq $key }
+ @{ $self->{values}{resources} };
+ }
+ return $self->{values}{resources}{$key} unless @_;
+ my $uri = shift or die(
+ "Did not provide a value to $key()"
+ );
+ $self->resources( $key => $uri );
+ return 1;
+ };
+}
+
sub requires {
my $self = shift;
while ( @_ ) {
my $module = shift or last;
my $version = shift || 0;
- push @{ $self->{values}->{requires} }, [ $module, $version ];
+ push @{ $self->{values}{requires} }, [ $module, $version ];
}
$self->{values}{requires};
}
@@ -61,7 +84,7 @@
while ( @_ ) {
my $module = shift or last;
my $version = shift || 0;
- push @{ $self->{values}->{build_requires} }, [ $module, $version ];
+ push @{ $self->{values}{build_requires} }, [ $module, $version ];
}
$self->{values}{build_requires};
}
@@ -71,9 +94,9 @@
while ( @_ ) {
my $module = shift or last;
my $version = shift || 0;
- push @{ $self->{values}->{configure_requires} }, [ $module, $version ];
- }
- $self->{values}->{configure_requires};
+ push @{ $self->{values}{configure_requires} }, [ $module, $version ];
+ }
+ $self->{values}{configure_requires};
}
sub recommends {
@@ -81,9 +104,9 @@
while ( @_ ) {
my $module = shift or last;
my $version = shift || 0;
- push @{ $self->{values}->{recommends} }, [ $module, $version ];
- }
- $self->{values}->{recommends};
+ push @{ $self->{values}{recommends} }, [ $module, $version ];
+ }
+ $self->{values}{recommends};
}
sub bundles {
@@ -91,26 +114,31 @@
while ( @_ ) {
my $module = shift or last;
my $version = shift || 0;
- push @{ $self->{values}->{bundles} }, [ $module, $version ];
- }
- $self->{values}->{bundles};
+ push @{ $self->{values}{bundles} }, [ $module, $version ];
+ }
+ $self->{values}{bundles};
}
# Resource handling
+my %lc_resource = map { $_ => 1 } qw{
+ homepage
+ license
+ bugtracker
+ repository
+};
+
sub resources {
my $self = shift;
while ( @_ ) {
- my $resource = shift or last;
- my $value = shift or next;
- push @{ $self->{values}->{resources} }, [ $resource, $value ];
- }
- $self->{values}->{resources};
-}
-
-sub repository {
- my $self = shift;
- $self->resources( repository => shift );
- return 1;
+ my $name = shift or last;
+ my $value = shift or next;
+ if ( $name eq lc $name and ! $lc_resource{$name} ) {
+ die("Unsupported reserved lowercase resource '$name'");
+ }
+ $self->{values}{resources} ||= [];
+ push @{ $self->{values}{resources} }, [ $name, $value ];
+ }
+ $self->{values}{resources};
}
# Aliases for build_requires that will have alternative
@@ -126,30 +154,73 @@
sub sign {
my $self = shift;
- return $self->{'values'}{'sign'} if defined wantarray and ! @_;
- $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 );
+ return $self->{values}{sign} if defined wantarray and ! @_;
+ $self->{values}{sign} = ( @_ ? $_[0] : 1 );
return $self;
}
sub dynamic_config {
my $self = shift;
unless ( @_ ) {
- warn "You MUST provide an explicit true/false value to dynamic_config, skipping\n";
+ warn "You MUST provide an explicit true/false value to dynamic_config\n";
return $self;
}
$self->{values}{dynamic_config} = $_[0] ? 1 : 0;
- return $self;
+ return 1;
+}
+
+sub perl_version {
+ my $self = shift;
+ return $self->{values}{perl_version} unless @_;
+ my $version = shift or die(
+ "Did not provide a value to perl_version()"
+ );
+
+ # Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
+ # numbers (eg, 5.006001 or 5.008009).
+
+ $version =~ s/^(\d+)\.(\d+)\.(\d+)$/sprintf("%d.%03d%03d",$1,$2,$3)/e;
+
+ $version =~ s/_.+$//;
+ $version = $version + 0; # Numify
+ unless ( $version >= 5.005 ) {
+ die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n";
+ }
+ $self->{values}{perl_version} = $version;
+ return 1;
+}
+
+sub license {
+ my $self = shift;
+ return $self->{values}{license} unless @_;
+ my $license = shift or die(
+ 'Did not provide a value to license()'
+ );
+ $self->{values}{license} = $license;
+
+ # Automatically fill in license URLs
+ if ( $license eq 'perl' ) {
+ $self->resources( license => 'http://dev.perl.org/licenses/' );
+ }
+
+ return 1;
}
sub all_from {
my ( $self, $file ) = @_;
unless ( defined($file) ) {
- my $name = $self->name
- or die "all_from called with no args without setting name() first";
+ my $name = $self->name or die(
+ "all_from called with no args without setting name() first"
+ );
$file = join('/', 'lib', split(/-/, $name)) . '.pm';
$file =~ s{.*/}{} unless -e $file;
- die "all_from: cannot find $file from $name" unless -e $file;
+ unless ( -e $file ) {
+ die("all_from cannot find $file from $name");
+ }
+ }
+ unless ( -f $file ) {
+ die("The path '$file' does not exist, or is not a file");
}
# Some methods pull from POD instead of code.
@@ -228,8 +299,8 @@
while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) {
$self->feature( $name, @$mods );
}
- return $self->{values}->{features}
- ? @{ $self->{values}->{features} }
+ return $self->{values}{features}
+ ? @{ $self->{values}{features} }
: ();
}
@@ -303,7 +374,7 @@
$self->module_name($module_name);
}
} else {
- die "Cannot determine name from $file\n";
+ die("Cannot determine name from $file\n");
}
}
@@ -362,8 +433,12 @@
my $license_text = $1;
my @phrases = (
'under the same (?:terms|license) as perl itself' => 'perl', 1,
+ 'GNU general public license' => 'gpl', 1,
'GNU public license' => 'gpl', 1,
+ 'GNU lesser general public license' => 'lgpl', 1,
'GNU lesser public license' => 'lgpl', 1,
+ 'GNU library general public license' => 'lgpl', 1,
+ 'GNU library public license' => 'lgpl', 1,
'BSD license' => 'bsd', 1,
'Artistic license' => 'artistic', 1,
'GPL' => 'gpl', 1,
@@ -389,6 +464,24 @@
return 'unknown';
}
+sub bugtracker_from {
+ my $self = shift;
+ my $content = Module::Install::_read($_[0]);
+ my @links = $content =~ m/L\<(http\:\/\/rt\.cpan\.org\/[^>]+)\>/g;
+ unless ( @links ) {
+ warn "Cannot determine bugtracker info from $_[0]\n";
+ return 0;
+ }
+ if ( @links > 1 ) {
+ warn "Found more than on rt.cpan.org link in $_[0]\n";
+ return 0;
+ }
+
+ # Set the bugtracker
+ bugtracker( $links[0] );
+ return 1;
+}
+
sub install_script {
my $self = shift;
my $args = $self->makemaker_args;
@@ -399,7 +492,7 @@
} elsif ( -d 'script' and -f "script/$_" ) {
push @$exe, "script/$_";
} else {
- die "Cannot find script '$_'";
+ die("Cannot find script '$_'");
}
}
}
Modified: trunk/libcurses-ui-perl/inc/Module/Install/Win32.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/inc/Module/Install/Win32.pm?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/inc/Module/Install/Win32.pm (original)
+++ trunk/libcurses-ui-perl/inc/Module/Install/Win32.pm Thu Jan 1 17:02:11 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.75';
+ $VERSION = '0.77';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
Modified: trunk/libcurses-ui-perl/inc/Module/Install/WriteAll.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/inc/Module/Install/WriteAll.pm?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/inc/Module/Install/WriteAll.pm (original)
+++ trunk/libcurses-ui-perl/inc/Module/Install/WriteAll.pm Thu Jan 1 17:02:11 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.75';
+ $VERSION = '0.77';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
Modified: trunk/libcurses-ui-perl/lib/Curses/UI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/lib/Curses/UI.pm?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/lib/Curses/UI.pm (original)
+++ trunk/libcurses-ui-perl/lib/Curses/UI.pm Thu Jan 1 17:02:11 2009
@@ -19,12 +19,12 @@
=head1 VERSION
-Version 0.9605
+Version 0.9607
=cut
use vars qw( $VERSION );
-$VERSION = 0.9605;
+$VERSION = 0.9607;
=head1 SYNOPSIS
@@ -574,7 +574,7 @@
) unless defined $id;
my $config = {
- -time => int($time),
+ -time => $time,
-callback => $callback,
-enabled => 1,
-lastrun => time(),
Modified: trunk/libcurses-ui-perl/lib/Curses/UI/Common.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/lib/Curses/UI/Common.pm?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/lib/Curses/UI/Common.pm (original)
+++ trunk/libcurses-ui-perl/lib/Curses/UI/Common.pm Thu Jan 1 17:02:11 2009
@@ -257,8 +257,7 @@
elsif ($type eq 'underline') { $this->{-canvasscr}->attron(A_UNDERLINE); }
elsif ($type eq 'blink') { $this->{-canvasscr}->attron(A_BLINK); }
elsif ($type eq 'dim') { $this->{-canvasscr}->attron(A_DIM); }
- }
- elsif ($token =~ m/^<\/(standout|reverse|bold|underline|blink|dim)>$/s) {
+ } elsif ($token =~ m/^<\/(standout|reverse|bold|underline|blink|dim)>$/s) {
my $type = $1;
if ($type eq 'standout') { $this->{-canvasscr}->attroff(A_STANDOUT); }
elsif ($type eq 'reverse') { $this->{-canvasscr}->attroff(A_REVERSE); }
@@ -266,20 +265,20 @@
elsif ($type eq 'underline') { $this->{-canvasscr}->attroff(A_UNDERLINE); }
elsif ($type eq 'blink') { $this->{-canvasscr}->attroff(A_BLINK); }
elsif ($type eq 'dim') { $this->{-canvasscr}->attroff(A_DIM); }
- # Tags: (see, man 5 terminfo)
- # | <4_ACS_VLINE> -- Vertical line (4 items).
- # -- <5_ACS_HLINE> -- Horizontal line (5 items).
- # ` <12_ACS_TTEE> -- Tee pointing down (12 items).
- # ~ <ACS_BTEE> -- Tee pointing up (1 item).
- # + <ACS_PLUS> -- Large plus or crossover (1 item).
- # ------------------------------------------------------------------
- } elsif ($token =~ m/^<(\d*)_?(ACS_HLINE|ACS_VLINE|ACS_TTEE|ACS_BTEE|ACS_PLUS)>$/s) {
- no strict 'refs';
- my $scrlen = ($1 || 1);
- my $type = &{ $2 };
- $this->{-canvasscr}->hline( $y, $x, $type, $scrlen );
- $x += $scrlen;
- } else {
+ # Tags: (see, man 5 terminfo)
+ # | <4_ACS_VLINE> -- Vertical line (4 items).
+ # -- <5_ACS_HLINE> -- Horizontal line (5 items).
+ # ` <12_ACS_TTEE> -- Tee pointing down (12 items).
+ # ~ <ACS_BTEE> -- Tee pointing up (1 item).
+ # + <ACS_PLUS> -- Large plus or crossover (1 item).
+ # ------------------------------------------------------------------
+ } elsif ($token =~ m/^<(\d*)_?(ACS_HLINE|ACS_VLINE|ACS_TTEE|ACS_BTEE|ACS_PLUS)>$/s) {
+ no strict 'refs';
+ my $scrlen = ($1 || 1);
+ my $type = &{ $2 };
+ $this->{-canvasscr}->hline( $y, $x, $type, $scrlen );
+ $x += $scrlen;
+ } else {
$this->{-canvasscr}->addstr($y, $x, $token);
$x += length($token);
}
Modified: trunk/libcurses-ui-perl/lib/Curses/UI/Notebook.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/lib/Curses/UI/Notebook.pm?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/lib/Curses/UI/Notebook.pm (original)
+++ trunk/libcurses-ui-perl/lib/Curses/UI/Notebook.pm Thu Jan 1 17:02:11 2009
@@ -24,7 +24,7 @@
$VERSION
@ISA
);
-$VERSION = '1.0.0';
+$VERSION = '1.0001';
@ISA = qw(
Curses::UI::Container
);
@@ -474,6 +474,13 @@
# Create a window for this page using same layout as widget's canvasscr.
my %userargs = @_;
keys_to_lowercase(\%userargs);
+
+ # grab callback arguments
+ foreach my $cbkey (qw/-on_activate -on_delete/) {
+ $this->{callback}{$page}{$cbkey} = delete $userargs{$cbkey}
+ if defined $userargs{$cbkey};
+ }
+
$this->add(
$page, 'Window',
@@ -524,6 +531,12 @@
unless (defined $this->{-id2object}->{$page});
debug_msg " deleting '$page' page";
+
+ if (defined $this->{callback}{$page}{-on_delete}) {
+ debug_msg " calling delete callback for $page";
+ $this->{callback}{$page}{-on_delete}->($this,$page);
+ }
+
my $active_page = $this->active_page;
@{$this->{-pages}} = grep($page ne $_, @{$this->{-pages}});
$this->activate_page($this->first_page) if ($page eq $active_page);
@@ -623,6 +636,11 @@
my $active_page = $this->active_page;
debug_msg " old active page = '$active_page'";
+
+ if (defined $this->{callback}{$page}{-on_activate}) {
+ debug_msg " calling activate callback for $page";
+ $this->{callback}{$page}{-on_activate}->($this,$page);
+ }
if ($active_page ne $page) {
$active_page = $this->{-active_page} = $page;
@@ -713,7 +731,7 @@
-y => 6,
-text => "Page #2.",
);
- my $page3 = $notebook->add_page('page 3');
+ my $page3 = $notebook->add_page('page 3', -on_activate => \&sub );
$page3->add(
undef, 'Label',
-x => 15,
@@ -831,13 +849,20 @@
See L<Curses::UI::Widget|Curses::UI::Widget> for explanations of these
methods.
-=item * B<add_page> ( PAGE )
+=item * B<add_page> ( PAGE [ , -on_activate => sub_ref ] [, -on_delete => ] )
Adds the specified page to the notebook object and creates an associated
window object. Returns the window object or undef on failure.
Note: the add fails if the page would otherwise cause the tab window to
overflow or is already part of the notebook object.
+
+The C<-on_activate> parameter specifies an optional call-back that
+will be invoked when the page is activated. This call-back will be
+called with the notebook widget and page name as parameter.
+
+Likewise for C<-on_delete> call-back. This one is invoked when the
+page is deleted.
=item * B<delete_page> ( PAGE )
Modified: trunk/libcurses-ui-perl/lib/Curses/UI/Popupmenu.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/lib/Curses/UI/Popupmenu.pm?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/lib/Curses/UI/Popupmenu.pm (original)
+++ trunk/libcurses-ui-perl/lib/Curses/UI/Popupmenu.pm Thu Jan 1 17:02:11 2009
@@ -29,7 +29,7 @@
@ISA
);
-$VERSION = '1.10';
+$VERSION = '1.0011';
@ISA = qw(
Curses::UI::Listbox
@@ -232,13 +232,13 @@
$this->{-canvasscr}->attron(A_REVERSE) if $this->{-focus};
my $width = $this->canvaswidth;
- if (defined $sellabel)
- {
+ if (defined $sellabel)
+ {
if (length($sellabel) > $width) {
- $sellabel = substr(0, $width, $sellabel);
+ $sellabel = substr($sellabel, 0, $width);
$sellabel =~ s/.$/\$/;
}
- }
+ }
else # No selection yet.
{
$this->{-canvasscr}->attron(A_DIM);
Modified: trunk/libcurses-ui-perl/t/05pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/t/05pod.t?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/t/05pod.t (original)
+++ trunk/libcurses-ui-perl/t/05pod.t Thu Jan 1 17:02:11 2009
@@ -7,8 +7,10 @@
use FindBin;
use File::Find;
use Test::More;
-use Test::Pod (tests => 45);
+#use Test::Pod (tests => 45);
+eval "use Test::Pod (tests => 45)";
+plan skip_all => "Test::Pod required for testing POD" if $@;
sub wanted {
if ($File::Find::name =~ /\.pm$/) {
Modified: trunk/libcurses-ui-perl/t/08common.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/t/08common.t?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/t/08common.t (original)
+++ trunk/libcurses-ui-perl/t/08common.t Thu Jan 1 17:02:11 2009
@@ -1,6 +1,6 @@
-# -*- perl -*-
+use Test::More tests => 9;
+
use strict;
-use Test::More tests => 9;
use FindBin;
use lib "$FindBin::RealBin/fakelib";
@@ -10,29 +10,28 @@
BEGIN { use_ok( "Curses::UI");
use_ok( "Curses::UI::Common"); }
+# initialize
my $cui = new Curses::UI("-clear_on_exit" => 0);
-
$cui->leave_curses();
-
isa_ok($cui, "Curses::UI");
+# create window
my $mainw = $cui->add("testw","Window");
-
isa_ok($mainw, "Curses::UI::Window");
-# Various methods
+# misc original tests
ok($mainw->root eq $cui, "root()");
-
my $data = { KEY => "value", FOO => "bar" };
Curses::UI::Common::keys_to_lowercase($data);
-ok($data->{key}, "keys_to_lowercase 1");
-ok($data->{foo}, "keys_to_lowercase 2");
+is ($data->{key}, 'value', "keys_to_lowercase 1");
+is ($data->{foo}, 'bar', "keys_to_lowercase 2");
-ok(Curses::UI::Common::scrlength("foo bar") == length("foo bar"),
- "scrlength() 1");
-
-ok(Curses::UI::Common::scrlength("foo\tbar") != length("foo bar"),
- "scrlength() 2");
+#-------------------------------------------------------------------- scrlength
+is (Curses::UI::Common::scrlength("foo bar"),
+ length("foo bar"), "scrlength == 7");
+isnt (Curses::UI::Common::scrlength("foo\tbar"),
+ length("foo bar"), "scrlength > 7");
+
## TODO:
## split_to_lines
Modified: trunk/libcurses-ui-perl/t/13notebook.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcurses-ui-perl/t/13notebook.t?rev=29028&op=diff
==============================================================================
--- trunk/libcurses-ui-perl/t/13notebook.t (original)
+++ trunk/libcurses-ui-perl/t/13notebook.t Thu Jan 1 17:02:11 2009
@@ -1,4 +1,4 @@
-use Test::More tests => 25;
+use Test::More tests => 30;
use strict;
use warnings;
@@ -139,3 +139,23 @@
scalar(@{$nb1->{-pages}}) == 0,
'delete_page(), final page'
);
+
+my ($activated_widget,$activated_name) ;
+my ($deleted_widget,$deleted_name) ;
+
+my $ac_sub = sub { ($activated_widget,$activated_name) = @_ ;} ;
+my $del_sub = sub { ($deleted_widget,$deleted_name) = @_ ;} ;
+
+# create page with activation and deletion call-back
+my $cbpage = $nb1->add_page("CB Page", -on_activate => $ac_sub,
+ -on_delete => $del_sub );
+
+ok($cbpage, "Created page with callback") ;
+
+$nb1->activate_page('CB Page');
+is($activated_widget, $nb1, "activate callback called (widget ok)" );
+is($activated_name, 'CB Page', "activate callback called (name ok)");
+
+$nb1->delete_page('CB Page') ;
+is($deleted_widget, $nb1, "delete callback called (widget ok)" );
+is($deleted_name, 'CB Page', "delete callback called (name ok)");
More information about the Pkg-perl-cvs-commits
mailing list