Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Should I worry about "Inappropriate ioctl for device"?

by Lady_Aleena (Curate)
on Aug 07, 2020 at 14:30 UTC ( #11120470=note: print w/replies, xml ) Need Help??


in reply to Re: Should I worry about "Inappropriate ioctl for device"?
in thread Should I worry about "Inappropriate ioctl for device"?

I was just wondering if this was something I should go through all my work and fix now, or can it wait until later? Is it a critical flaw in my writing? Could an inappropriate use of $! bite me sooner rather than later?

I have been tacking $! onto the end of every string I use in die and warn since I was told to use it there. I had not looked into what it was doing or how it worked. I have been using it because I was told to use it on one occasion, probably when I first used die with an open.

Please forgive me for not knowing my use of $! was not appropriate in the case in my OP. Should this be urgent, I will go through my work and make the needed changes.

My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.

No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
Lady Aleena

Replies are listed 'Best First'.
Re^3: Should I worry about "Inappropriate ioctl for device"?
by choroba (Archbishop) on Aug 07, 2020 at 14:34 UTC
    If you use it just in the messages coming from die or warn, it's confusing, but not critical. Basing the program flow on the value would be a critical problem, though:
    ... die $! if $!; # Can stop your program for no real reason.
    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      Thank you for explaining this to me. I have removed the confusing use of $! from the code above. I will look at my other uses of it as I come across it in my code to make sure it makes sense where it is.

      Have a nice day!

      My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.

      No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
      Lady Aleena
Re^3: Should I worry about "Inappropriate ioctl for device"?
by AnomalousMonk (Bishop) on Aug 07, 2020 at 16:49 UTC

    Lady_Aleena:

    If you didn't run any function that sets $!, or you ran it but it didn't fail, the contents of $! could be anything.
    E.g.:
    c:\@Work\Perl\monks>perl -wMstrict -le "print 0+$!, qq{ == '$!'}; " 9 == 'Bad file descriptor'


    Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11120470]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2020-12-03 23:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (58 votes). Check out past polls.

    Notices?