Hi monks, I am trying to create a perl library and link it to my code.Here is the method I followed.
####Code of Library#### package Foo1; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $debug %EXPORT_TAGS); require Exporter; @ISA = qw(Exporter); @EXPORT = qw('bar'); sub bar { print "Hello \n"; } 1; ################################ ################################ ######parent Code ****########## #######test.pl################# use Foo1; Foo1->bar(); ##################################
Steps followed: 1.going to the directory(Documents>>New Folder)which is where my script of Foo1.pm is there. 2. Type h2xs -XA -n Foo1 3. A folder called Foo1 is created. Enter the folder. 4. the directory now is Documents>> New Folder>>Foo1. 5. type perl makefile.pl 6. Type dmake 7. Type dmake install 8. Copy the whole Foo1 folder and Foo1.pm at C:/ Strawberry/Perl/ Lib and C:/ Strawberry/Perl/ Site/Lib. 9. compile the parent code by getting out of foo1 and into documents>> new folder and typing perl test.pl. (Because my test.pl is saved at this directory). but i get following error.: Can't locate object method "bar" via package "Foo1" at test.pl Please help ....where is the prob?????

In reply to making a library by adieu

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.