Debian Codegraph @

eg/fib

raw
1 #!/usr/local/bin/perl
2 use strict;
3 use IO::Pager::Perl;
4 use Term::ReadKey;
5
6 my($m, $n)=(1,1);
7 my $t = IO::Pager::Perl->new(pause=>"\cL", wrap=>1, pause=>"\cL",
8 text=> ["1\n",
9 sub{ ($m,$n)=($n,$m+$n); return "$m\n" } ]
10 );
11 my($PIPE, @F);
12 #if( -t STDIN ){
13 # @F = <ARGV> }
14 #else{
15 # #Separate piped input from keyboard input
16 # open($PIPE, '<&=STDIN' ) or die $!;
17 # close(STDIN);
18 # open(STDIN, '<', '/dev/tty') or die $!;
19 #}
20
21 eval{
22 while( $t->more(RT=>.05) ){
23 # my $X;
24 # defined($PIPE) ?
25 # do{ $t->add_text($X) if sysread($PIPE, $X, 1024) } :
26 # $t->add_text( splice(@F, 0, $t->rows()) );
27 }
28 };
29
30 __END__
31 =pod
32
33 =head1 NAME
34
35 fib - display Fibanocci sequence via callback with a pure perl pager
36
37 =head1 SEE ALSO
38
39 L<IO::Pager::Perl>, L<less(1)>
40
41 =head1 AUTHORS
42
43 Jerrad Pierce [email protected]
44
45 =head1 LICENSE
46
47 =cut