Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by choroba (Archbishop)
on Aug 07, 2020 at 13:03 UTC ( #11120467=note: print w/replies, xml ) Need Help??


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

Inspecting $! only makes sense when you know it was set, e.g. in open ... or die $!;. If you didn't run any function that sets $!, or you ran it but it didn't fail, the contents of $! could be anything.

Somehow mentioned in $!.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: Should I worry about "Inappropriate ioctl for device"?
by Lady_Aleena (Curate) on Aug 07, 2020 at 14:30 UTC

    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
      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

      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://11120467]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2021-01-20 13:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?