in reply to Re^4: Export and use different package in module
in thread Export and use different package in module
Device::BCM2835 does export RPI_V2_GPIO_P1_12 and BCM2835_GPIO_FSEL_ALT5, so you should be able to say
use Device::BCM2835 qw/RPI_V2_GPIO_P1_12 BCM2835_GPIO_FSEL_ALT5/;
to get those into your namespace. As for gpio_fsel, which apparently isn't exported for some reason, you could use this workaround:
*gpio_fsel = \&Device::BCM2835::gpio_fsel;
For more than one function:
for my $s (qw/ gpio_fsel gpio_set /) { no strict 'refs'; *$s = \&{"Device::BCM2835::$s"}; }
To understand what's going on in the above, I recommend perlmod.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Export and use different package in module
by chenhonkhonk (Acolyte) on Feb 22, 2019 at 22:27 UTC | |
by haukex (Archbishop) on Feb 22, 2019 at 23:29 UTC | |
by chenhonkhonk (Acolyte) on Feb 23, 2019 at 06:10 UTC | |
by haukex (Archbishop) on Feb 23, 2019 at 09:36 UTC | |
by chenhonkhonk (Acolyte) on Feb 23, 2019 at 13:19 UTC | |
|