Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1033123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:11:05+00:00 2026-05-16T14:11:05+00:00

EDIT Sorry for the confusion, here is my updated question. I am using FindBin

  • 0

EDIT
Sorry for the confusion, here is my updated question.

I am using FindBin in my perl script like this:

use FindBin qw($Bin);
use lib "$Bin/../lib";
use multi_lib qw(say_hello_world);

This works:

multi_lib::say_hello_world();

but this does not:

say_hello_world();

EDIT 2

This is how multi_lib.pm looks:

package multi_lib;

use strict;
use warnings;
use 5.010;

require Exporter;
my @ISA = qw(Exporter); # removing `my` causes an error!
my @EXPORT_OK = qw(say_hello_world); # removing `my` causes an error!

sub say_hello_world {
 say "hello world!";
}

p.s.
I have no idea what does @ISA stand for and if adding the my is OK… I followed the preldoc for Exporter.

Edit 3
I think I solved it by moving @EXPORT_OK before use strict. I am used to put use strict right at the beginning of my scripts but I guess this is not the way to go here (?). Anyway, this works:

use Exporter 'import';
@EXPORT_OK = qw(say_hello_world);
use strict;
...

I would still appreciate some explanations as to what exactly is going on here and what is the recommended way of exporting subroutines (like I did?).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:11:06+00:00Added an answer on May 16, 2026 at 2:11 pm

    You can’t do that. lib’s import() routine modifies @INC instead of trying to export anything.
    But in any case, there are no functions in lib.pm that are suitable for external use. What are you really trying to accomplish?

    Updated answer for updated question:

    No, you cannot use my() on @EXPORT_OK; it needs to be globally visible so Exporter can use it.
    Say our @EXPORT_OK; instead. The same is true for @ISA; the package variable @ISA controls inheritance, a lexical @ISA does nothing. I prefer not inheriting from Exporter, though; you do this (except with very old Exporter) by just importing Exporter’s import routine:

    use Exporter 5.57 'import';
    

    The error you got that prompted you to add my() was because you specified use strict; (which, among other things, requires that variables be properly declared unless they are package variables qualified by package name or special global variables). our() is the equivalent to my() that declares variables as package variables instead of lexicals, so they are accessible from outside the scope in which they are declared. It’s better to properly declare them with our() than to just move them above use strict; to get around the error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP variable that looks a bit like this: $id = 01922312;
I have a PHP variable that looks a bit like this: $id = 01922312;
I want to open an AIR application with the AIR which was presumably installed
In the interest of eliminating as many nested queries as possible, I'm trying to
Several security experts have said in the past that the login page should be
I seem to have the luck to run into the funniest problems while deploying
The following code will draw an ellipse on an image and fill that ellipse
Is there any way to validate the Facebook Open Graph protocol meta tags in
I know that if I write a class, I can definite a custom print
Is there any idiom for getting an arbitrary key, value pair from a dictionary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.