typeglob Questions
4
Solved
In Perl, is there ever any difference between the following two constructs:
*main::foo = *main::bar
and
$main::{foo} = $main::{bar}
They appear to have the same function (aliasing all of the ...
Mackinnon asked 6/7, 2011 at 21:36
2
This example works fine:
use File::Slurp qw(read_file);
local *File::Slurp::read_file = sub {
return 'test';
};
warn File::Slurp::read_file('/root/test.txt'); # return 'test'
this one too:
us...
1
Solved
Apparently, it's possible to store a "raw symbol" (as opposed to a reference to a symbol) in a scalar variable and use it in scalar contexts.
How do you determine whether a scalar-valued expressio...
1
Solved
I am currently learning about Perls system of typeglobs and namespaces. So I wrote a module that takes two arguments the value and the name of a constant and exports the constant to the caller. The...
Selenium asked 4/7, 2014 at 7:27
3
Solved
I'm working with legacy code and have to require a .pl file that defines a sub foo. My problem is that in my main:: namespace there already is another sub foo, which is called later in a part of th...
Huron asked 1/10, 2012 at 9:15
3
Solved
This is a code lifted straight from Perl Cookbook:
@colors = qw(red blue green yellow orange purple violet);
for my $name (@colors) {
no strict 'refs';
*$name = sub { "<FONT COLOR='$name'>@_...
Fumed asked 21/8, 2012 at 15:16
7
Solved
Given a typeglob, how can I find which types are actually defined?
In my application, we user PERL as a simple configuration format.
I'd like to require() the user config file, then be able to see...
2
Solved
I need to remove a method from the Perl symbol table at runtime. I attempted to do this using undef &Square::area, which does delete the function but leaves some traces behind. Specifically, wh...
Inexistent asked 12/1, 2011 at 22:8
1
© 2022 - 2024 — McMap. All rights reserved.