Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Something
Thursday, April 10th, 2008 at 3:50:31pm MDT 

  1. diff --git a/t/Session/Output.t b/t/Session/Output.t
  2. index ec7c1bb..be3d992 100644
  3. --- a/t/Session/Output.t
  4. +++ b/t/Session/Output.t
  5. @@ -35,33 +35,31 @@ my $recentVersion = $^V gt v5.8;
  6.  SKIP: {
  7.         skip "You have an old perl", $skip_tests unless $recentVersion;
  8.  
  9. -       my $stdoutBuffer;
  10. -       close STDOUT;
  11. -       open STDOUT, '>', \$stdoutBuffer or die "Unable to tie STDOUT to a variable: $!\n";
  12. -
  13.         my $otherHandleBuffer;
  14.         open my $otherHandle, '>', \$otherHandleBuffer or die "Unable to create second filehandle: $!\n";
  15.  
  16. -       $output->setHandle(undef);
  17. +    my $request = $session->request;
  18. +
  19. +    $output->setHandle(undef);
  20.         is($output->{_handle}, undef, 'setHandle: handle cleared');
  21.  
  22.         $output->print('Hello STDOUT');
  23. -       is($stdoutBuffer, 'Hello STDOUT', 'print with no handle goes to STDOUT');
  24. +       is($request->get_output, 'Hello STDOUT', 'print with no handle goes to STDOUT');
  25.  
  26.         $output->print(' more stuff');
  27. -       is($stdoutBuffer, 'Hello STDOUT more stuff', 'print: tied variables accumulate');
  28. +       is($request->get_output, 'Hello STDOUT more stuff', 'print: tied variables accumulate');
  29.  
  30.         $session->user({userId => 3});
  31.         $output->print('^#;');
  32. -       like($stdoutBuffer, qr/3\Z/, 'print: macro processing');
  33. +       like($request->get_output, qr/3\Z/, 'print: macro processing');
  34.  
  35.         $output->print('^#;', 1);
  36. -       like($stdoutBuffer, qr/\^#;\Z/, 'print: macro processing skipped');
  37. +       like($request->get_output, qr/\^#;\Z/, 'print: macro processing skipped');
  38.  
  39.         $output->setHandle($otherHandle);
  40.         $output->print('New content');
  41.         is($otherHandleBuffer, 'New content', 'print: set to explicit handle');
  42. -       unlike($stdoutBuffer, qr/New content\Z/, 'print: no leakage back to STDOUT');
  43. +       unlike($request->get_output, qr/New content\Z/, 'print: no leakage back to STDOUT');
  44.  
  45.  }
  46.  
  47. diff --git a/t/lib/WebGUI/PseudoRequest.pm b/t/lib/WebGUI/PseudoRequest.pm
  48. index fd5adbd..64ac756 100644
  49. --- a/t/lib/WebGUI/PseudoRequest.pm
  50. +++ b/t/lib/WebGUI/PseudoRequest.pm
  51. @@ -349,6 +349,26 @@ sub setup_param {
  52.  
  53.  #----------------------------------------------------------------------------
  54.  
  55. +sub clear_output {
  56. +    my $self = shift;
  57. +    $self->{output} = '';
  58. +}
  59. +
  60. +sub get_output {
  61. +    my $self = shift;
  62. +    return $self->{output};
  63. +}
  64. +
  65. +sub print {
  66. +    my $self = shift;
  67. +    my $self->{output} ||= '';
  68. +    for my $p (@_) {
  69. +        $self->{output} .= $p;
  70. +    }
  71. +}
  72. +
  73. +#----------------------------------------------------------------------------
  74. +
  75.  =head2 protocol ( $value )
  76.  
  77.  Getter and setter for protocol.  If $value is passed in, it will set the protocol of

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right
fantasy-obligation