• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

file

I've got 2 scripts, 1 smaller script with a lot of subs in it and 1 really large script.

Now I want to perform this:

From the smaller script I want to run 3 subs and then the large script should be executed (I have no idea how to call that script from within the smaller script), after executing the large script it should continue with another 4 subs from the smaller script.

You can quess my question: How to call the large script from within the smaller script and when the large script has executed the smaller script continues.
0
saskia
Asked:
saskia
  • 2
  • 2
  • 2
1 Solution
 
shayb022800Commented:
Hi,
You can do one of two things:
1.
If you do not need the "big" scripts output within the "small" script you can call it with the "system" command or with back quotes like this:
system "big_script.pl";
or
$return_val = `big_script.pl';

2.
you can transform one of your scripts into a package and then include that package in the other script like this:

small_script.pm #end the file name with .pm
func1()
func2()
1;#important at the end of the package


big_script.pl
use "path/small_script.pm";  #include the above file

func1() # call a function from the package
big_func() # this scripts func
func2() # call a function from the package


Enjoy!
0
 
saskiaAuthor Commented:
Please don't propose an answer, maybe other people have a better solution for me.

- The big script does give output.
- I don't want to call functions from the small script from within the bigger script, because the big script will become 'unreadable' due to it's size.

0
 
shayb022800Commented:
You can do the opposite , call the big script from the small one!
Or you can prepare a third script which calls them both!
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
bebonhamCommented:
shayb has covered all the bases
0
 
saskiaAuthor Commented:
ok, quess i've got to do it with this... thanks
0
 
bebonhamCommented:
just to stick my nose in again, I think making the second script (the one that contains multiple sub-routines) a module would make the most sense:

that way, if any of those subroutines proved to be useful, you could reuses them in later code.


Bob
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now