I note that Device::BCM2835 has many functions with fully-qualifed names that aren't exported. You've shown use of one of these:
Device::BCM2835::gpio_fsel(...);
and I showed how to create an alias:
*gpio_fsel = \&Device::BCM2835::gpio_fsel;
If you're actually using a number of these subroutines, you can make aliases for all in a similar fashion to ++ikegami's "Taken a step further". For example, if you're using Device::BCM2835::gpio_fsel(...), Device::BCM2835::gpio_set(...) and Device::BCM2835::gpio_clr(...), you could write:
for my $sub (qw{gpio_fsel gpio_set gpio_clr}) { no strict 'refs'; *$sub = \&{"Device::BCM2835::$sub"}; }
and subsequently call:
gpio_fsel(...); gpio_set(...); gpio_clr(...);
Update (typo fix): I had written "(...}" instead of "(...)"; then, with the power of copy-paste, propagated that typo two more times. I've fixed all three instances.
— Ken
In reply to Re^2: How to make a variable in hard call.
by kcott
in thread How to make a variable in hard call.
by Konan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |