Event->io does not accept GLOB refs

[email protected] (Marc Lehmann)
Newsgroups perl.loop
Message-ID <[email protected]>
As I read the documentation, Event->io should accept a GLOB
reference as argument, but I cannot get this to work (it only works
with some glob references, e.g. ones created by IO::Handle):

   use Event;

   my $fh = do { local *GLOB };
   open $fh, "<", "/dev/null" or die;

   print "fileno: ", fileno $fh, "\n";
   print "asstring: $fh\n"; 

   Event->io(fd => $fh, cb => sub {});

This prints:

fileno: 4
asstring: *main::GLOB
Event: can't start '?? x.pl:12' because there is nothing to watch at x.pl line 12

Devel::Peek thinks this about the $fh:

SV = PVGV(0x81a79c0) at 0x811e5a8
  REFCNT = 1
  FLAGS = (PADBUSY,PADMY,GMG,SMG,FAKE,pPOK,MULTI)
  IV = 0
  NV = 0
  MAGIC = 0x8122158
    MG_VIRTUAL = &PL_vtbl_glob
    MG_TYPE = '*'
    MG_OBJ = 0x811e5a8
  NAME = "GLOB"
  NAMELEN = 4
  GvSTASH = 0x810f08c   "main"
  GP = 0x8191b20
    SV = 0x810f164
    REFCNT = 1
    IO = 0x810f23c
    FORM = 0x0  
    AV = 0x0
    HV = 0x0
    CV = 0x0
    CVGEN = 0x0
    GPFLAGS = 0x0
    LINE = 6
    FILE = "(null)"
    FLAGS = 0x2
    EGV = 0x0

(perl 5.6+, Event-0.78)

PS: I don't think it is useful to distribute a massive 120k pdf with the
otherwise small distribution, but that's just my unimportant opinion.


-- 
      -----==-                                             |
      ----==-- _                                           |
      ---==---(_)__  __ ____  __       Marc Lehmann      +--
      --==---/ / _ \/ // /\ \/ /       [email protected] |e|
      -=====/_/_//_/\_,_/ /_/\_\       XX11-RIPE         --+
    The choice of a GNU generation                       |
                                                         |
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.