tags:

views:

35

answers:

1

In my function I am doing this

my $output; 
open (MEM, '>', \$output or die "Can't open MEM: $!");
$B::Concise::walkHandle = \*MEM;

But I get the error

Not a GLOB reference at C:/Perl/lib/mycrap.pm line 157.
CHECK failed--call queue aborted.

What should I do

+3  A: 

Not a GLOB reference - (F) A fatal error (trappable).

(F) Perl was trying to evaluate a reference to a "typeglob" 
(that is, a symbol table entry that looks like *foo ), 
but found a reference to something else instead. 
You can use the ref() function to find out what kind of ref it really was. 

From Perldoc

It isn't possible to create a true reference to an IO handle 
(filehandle or dirhandle) using the backslash operator.

The most you can get is a reference to a typeglob, which is actually a complete symbol table entry. But see the explanation of the *foo{THING} syntax in Perlref link. However, you can still use type globs and globrefs as though they were IO handles.

make something like $globref = \*foo;

For more detail go to See perlref.

As i am seeing your previous questions, i think you are looking for walk_output

lets you change the print destination from STDOUT to another open filehandle, or into a string passed as a ref (unless you've built perl with -Uuseperlio).

see B::Concise & B::Concise - Walk Perl syntax tree, printing concise info about ops for complete examples.

Nikhil Jain