> In article
> <[EMAIL PROTECTED]
> nfiniplex.com>,
> [EMAIL PROTECTED] (Dan Muey) writes:
> >Howdy list!
> >I was wondering...(imagine that!)
> >
> >If I have in my script:
> >
> > #!/usr/bin/perl -w
> > use strict;
> > use ModuleWhatever;
> >
> >And ModuleWhatever has:
> >
> > package ModuleWhatever;
> > $|++;
> >
> >Would that turn on autoflush for the rest of the script
>
> Yes.
>
> You can limit the scope of an assignment to $| with local:
>
> {
> local $| = 1;
> ...
> }
>
> but be aware this is a dynamic scope and not a lexical one,
> i.e., just wrapping that around a bunch of subs in a module
> won't cause them to acquire a non-zero $| whenever something
> outside calls them.
>
> Assuming you're writing the module that wants to do this,
> use local $| inside each and every subroutine in it that
> wants to turn buffering on.
>
> I've never felt the urge to do this. Perhaps you could share
> what it is you're doing that makes you think you do?
I have a bunch of scripts that use a module for simply sharing variables, IE if I
change one I change it in one place instead of having to edit tons of scripts. So I
thought if by chance I wanted to do $|++; in the scripts I could do it in the module,
one place one time, and have all the scripts running that way.
The only reason I was thinking about doing this is the discussions about it on the
list lately I was wondering if it might be usefull for output to be unbuffered. So I
thought I'd see how it worked by testing it but I wanted to make sure that if I put it
in the module it would effect the entire script that uses the module it's in. I don't
want to change it back to 0.
So I don'; think I have to worry about using local or putting it in every subroutine,
etc.
Just put under the package statement and it effects the entire module and script that
uses it? Right?
TIA
Dan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]