WARC

 view release on metacpan or  search on metacpan

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

169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
  ## 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

348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
     '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.250 second using v1.01-cache-2.11-cpan-94b05bcf43c )