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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.