CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
require problems

 



Gregorio
User

Dec 24, 2000, 2:04 PM

Post #1 of 3 (748 views)
require problems Can't Post

when i use the require function, it prints out everything from the .pl, is there a way so that it only prints what i want. Specifically just the one subroutine?



sleuth
Enthusiast

Dec 24, 2000, 4:55 PM

Post #2 of 3 (746 views)
Re: require problems [In reply to] Can't Post

 
I've never tried it, but I remember there being a difference similar to that problem when you try use instead of require, try use "script.pl" just to see if it will not print the scripts output and then go ⊂ after you use the file. I'm not 100% sure by no means but it's worth a quick try.

Sleuth



Jasmine
Administrator / Moderator

Dec 31, 2000, 9:30 AM

Post #3 of 3 (736 views)
Re: require problems [In reply to] Can't Post

Without seeing the required file, it's hard to figure this out. But you may have a subroutine call inside the required file, which is telling the required file to do some work.

For example:

<xmp>
# calling file
require "file.pl";

#called file

#!/usr/bin/perl

dosomething();

sub dosomething {
}
</xmp>



If there's a subroutine call outside of a subroutine, it will run. To avoid this, don't use any subroutine calls outside of a subroutine block.

If this doesn't help, please post the required file and we'll try to help.


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives