Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Re: Thoughts on Perl6 - Love it? Hate it?

by Anonymous Monk
on Jan 11, 2002 at 01:29 UTC ( #137840=note: print w/replies, xml ) Need Help??


in reply to Re: Thoughts on Perl6 - Love it? Hate it?
in thread Thoughts on Perl6 - Love it? Hate it?

I don't want to have to do $filehandle.autoflush(1) instead of $|++.

Ugghhh! $++ doesn't do what you think. You think $| == 0 and that $|++ makes $|==1. Sure IFF $|==0. But what when some other fool does $|++. Then your $|++ doesn't do anything. Even worse $|-- doesns't set $|==0, because you blindly did $++. Now maybe your think this turns it into some sort of recursive lock type thing. No! because someone could have done $|=0 or $|=1 in another part or the code, cuz it's is the RightThing(tm).

Just remember that $|++ is a SIN. Don't do it.

BTW, what does $|==-1 even mean?

  • Comment on Re: Re: Thoughts on Perl6 - Love it? Hate it?

Replies are listed 'Best First'.
Re: Re: Re: Thoughts on Perl6 - Love it? Hate it?
by blakem (Monsignor) on Jan 11, 2002 at 01:49 UTC
    $| is magic. It is always either 0 or 1. $|++ sets its value to 1 no matter what its original value was.

    However, $|-- is a bit trickier. $|-- toggles the value of $|. So, its actually a lot like $| = !$_

    % perl -le 'print $| and $|++ for 1..5;' 0 1 1 1 1 % perl -le 'print $| and $|-- for 1..5;' 0 1 0 1 0

    -Blake

(ichimunki) Re x 3: Thoughts on Perl6 - Love it? Hate it?
by ichimunki (Priest) on Jan 11, 2002 at 01:42 UTC
    'perldoc perlvar'

    The only values that count here are 0 and non-zero.
      Consider the tao of $|--

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://137840]
help
Chatterbox?
[tye]: apropos my several mentions of audit
[Corion]: At least my (non-SELinux) Debian has that config thing set. I don't have non-Debian machines handy (except Android)
[Corion]: My Android phone also has /proc/self/ loginuid, but that displays -1 (resp. 4GB). That might be because the phone is rooted.
[tye]: -1 means nobody logged in or the process was started before audit got booted
[davido]: ok, on my ubuntu system getlogin grabs from /proc/self/ loginuid (per strace)
[tye]: disable /proc and then see what it does?
[davido]: then it reads from /etc/passwd to decide who my uid is.
[davido]: sorry, typed that before you asked me to disable proc

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2017-06-23 20:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (554 votes). Check out past polls.