<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hi folks,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>Here I am again. This time I want to my main program (PERRMOSS) to execute a block of code in a separate folder (the reason is to give users a choice in doing a particular calculation).</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>What I did was straight out of 'Programming Perl', and it kind-of-works, though probably not as intended.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The block of code is in a file in a sub-folder as follows</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><FONT class="Apple-style-span" face="Courier New">input/Simple_Billycan_2_Stage.pm</FONT></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">                </SPAN></DIV><DIV>And it is called in PERRMOSS at line 369 as follows;</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><FONT class="Apple-style-span" face="Courier New">use input::Simple_Billycan_2_Stage;</FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The reason that it is not at the top, after <FONT class="Apple-style-span" face="Courier New">#!/usr/local/bin/perl </FONT>, is that PERRMOSS will not know which module to call until line 369. </DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Simple_Billycan_2_Stage.pm includes the following (this is not the final product, by the way);</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-style-span"><FONT class="Apple-style-span" face="Courier New">package Simple_Billycan_2_Stage;</FONT></SPAN></DIV><DIV><FONT class="Apple-style-span" face="Courier New">require</FONT><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN><FONT class="Apple-style-span" face="Courier New">Exporter;</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">our @ISA = qw(Exporter);</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">our @Export = qw(camel);</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">our @Export_OK = qw(weight);</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">our $version = 1.00;</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"><BR class="khtml-block-placeholder"></FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">sub camel {print "One-hump dromedary\n"}</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"><BR class="khtml-block-placeholder"></FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">$weight = 1024;</FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New"><BR class="khtml-block-placeholder"></FONT></DIV><DIV><FONT class="Apple-style-span" face="Courier New">1;</FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I understand that 'Exporter' should make 'camel' visible to PERRMOSS.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>When I include the line...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><FONT class="Apple-style-span" face="Courier New">Simple_Billycan_2_Stage::camel ();</FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-style-span">It works as intended by printing <FONT class="Apple-style-span" face="Courier New">One-hump dromedary</FONT> to screen.</SPAN></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>However, when I include the line...</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>camel();</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I get the error message</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><FONT class="Apple-style-span" face="Courier New">Undefined subroutine &amp;main::camel called at perrmoss.pl line 370, &lt;RF&gt; line 21.</FONT></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-style-span">Should I just be able to call 'camel' by <FONT class="Apple-style-span" face="Courier New">camel();</FONT> ? Maybe I need to include the full 'path', though that seems rather messy.</SPAN></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>What I am looking for is a way to reference a block of code that is outside the main program. I understand that modules are the way to go, but if there is a simpler way to do it, I would be glad to know about it.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Again, thanks for your help in advance.</DIV><DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Lucida Grande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Lucida Grande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Lucida Grande; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>Regards,</DIV><DIV>Martin</DIV><DIV>Visit my website...</DIV><DIV><A href="http://web.mac.com/martin_jacobs1"><SPAN class="Apple-style-span" style="color: rgb(0, 0, 238); -khtml-text-decorations-in-effect: underline; ">http://web.mac.com/martin_jacobs1 </SPAN></A></DIV><BR class="Apple-interchange-newline"></SPAN></SPAN></SPAN> </DIV><BR></DIV></BODY></HTML>