Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

How to call a perl script through .exe

by jack123 (Acolyte)
on May 07, 2012 at 11:15 UTC ( #969243=perlquestion: print w/replies, xml ) Need Help??
jack123 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Eveyone, First of all I created one GUI with buttons,labels, texts using perl Tk, now after that i created that .pl script to .exe fil. Now I want another .pl script to be called by clicking on a button in that GUI. Right now it works fine by including this code in the parent perl script(.exe one) : sub update_script {system($^X, 'test2.pl', $ent -> get(), $ent_pass -> get(),$arg_32, @values, @names);} This function update_script is being called on one of the button in test1.pl or test1.exe Now the button on the test1.exe works fine on click and shows test2.pl output but in case if I put this .exe somewhere else then it says perl file unrecognized. Can someone tell me how to solve theses kind of errors? Regards, Jack

Replies are listed 'Best First'.
Re: How to call a perl script through .exe
by Anonymous Monk on May 08, 2012 at 00:20 UTC

    Hi,

    I would extract the relevant code from test2.pl into a sub either in the test1.pl file or into test2.pm and just call it as a sub, not forgetting to use or require test2.pm if that is the way you go.

    J.C.

      my test1.exe was also passing parameters to test2.pl, if I'll make test2.pl as test2.pm then how these parameters will be passed. Also if I am writing use test2,pm in test1,pl then test2,pm GUI window appears first which is wrong. What I want is test1,exe should have a button by clicking on which we can pass parameters to test2,pm and then the test2,pm runs a GUI which should be able to have other buttons too inside it.

        Hi,

        Think of it like this, test1 and test2 stuff are controlled from the same main window. Test1 is on the first tab of a two tabbed screen, test2 is on the second. While you are working on page 1 you hide page 2, when you click the button to move to page 2 you hide page 1 and show page 2.

        You pass parameters in exactly the same way as you pass them to a sub-routine, because test2 is exactly that.

        It's the same as if you wanted to add a bit of functionality to any existing program. just add another sub-routine and call it, rather than writing a completely different program and calling it through systme or backticks.

        Well, it works for me, but as always - TMTOWTDI.

        J.C.

        Use subroutines, not separate PM files, perlsub. Or are you trying to say your having a GUI block problem and you want to use threads or separate processes?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://969243]
Approved by Corion
help
Chatterbox?
[Discipulus]: Corion are you would able to realize such thing? O_O
[Corion]: In the same vein I have a script that automates Firefox to enter some data into another system. It's not faster than the people using the script if they were to do it manually, but they prefer not having to check the data and not having typos when ...
[Corion]: ... entering the data
[Corion]: Discipulus: I don't know whether I could really do that, but the init process itself mostly launches other processes, and the whole startup is just following a path of dependencies and making sure they are all running. Which basically is what ...
[Discipulus]: when at work my time is (temporarly) owned by the firm, so i do not care (coworkers whatch movies.. I code Perl)
[Corion]: ... make already does, except for files instead of programs. But maybe with some /proc hackery, that could be eliminated and one could use plain make :-D
[choroba]: systemd just makes is asynchronous
[choroba]: so, make -j
[Corion]: Discipulus: Yeah - but when writing Perl to save time (instead of having fun), it helps to look whether you're actually saving time ;) Why spend 5 minutes doing manually what you can spend three years automating? ;)
[Corion]: choroba: Oh, yeah :-D

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2017-07-27 09:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (408 votes). Check out past polls.