@@ -0,0 +1,6 @@
+Build
+MYMETA.*
+Makefile
+_build/
+blib/
+*.swp
@@ -1,12 +0,0 @@
-use strict;
-use warnings;
-use 5.008;
-
-use Module::Build;
-
-Module::Build->new(
- module_name => 'Term::Sk',
- license => 'perl',
- configure_requires => { 'Module::Build' => 0.30 },
- dist_abstract => 'Perl extension for displaying a progress indicator on a terminal',
-)->create_build_script;
@@ -1,80 +1,146 @@
-Revision history for Term-Sk
-
-0.01 20 Jun 2009
- First version, released on an unsuspecting world.
-
-0.02 24 Nov 2009
- make option {quiet => !-t STDOUT} the default
- make option {pdisp => '!'} meaningless, i.e. always use "#" to
- display the progress bar
-
-0.03 22 Jan 2010
- add code to detect $ENV{TERM_SK_OUTPUT} to connect to, in which case {quiet =>...} is ignored
- add Build.PL
- add Sidenotes.pod
- make new() die on errors
- add "use IO::Handle" and replace "local $| = 1;" by "IO::Handle::flush();"
-
-0.04 27 Mar 2010
- add a function rem_backspace() that takes a file and removes backspaces from that file
- revert back to version 0.02 (except for "add Build.PL" and "make new() die on errors"), that is...
- - remove item from ver 0.03: "...add code to detect $ENV{TERM_SK_OUTPUT}..."
- - remove item from ver 0.03: "...add Sidenotes.pod..."
- - remove item from ver 0.03: "...add use IO::Handle and replace local $| = 1;..."
-
-0.05 11 May 2010
- in Build.PL and in Makefile.PL
- change requirement "use 5.10" to the less restrictive "use 5.8"
-
-0.06 28 May 2010
- add option {num => q{9'999}} to allow variable number formats
-
- add dynamic growth of a number, such that format: '%c of %m' outputs
- 2_870 of 9_274
-
- Also, write something reasonable in file README
-
-0.07 09 May 2011
- Introduce a new format character "%k" (="Token"). Idea and patch provided by Bruce Ravel.
- Token which updates its value before being displayed. An example use
- of this would be a loop wherein every step of the loop could be
- identified by a particular string.
-
-0.08 14 May 2011
- In the POD documentation, remove the "or die..." from "my $ctr = Term::Sk->new(...) or die..."
- Also, as suggested by Salvatore Bonaccorso, change the POD documentation as follows:
- before: This option allows to register...
- after : This option allows one to register...
- Make subs log_info(), set_chunk_size() and set_bkup_size() effectively dummy operations (i.e. they
- don't have any effect whatsoever)
-
-0.09 21 Jun 2011
- refactor/simplify subroutine rem_backspace().
- refactor/simplify time recording (subroutine show_maybe())
- in subroutine token(): replace $self->up; by $self->show_maybe;
- add some more tests
- add initialiser 'mock_tm' and method mock_time() to mock time for testing
- add configure_requires => { 'Module::Build' => 0.30 } to Build.PL
-
-0.10 16 Jul 2011
- allow more than one token in a single line
-
-0.11 19 Jul 2011
- update the documentation and give some examples to allow more than one token in a single line
-
-0.12 08 Dec 2012
- make subroutine $sk->token() to display the progress immediately (replacing
- $self->show_maybe; by $self->show; inside the subroutine token)
-
-0.13 30 Dec 2012
- Bug #82102 for Term-Sk: [PATCH] Small Spelling error in manpage (Wed, 19 Dec 2012 07:21:10 +0100)
- https://rt.cpan.org/Public/Bug/Display.html?id=82102
- >> Hi In Debian we are currently applying the attached patch to Term-Sk. We thought you might be interested
- >> in it, too. Thanks in advance, Salvatore Bonaccorso, Debian Perl Group
- >> -counter must be instantiated with an in tial value for the token.
- >> +counter must be instantiated with an initial value for the token.
-
-0.14 19 May 2013
- Add a new sub tok_maybe(), which is similar to token(), except that
- tok_maybe() calls $self->show_maybe; whereas...
- token() calls $self->show;
+Revision history for Term::Sk
+
+0.16 - 2014-09-07T19:42:55+01:00
+
+ [DOCUMENTATION]
+
+ - Add a .gitignore file
+
+ - Changelog dates are better written as YYYY.MM.DD and probably ordered in
+ the other, descending, direction
+ Remark: I have decided to follow the ISO 8601 standard at
+ http://www.w3.org/TR/NOTE-datetime
+
+ - Just use a Makefile.PL and not a Build.PL the latter does not have any
+ added value any more
+
+ - In Makefile.PL ==> meta files link to repository
+
+0.15 - 2014-08-17T12:00:00+01:00
+
+ [ENHANCEMENTS]
+
+ - Reformat changes files to comply with the format already used in Acme::Indent
+ Also, make time token (%t) align right (and not left)
+
+0.14 - 2013-05-19T12:00:00+01:00
+
+ [ENHANCEMENTS]
+
+ - Add a new sub tok_maybe(), which is similar to token(), except that
+ tok_maybe() calls $self->show_maybe; whereas...
+ token() calls $self->show;
+
+0.13 - 2012-12-30T12:00:00+01:00
+
+ [DOCUMENTATION]
+
+ - Bug #82102 for Term-Sk: [PATCH] Small Spelling error in manpage (Wed, 19 Dec 2012 07:21:10 +0100)
+ https://rt.cpan.org/Public/Bug/Display.html?id=82102
+ >> Hi In Debian we are currently applying the attached patch to Term-Sk. We thought you might be interested
+ >> in it, too. Thanks in advance, Salvatore Bonaccorso, Debian Perl Group
+ >> -counter must be instantiated with an in tial value for the token.
+ >> +counter must be instantiated with an initial value for the token.
+
+0.12 - 2012-12-08T12:00:00+01:00
+
+ [ENHANCEMENTS]
+
+ - make subroutine $sk->token() to display the progress immediately (replacing
+ $self->show_maybe; by $self->show; inside the subroutine token)
+
+0.11 - 2011-07-19T12:00:00+01:00
+
+ [DOCUMENTATION]
+
+ - update the documentation and give some examples to allow more than one token in a single line
+
+0.10 - 2011-07-16T12:00:00+01:00
+
+ [ENHANCEMENTS]
+
+ - allow more than one token in a single line
+
+0.09 - 2011-06-21T12:00:00+01:00
+
+ [ENHANCEMENTS]
+
+ - refactor/simplify subroutine rem_backspace().
+ refactor/simplify time recording (subroutine show_maybe())
+ in subroutine token(): replace $self->up; by $self->show_maybe;
+ add some more tests
+ add initialiser 'mock_tm' and method mock_time() to mock time for testing
+ add configure_requires => { 'Module::Build' => 0.30 } to Build.PL
+
+0.08 - 2011-05-14T12:00:00+01:00
+
+ [DOCUMENTATION]
+
+ - In the POD documentation, remove the "or die..." from "my $ctr = Term::Sk->new(...) or die..."
+ Also, as suggested by Salvatore Bonaccorso, change the POD documentation as follows:
+ before: This option allows to register...
+ after : This option allows one to register...
+ Make subs log_info(), set_chunk_size() and set_bkup_size() effectively dummy operations (i.e. they
+ don't have any effect whatsoever)
+
+0.07 - 2011-05-09T12:00:00+01:00
+
+ [ENHANCEMENTS]
+
+ - Introduce a new format character "%k" (="Token"). Idea and patch provided by Bruce Ravel.
+ Token which updates its value before being displayed. An example use
+ of this would be a loop wherein every step of the loop could be
+ identified by a particular string.
+
+0.06 - 2010-05-28T12:00:00+01:00
+
+ [ENHANCEMENTS]
+
+ - add option {num => q{9'999}} to allow variable number formats
+ add dynamic growth of a number, such that format: '%c of %m' outputs
+ 2_870 of 9_274
+ Also, write something reasonable in file README
+
+0.05 - 2010-05-11T12:00:00+01:00
+
+ [DOCUMENTATION]
+
+ - in Build.PL and in Makefile.PL
+ change requirement "use 5.10" to the less restrictive "use 5.8"
+
+0.04 - 2010-03-27T12:00:00+01:00
+
+ [ENHANCEMENTS]
+
+ - add a function rem_backspace() that takes a file and removes backspaces from that file
+
+ [REVERT]
+
+ - revert back to version 0.02 (except for "add Build.PL" and "make new() die on errors"), that is...
+ * remove item from ver 0.03: "...add code to detect $ENV{TERM_SK_OUTPUT}..."
+ * remove item from ver 0.03: "...add Sidenotes.pod..."
+ * remove item from ver 0.03: "...add use IO::Handle and replace local $| = 1;..."
+
+0.03 - 2010-01-22T12:00:00+01:00
+
+ [ENHANCEMENTS]
+
+ - add code to detect $ENV{TERM_SK_OUTPUT} to connect to, in which case {quiet =>...} is ignored
+ add Build.PL
+ add Sidenotes.pod
+ make new() die on errors
+ add "use IO::Handle" and replace "local $| = 1;" by "IO::Handle::flush();"
+
+0.02 - 2009-11-24T12:00:00+01:00
+
+ [ENHANCEMENTS]
+
+ - make option {quiet => !-t STDOUT} the default
+ make option {pdisp => '!'} meaningless, i.e. always use "#" to
+ display the progress bar
+
+0.01 - 2009-06-20T12:00:00+01:00
+
+ [ENHANCEMENTS]
+
+ - First version, released on an unsuspecting world.
@@ -1,7 +1,7 @@
+.gitignore
Changes
MANIFEST
Makefile.PL
-Build.PL
README
lib/Term/Sk.pm
t/0010_test.t
@@ -1,36 +1,46 @@
{
- "abstract" : "Perl extension for displaying a progress indicator on a terminal",
+ "abstract" : "Perl extension for displaying a progress indicator on a terminal.",
"author" : [
- "unknown"
+ "Klaus Eichner <klaus03@gmail.com>"
],
"dynamic_config" : 1,
- "generated_by" : "Module::Build version 0.4003, CPAN::Meta::Converter version 2.120921",
+ "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141170",
"license" : [
- "perl_5"
+ "unknown"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
"name" : "Term-Sk",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "inc"
+ ]
+ },
"prereqs" : {
+ "build" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "0"
+ }
+ },
"configure" : {
"requires" : {
- "Module::Build" : "0.3"
+ "ExtUtils::MakeMaker" : "0"
}
- }
- },
- "provides" : {
- "Term::Sk" : {
- "file" : "lib/Term/Sk.pm",
- "version" : "0.14"
+ },
+ "runtime" : {
+ "requires" : {}
}
},
"release_status" : "stable",
"resources" : {
- "license" : [
- "http://dev.perl.org/licenses/"
- ]
+ "repository" : {
+ "type" : "git",
+ "url" : "https://github.com/klaus03/Term-Sk.git",
+ "web" : "https://github.com/klaus03/Term-Sk"
+ }
},
- "version" : "0.14"
+ "version" : "0.16"
}
@@ -1,21 +1,23 @@
---
-abstract: 'Perl extension for displaying a progress indicator on a terminal'
+abstract: 'Perl extension for displaying a progress indicator on a terminal.'
author:
- - unknown
-build_requires: {}
+ - 'Klaus Eichner <klaus03@gmail.com>'
+build_requires:
+ ExtUtils::MakeMaker: '0'
configure_requires:
- Module::Build: 0.3
+ ExtUtils::MakeMaker: '0'
dynamic_config: 1
-generated_by: 'Module::Build version 0.4003, CPAN::Meta::Converter version 2.120921'
-license: perl
+generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141170'
+license: unknown
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: Term-Sk
-provides:
- Term::Sk:
- file: lib/Term/Sk.pm
- version: 0.14
+no_index:
+ directory:
+ - t
+ - inc
+requires: {}
resources:
- license: http://dev.perl.org/licenses/
-version: 0.14
+ repository: https://github.com/klaus03/Term-Sk.git
+version: '0.16'
@@ -9,4 +9,15 @@ WriteMakefile(
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/Term/Sk.pm', # retrieve abstract from module
AUTHOR => 'Klaus Eichner <klaus03@gmail.com>') : ()),
+ (eval { ExtUtils::MakeMaker->VERSION(6.46) } ? (META_MERGE => {
+ 'meta-spec' => { version => 2 },
+ resources => {
+ repository => {
+ type => 'git',
+ url => 'https://github.com/klaus03/Term-Sk.git',
+ web => 'https://github.com/klaus03/Term-Sk',
+ }
+ }})
+ : ()
+ ),
);
@@ -1,4 +1,4 @@
-Term-Sk Version 0.14
+Term-Sk Version 0.16
This is a Perl extension for displaying a progress indicator on a terminal.
@@ -16,7 +16,7 @@ our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw();
-our $VERSION = '0.14';
+our $VERSION = '0.16';
our $errcode = 0;
our $errmsg = '';
@@ -231,6 +231,9 @@ sub show {
my $min = int(($unit % 3600) / 60);
my $sec = $unit % 60;
my $stamp = sprintf '%02d:%02d:%02d', $hour, $min, $sec;
+
+ $stamp = substr($stamp, -$len) if length($stamp) > $len;
+
$text .= sprintf "%${len}.${len}s", $stamp;
next;
}
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More tests => 71;
+use Test::More tests => 74;
use_ok('Term::Sk');
@@ -235,6 +235,20 @@ use_ok('Term::Sk');
is(content($ctr->get_line), q{Token1 ghi Token2 jkl Ctr 1}, 'Test-0760: second double Token displayed correctly');
}
+# Test for version 0.15:
+# **********************
+
+{
+ # mock-time = Tue Jun 21 14:21:02-28 2011
+ my $ctr = Term::Sk->new('T(%5t)', { test => 1, base => 1, mock_tm => 1308658862.287032} );
+ ok(defined($ctr), 'Test-0770: %t works ok');
+ is(content($ctr->get_line), q{T(00:00)}, 'Test-0780: first time displays "00:00"');
+ # mock-time = Tue Jun 21 14:21:26-29 2011
+ $ctr->mock_time(1308658885.4382647);
+ $ctr->up;
+ is(content($ctr->get_line), q{T(00:23)}, 'Test-0790: second time displays "00:23"');
+}
+
sub content {
my ($text) = @_;