r3799 - in /packages/libterm-size-perl: ./ branches/ branches/upstream/ branches/upstream/current/ tags/

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Thu Sep 14 22:54:22 UTC 2006


Author: gregoa-guest
Date: Thu Sep 14 22:54:21 2006
New Revision: 3799

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=3799
Log:
[svn-inject] Installing original source of libterm-size-perl

Added:
    packages/libterm-size-perl/
    packages/libterm-size-perl/branches/
    packages/libterm-size-perl/branches/upstream/
    packages/libterm-size-perl/branches/upstream/current/
    packages/libterm-size-perl/branches/upstream/current/Changes
    packages/libterm-size-perl/branches/upstream/current/Copyright
    packages/libterm-size-perl/branches/upstream/current/INSTALL
    packages/libterm-size-perl/branches/upstream/current/MANIFEST
    packages/libterm-size-perl/branches/upstream/current/Makefile.PL
    packages/libterm-size-perl/branches/upstream/current/README
    packages/libterm-size-perl/branches/upstream/current/Size.pm
    packages/libterm-size-perl/branches/upstream/current/Size.xs
    packages/libterm-size-perl/branches/upstream/current/test.pl
    packages/libterm-size-perl/tags/

Added: packages/libterm-size-perl/branches/upstream/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libterm-size-perl/branches/upstream/current/Changes?rev=3799&op=file
==============================================================================
--- packages/libterm-size-perl/branches/upstream/current/Changes (added)
+++ packages/libterm-size-perl/branches/upstream/current/Changes Thu Sep 14 22:54:21 2006
@@ -1,0 +1,7 @@
+Revision history for Perl extension Term::Size.
+
+0.2 1997-05-13
+	- support filehandle arguments
+
+0.1 1997-04-23
+	- original version

Added: packages/libterm-size-perl/branches/upstream/current/Copyright
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libterm-size-perl/branches/upstream/current/Copyright?rev=3799&op=file
==============================================================================
--- packages/libterm-size-perl/branches/upstream/current/Copyright (added)
+++ packages/libterm-size-perl/branches/upstream/current/Copyright Thu Sep 14 22:54:21 2006
@@ -1,0 +1,7 @@
+The files in this directory are Copyright 1997-05-13, Tim Goodwin.
+
+You may redistribute them under the same terms as Perl itself.
+
+Tim Goodwin
+<tim at uunet.pipex.com>
+1997-05-13

Added: packages/libterm-size-perl/branches/upstream/current/INSTALL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libterm-size-perl/branches/upstream/current/INSTALL?rev=3799&op=file
==============================================================================
--- packages/libterm-size-perl/branches/upstream/current/INSTALL (added)
+++ packages/libterm-size-perl/branches/upstream/current/INSTALL Thu Sep 14 22:54:21 2006
@@ -1,0 +1,36 @@
+You need Perl 5.002 or later.
+
+1. Create a Makefile.
+
+    perl Makefile.PL
+
+2. Build the Term::Size extension.
+
+    make
+
+3. Test it (please don't omit this step).
+
+    make test
+
+You should see `ok 1' through to `ok 6', followed by a description of
+the size of the terminal you are using.
+
+If any tests fail, please get in touch so we can sort out the problem.
+
+4. Install the extension.
+
+If you have built Term::Size as a dynamic extension, it's as simple as
+this.
+
+    make install
+
+If you have built Term::Size as a static extension, follow the
+instructions given during the build process.
+
+5. If you have any problems, questions, or ideas for future
+enhancements, please contact me.  I'm particularly keen to hear from
+people who can help me make Term::Size work on systems other than Unix.
+
+Tim Goodwin
+<tim at uunet.pipex.com>
+1997-05-13

Added: packages/libterm-size-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libterm-size-perl/branches/upstream/current/MANIFEST?rev=3799&op=file
==============================================================================
--- packages/libterm-size-perl/branches/upstream/current/MANIFEST (added)
+++ packages/libterm-size-perl/branches/upstream/current/MANIFEST Thu Sep 14 22:54:21 2006
@@ -1,0 +1,9 @@
+Copyright
+Changes
+INSTALL
+MANIFEST
+Makefile.PL
+README
+Size.pm
+Size.xs
+test.pl

Added: packages/libterm-size-perl/branches/upstream/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libterm-size-perl/branches/upstream/current/Makefile.PL?rev=3799&op=file
==============================================================================
--- packages/libterm-size-perl/branches/upstream/current/Makefile.PL (added)
+++ packages/libterm-size-perl/branches/upstream/current/Makefile.PL Thu Sep 14 22:54:21 2006
@@ -1,0 +1,6 @@
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+	'NAME'		=> 'Term::Size',
+	'VERSION_FROM'	=> 'Size.pm',
+);

Added: packages/libterm-size-perl/branches/upstream/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libterm-size-perl/branches/upstream/current/README?rev=3799&op=file
==============================================================================
--- packages/libterm-size-perl/branches/upstream/current/README (added)
+++ packages/libterm-size-perl/branches/upstream/current/README Thu Sep 14 22:54:21 2006
@@ -1,0 +1,10 @@
+This is alpha release 0.2 of Term::Size.
+
+Term::Size is a Perl module which provides a straightforward way to get
+the size of the terminal (or window) on which a script is running.
+
+For installation instructions, see the file INSTALL.
+
+Tim Goodwin
+<tim at uunet.pipex.com>
+1997-05-13

Added: packages/libterm-size-perl/branches/upstream/current/Size.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libterm-size-perl/branches/upstream/current/Size.pm?rev=3799&op=file
==============================================================================
--- packages/libterm-size-perl/branches/upstream/current/Size.pm (added)
+++ packages/libterm-size-perl/branches/upstream/current/Size.pm Thu Sep 14 22:54:21 2006
@@ -1,0 +1,96 @@
+package Term::Size;
+
+use strict;
+use Carp;
+use vars qw(@EXPORT_OK @ISA $VERSION);
+
+use AutoLoader ();
+use DynaLoader ();
+use Exporter ();
+
+ at ISA = qw(Exporter DynaLoader);
+ at EXPORT_OK = qw(chars pixels);
+
+$VERSION = '0.2';
+
+=head1 NAME
+
+Term::Size - Perl extension for retrieving terminal size
+
+=head1 SYNOPSIS
+
+    use Term::Size;
+
+    ($columns, $rows) = Term::Size::chars *STDOUT{IO};
+    ($x, $y) = Term::Size::pixels;
+
+=head1 DESCRIPTION
+
+B<Term::Size> is a Perl module which provides a straightforward way to
+retrieve the terminal size.
+
+Both functions take an optional filehandle argument, which defaults to
+C<*STDIN{IO}>.  They both return a list of two values, which are the
+current width and height, respectively, of the terminal associated with
+the specified filehandle.
+
+C<Term::Size::chars> returns the size in units of characters, whereas
+C<Term::Size::pixels> uses units of pixels.
+
+In a scalar context, both functions return the first element of the
+list, that is, the terminal width.
+
+The functions may be imported.
+
+If you need to pass a filehandle to either of the C<Term::Size>
+functions, beware that the C<*STDOUT{IO}> syntax is only supported in
+Perl 5.004 and later.  If you have an earlier version of Perl, or are
+interested in backwards compatibility, use C<*STDOUT> instead.
+
+=head1 EXAMPLES
+
+1. Refuse to run in a too narrow window.
+
+    use Term::Size;
+
+    die "Need 80 column screen" if Term::Size::chars *STDOUT{IO} < 80;
+
+2. Track window size changes.
+
+    use Term::Size 'chars';
+
+    my $changed = 1;
+
+    while (1) {
+            local $SIG{'WINCH'} = sub { $changed = 1 };
+
+            if ($changed) {
+                    ($cols, $rows) = chars;
+                    # Redraw, or whatever.
+                    $changed = 0;
+            }
+    }
+
+=head1 RETURN VALUES
+
+Both functions return C<undef> if there is an error.
+
+If the terminal size information is not available, the functions
+will normally return C<(0, 0)>, but this depends on your system.  On
+character only terminals, C<pixels> will normally return C<(0, 0)>.
+
+=head1 BUGS
+
+It only works on Unix systems.
+
+=head1 AUTHOR
+
+Tim Goodwin, <tim at uunet.pipex.com>, 1997-04-23.
+
+=cut
+
+bootstrap Term::Size $VERSION;
+
+1;
+
+__END__

Added: packages/libterm-size-perl/branches/upstream/current/Size.xs
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libterm-size-perl/branches/upstream/current/Size.xs?rev=3799&op=file
==============================================================================
--- packages/libterm-size-perl/branches/upstream/current/Size.xs (added)
+++ packages/libterm-size-perl/branches/upstream/current/Size.xs Thu Sep 14 22:54:21 2006
@@ -1,0 +1,47 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include <sys/termios.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+MODULE = Term::Size		PACKAGE = Term::Size
+
+PROTOTYPES: ENABLE
+
+void
+chars( f = stdin )
+	FILE *f;
+
+	PREINIT:
+	struct winsize w;
+
+	PPCODE:
+	if (ioctl(fileno(f), TIOCGWINSZ, &w) == -1)
+		XSRETURN_NO;
+
+	XPUSHs(sv_2mortal(newSViv(w.ws_col)));
+	if (GIMME != G_SCALAR)
+		XPUSHs(sv_2mortal(newSViv(w.ws_row)));
+
+void
+pixels( f = stdin )
+	FILE *f;
+
+	PREINIT:
+	struct winsize w;
+
+	PPCODE:
+	if (ioctl(0, TIOCGWINSZ, &w) == -1)
+		XSRETURN_NO;
+
+	XPUSHs(sv_2mortal(newSViv(w.ws_xpixel)));
+	if (GIMME != G_SCALAR)
+		XPUSHs(sv_2mortal(newSViv(w.ws_ypixel)));

Added: packages/libterm-size-perl/branches/upstream/current/test.pl
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libterm-size-perl/branches/upstream/current/test.pl?rev=3799&op=file
==============================================================================
--- packages/libterm-size-perl/branches/upstream/current/test.pl (added)
+++ packages/libterm-size-perl/branches/upstream/current/test.pl Thu Sep 14 22:54:21 2006
@@ -1,0 +1,31 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl test.pl'
+
+BEGIN {print "1..6\n";}
+END {print "not ok 1\n" unless $loaded;}
+use Term::Size;
+$loaded = 1;
+print "ok 1\n";
+
+ at chars = Term::Size::chars;
+ at chars == 2 or print 'not ';
+print "ok 2\n";
+
+ at chars1 = Term::Size::chars *STDERR;
+ at chars1 == 2 and $chars[0] == $chars1[0] and $chars[1] == $chars1[1] or print 'not ';
+print "ok 3\n";
+
+$cols = Term::Size::chars;
+$cols == $chars[0] or print 'not ';
+print "ok 4\n";
+
+ at pixels = Term::Size::pixels;
+ at pixels == 2 or print 'not ';
+print "ok 5\n";
+
+$x = Term::Size::pixels;
+$x == $pixels[0] or print 'not ';
+print "ok 6\n";
+
+print "\nThis terminal is $chars[0]x$chars[1] characters,\n";
+print "  and $pixels[0]x$pixels[1] pixels.\n";




More information about the Pkg-perl-cvs-commits mailing list