@ISA won't help for function calls, only for method calls. You can call functions in other packages by qualifying them, or by switching package temporarily; you could also export a function in a package and import it into your main script (see Exporter). @ISA only works for method lookup, so you need an object.

Having the *.pm files myblib and vlog

package myblib; sub foo { print +(caller(0))[3],"(@_)\n" } 1;
package vlog; use myblib; sub bar { print +(caller(0))[3],"(@_)\n" } 1;
here are various flavours of calls:
# line 1 gen.pl use vlog; myblib::foo(1); myblib->foo(2); # foo(); # this would die - no foo() in main:: # bar(); # as would this package myblib; # temporarily switch package foo(3); package main; # switch back @ISA = qw(myblib); $a = bless do { \ my $x }, 'main'; $a->foo(4); # method lookup finds foo() in myblib:: # shoehorn the foo() function into main:: - that's roughly # what Exporter and 'use myblib qw(foo)' do *foo = *myblib::foo; foo(5); # now found in main:: $a->foo(6); __END__ myblib::foo(1) myblib::foo(myblib 2) myblib::foo(3) myblib::foo(main=SCALAR(0x818c688) 4) myblib::foo(5) myblib::foo(main=SCALAR(0x818c688) 6)

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

In reply to Re: Calling subroutine from other module by shmem
in thread Calling subroutine from other module by isha

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.