Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > status of redirecting STDOUT/STDERR to file

Reply
Thread Tools

status of redirecting STDOUT/STDERR to file

 
 
jonathan
Guest
Posts: n/a
 
      11-20-2003
hey all,

just curious, but if I do the following (after __cut__), does this
have any repercussions for the 'regular' STDERR, STDOUT handles?

jon

__cut__
sub redirect
{
local(*STDERR);
local(*STDOUT) = *STDERR;
open(STDERR, "> /tmp/logit");

print STDERR "HERE!!!\n";
print STDERR "HEREA!!!\n";

close(STDERR);
}

redirect();

print STDERR "HEREB!!!\n";
print STDOUT "HEREC!!!\n";
 
Reply With Quote
 
 
 
 
Anno Siegel
Guest
Posts: n/a
 
      11-21-2003
jonathan <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> hey all,
>
> just curious, but if I do the following (after __cut__), does this
> have any repercussions for the 'regular' STDERR, STDOUT handles?


It shouldn't.

Why are you dealing with STDOUT in redirect()? You're not using it in
any way.

> __cut__
> sub redirect
> {
> local(*STDERR);
> local(*STDOUT) = *STDERR;

^^^^^^^^^^^^^^^^^^^^^^^^
This does nothing useful.

> open(STDERR, "> /tmp/logit");
>
> print STDERR "HERE!!!\n";
> print STDERR "HEREA!!!\n";
>
> close(STDERR);
> }
>
> redirect();
>
> print STDERR "HEREB!!!\n";
> print STDOUT "HEREC!!!\n";


Anno
 
Reply With Quote
 
 
 
 
jonathan
Guest
Posts: n/a
 
      11-24-2003
http://www.velocityreviews.com/forums/(E-Mail Removed)-berlin.de (Anno Siegel) wrote in message news:<bpklsj$da3$(E-Mail Removed)-Berlin.DE>...
> jonathan <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> > hey all,
> >
> > just curious, but if I do the following (after __cut__), does this
> > have any repercussions for the 'regular' STDERR, STDOUT handles?

>
> It shouldn't.
>
> Why are you dealing with STDOUT in redirect()? You're not using it in
> any way.


its called a *typo*. read:

print STDOUT "HERE!!!\n";
print STDERR "HEREA!!!!\n";

I appreciate the help, but the attitude could be a little less snide.
The code snippet was designed to show whether or not any effects might
happen outside of the subroutine.

jon
 
Reply With Quote
 
Anno Siegel
Guest
Posts: n/a
 
      11-24-2003
jonathan <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> (E-Mail Removed)-berlin.de (Anno Siegel) wrote in message
> news:<bpklsj$da3$(E-Mail Removed)-Berlin.DE>...
> > jonathan <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> > > hey all,
> > >
> > > just curious, but if I do the following (after __cut__), does this
> > > have any repercussions for the 'regular' STDERR, STDOUT handles?

> >
> > It shouldn't.
> >
> > Why are you dealing with STDOUT in redirect()? You're not using it in
> > any way.

>
> its called a *typo*. read:


Well, typos in code aren't exactly trivial, whether in communicating with
the machine or with other programmers. It made the meaning of your
extensive question "any repercussions" even harder to grasp.

> print STDOUT "HERE!!!\n";
> print STDERR "HEREA!!!!\n";
>
> I appreciate the help, but the attitude could be a little less snide.
> The code snippet was designed to show whether or not any effects might
> happen outside of the subroutine.


Short and to the point, yes. Snide, no.

Anno
 
Reply With Quote
 
Sam Holden
Guest
Posts: n/a
 
      11-24-2003
On 24 Nov 2003 10:46:56 -0800, jonathan <(E-Mail Removed)> wrote:
> (E-Mail Removed)-berlin.de (Anno Siegel) wrote in message news:<bpklsj$da3$(E-Mail Removed)-Berlin.DE>...
>> jonathan <(E-Mail Removed)> wrote in comp.lang.perl.misc:
>> > hey all,
>> >
>> > just curious, but if I do the following (after __cut__), does this
>> > have any repercussions for the 'regular' STDERR, STDOUT handles?

>>
>> It shouldn't.
>>
>> Why are you dealing with STDOUT in redirect()? You're not using it in
>> any way.

>
> its called a *typo*. read:
>
> print STDOUT "HERE!!!\n";
> print STDERR "HEREA!!!!\n";
>
> I appreciate the help, but the attitude could be a little less snide.
> The code snippet was designed to show whether or not any effects might
> happen outside of the subroutine.


Your failure to read the posting guidelines that are posted here a lot, or
even worse failure to follow them after reading them, combined with that
post will I suspect greatly reduce the useful answers you get in future.

--
Sam Holden
 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      11-24-2003
jonathan <(E-Mail Removed)> wrote:
> (E-Mail Removed)-berlin.de (Anno Siegel) wrote in message news:<bpklsj$da3$(E-Mail Removed)-Berlin.DE>...



>> Why are you dealing with STDOUT in redirect()? You're not using it in
>> any way.

>
> its called a *typo*.



Do not re-type Perl code

Use copy/paste or your editor's "import" function rather than
attempting to type in your code. If you make a typo you will get
followups about your typos instead of about the question you are
trying to get answered.


Somebody ought to write these things down somewhere...


> I appreciate the help, but the attitude could be a little less snide.



If you had been more considerate of other's time, there would have
been no reaping what you had sown.


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
Jay Tilton
Guest
Posts: n/a
 
      11-25-2003
(E-Mail Removed) (jonathan) wrote:

: (E-Mail Removed)-berlin.de (Anno Siegel) wrote in message news:<bpklsj$da3$(E-Mail Removed)-Berlin.DE>...
: > jonathan <(E-Mail Removed)> wrote in comp.lang.perl.misc:
: > > hey all,
: > >
: > > just curious, but if I do the following (after __cut__), does this
: > > have any repercussions for the 'regular' STDERR, STDOUT handles?
: >
: > It shouldn't.
: >
: > Why are you dealing with STDOUT in redirect()? You're not using it in
: > any way.

: I appreciate the help, but the attitude could be a little less snide.

There was nothing in the article that betrayed any attitude, snide or
otherwise.

Pointing out that localizing the STDOUT filehandle has no useful effect
because it is never used in that dynamic scope was actually a partial
answer to the question.

: The code snippet was designed to show whether or not any effects might
: happen outside of the subroutine.

It depends on what is meant by "outside."

Outside of the sub's lexical scope but still within the typeglob's
localized dynamic scope, yes.

Outside of the typeglob's dynamic scope, i.e. when the subroutine exits,
no.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can I use more than one status condition name in imaplib.status() harryos Python 0 10-13-2010 01:37 PM
status info like rc.status Sven S. Ruby 2 12-11-2008 08:26 AM
Recommend a free 'Status Monitor' or 'Dashboard' to report overnight tasks status? Shug Java 13 12-15-2006 06:22 PM
Recommend a free 'Status Monitor' or 'Dashboard' to report overnight tasks status? Shug C++ 13 12-15-2006 06:22 PM
POST problem - IIS sc-win32-status:64; sc-status:400 saha ASP .Net 0 07-14-2005 07:10 AM



Advertisments