WARC

 view release on metacpan or  search on metacpan

t/WARC-Record-Logical-Block.t  view on Meta::CPAN

  ## record:  at EOF
  ok((not defined scalar <$xh>),'read record at eof');
  ok((eof $xh),			'handle still at eof after read at eof');
  note_handle_state $xh;
}

note('*' x 60);

# Verify READLINE (paragraph)
{
  local $/ = '';	# select paragraph mode

  my $xh = make_test_handle
    "abc\ndef\n\n\n\nghi\njkl\n\n", "mno\npqr\nstu\n\nvwx\nyz", "0\n\n123\n456";
  note_handle_state $xh;
  ## paragraph:  within segment
  is(scalar <$xh>, "abc\ndef\n\n\n\n",
				'read paragraph within segment');
  note_handle_state $xh;
  ## paragraph:  to segment boundary
  is(scalar <$xh>, "ghi\njkl\n\n",

t/WARC-Record-Logical-Block.t  view on Meta::CPAN

     'read mcdcop line with false prefix and data to delimiter');
  ##		... to EOF without delimiter
  is(scalar <$xh>, 'wxyz',	'read mcdcop line to eof without delimiter');
  ok((eof $xh),			'filehandle now at eof');
}

# Verify READLINE (mixed modes)
{
  my $xh;
  {
    local $/ = '';	# ensure that handle is usable in paragraph mode
    $xh = make_test_handle "abc\n";
  }
  is(scalar <$xh>, "abc\n",	'read line to eof');
  local $/ = '';	# select paragraph mode
  ok((not defined scalar <$xh>),'read paragraph at eof');

  $/ = \4;		# select record mode
  $xh = make_test_handle '1234';
  is(scalar <$xh>, '1234',	'read record to eof');
  $/ = "\n";		# select line mode
  ok((not defined scalar <$xh>),'read line at eof');

  $xh = make_test_handle "1234\n";
  is(scalar <$xh>, "1234\n",	'read line to eof for slurp');



( run in 0.262 second using v1.01-cache-2.11-cpan-94b05bcf43c )