ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/ActiveDoc/Activate.pm
(Generate patch)

Comparing COMP/SCRAM/src/ActiveDoc/Activate.pm (file contents):
Revision 1.1.2.1 by williamc, Mon Aug 28 07:04:42 2000 UTC vs.
Revision 1.5 by sashby, Thu Dec 8 15:43:43 2005 UTC

# Line 1 | Line 1
1 + BEGIN
2 +   {
3 +   print "ActiveDoc::Activate: I AM used!","\n";
4 +   };
5 +
6   #
7   # Easy Setup of cache etc for ActiveDoc enactivation
8   #
# Line 43 | Line 48 | sub get {
48          $self->verbose("Attempt to get $url");
49          my $file;
50          # We dont want it messaging
51 <        if ( eval { $file=$self->{ad}->getfile($url)->ProcessedFile() } ) {
52 <          return ($file, $@);
51 >        require FileHandle;
52 >        local (*FHOLD);
53 >        local (*FHOLDERR);
54 >        # - copy STDERR and STDOUT
55 >        open(FHOLD,">&STDOUT");
56 >        open(FHOLDERR,">&STDERR");
57 >
58 >        # - redirect STDERR and STDOUT
59 >        my $rfile="/tmp/$$";
60 >        $self->verbose("Redirecting STDOUT to $rfile");
61 >        open(STDOUT, ">".$rfile) || die "Unable to open $!\n";
62 >        open(STDERR, ">&STDOUT") || die "Unable to open $!\n";
63 >
64 >        # -- call
65 >        my @rv=();
66 >        eval { $file=$self->{ad}->getfile($url)->ProcessedFile() };
67 >        if ( (! defined $file) || ($file eq "") ) {
68 >          push @rv, (undef,$rfile);
69          }
70          else {
71 <          return (undef, $@);
71 >          push @rv, ($file,$rfile);
72          }
73 +        close STDOUT;
74 +        close STDERR;
75 +
76 +        # -- restore STDOUT & STDERR
77 +        open(STDOUT, ">&FHOLD");
78 +        open(STDERR, ">&FHOLDERR");
79 +        close FHOLD;
80 +        close FHOLDERR;
81 +
82 +        $self->verbose("Redirection Finnished of STDOUT");
83 +        return (@rv);
84   }
85  
86   sub activatedoc {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines