File: filehandle.t

package info (click to toggle)
libapache-filter-perl 1.024-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 248 kB
  • ctags: 62
  • sloc: perl: 901; makefile: 32
file content (30 lines) | stat: -rw-r--r-- 456 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/perl -w

use Test;
BEGIN { plan tests => 8 }
use Apache::Filter;
ok(1);


ok tie(*FH, 'Apache::Filter');

print FH "line1\n";
ok <FH>, "line1\n";

print FH "line1", "\n", "line2";
ok <FH>, "line1\n";
ok <FH>, "line2";

print FH "line1\nline2\n";
ok join('', <FH>), "line1\nline2\n";


{
  # Test the read() function
  my $buf = '';
  print FH "123456789";
  read(FH, $buf, 2);
  ok $buf, '12';
  read(FH, $buf, 10, 2);
  ok $buf, '123456789';
}