Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: How to export a package sitting lower in a module?

by kennethk (Abbot)
on Apr 22, 2013 at 15:38 UTC ( #1029911=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to export a package sitting lower in a module?
in thread How to export a package sitting lower in a module?

Sometimes (especially if you have an object-oriented project, with many little packages), it's not convenient to have each package in a speparate file.
If you are doing OO programming in Perl, you don't need to import anything. Using packages as libraries and exporting subroutines into a user space is actually a direct contradiction with a rigid OO model.
Please note that this still doesn't work: the .pm module fails, complaining that the second @ISA is a bareword.
That's because you're violating strict. Try our:
package pack_B; use strict; require Exporter; our @ISA = qw {Exporter}; our @EXPORT = qw {third fourth}; sub third { } sub fourth { } 1;

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Replies are listed 'Best First'.
Re^4: How to export a package sitting lower in a module?
by HelenCr (Monk) on Apr 22, 2013 at 20:00 UTC

    Thank you, kennethk. That works (provided that you use "our @ISA" and "our @EXPORT" both in the first (pack_A) and the second (pack_B) packages).

    Many thanks - Helen

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1029911]
help
Chatterbox?
[stevieb]: I don't know what you mean. I write the code in C/C++ that accesses the ICs per the datasheet, wrap it for Perl, then use them. My code ensures that the functions/methods from Perl do the right thing for the chips/sensors etc
[stevieb]: At least that's what I'm working on right now. I've also been updating my automated test software Test::BrewBuild so it handles this work properly. It's not really easy meshing high level languages with low-level hardware :)
[stevieb]: this link is probably better for an overview of my test software

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2017-06-25 23:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (572 votes). Check out past polls.