I didnt know which reply to reply to, so ill just reply to myself haha ;) Anyway, i did change up the module and script a little, to this:
#Package.pm package My::Package; use strict; #can use strict and warnings as usual now as well without +any warnings use warnings; use Exporter qw(import); our @EXPORT = qw(print_lines test test_2); #just add in function names + as you make them our %EXPORT_TAGS = (all => \@EXPORT); sub print_lines{ my ($input) = shift; while(<$input>){ print; } close($input); } sub test{ my ($input) = shift; print $input; } sub test_2{ my ($input) = shift; print $input; }

And here is the script calling it

#script.pl use strict; use warnings; use My::Package qw(:all); open (my $file, '<', shift); print_lines($file); test("hello world\n"); test_2("hello this is dog"); # i love this meme lol

That ":all" is what i was originally shooting for. Though I also figured out you could just require My::Package; and then just call it in the script with use My::Package; and do not have to specify any functions. Anyways, thanks for the help fellers :)

UPDATE: Also I wanted to ask, if I use strict and warnings in the main script, is that in the modules scope as well, or do I need to use strict and warnings in the module as well? Also IF strict and warnings are in the same scope, is it just for the functions/subs or the whole module?


In reply to Re: Is this safe to export and import functions this way? by james28909
in thread Is this safe to export and import functions this way? by james28909

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.