Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^5: Perl tk - How to integrate external scripts

by chessgui (Scribe)
on Jan 30, 2012 at 10:40 UTC ( #950746=note: print w/replies, xml ) Need Help??

in reply to Re^4: Perl tk - How to integrate external scripts
in thread Perl tk - How to integrate external scripts

By leave it alone I mean that you leave the statistical routine unchanged (as it worked before) in a separate file called '' (or whatever name it has now). Execute this script as an external system process by the system command I mentioned then operate on the file to which its output was is redirected. The script you supplied does the opposite: the statistical routine is copy pasted and I see no 'system' command at all. Now your routine tries to get the file name from the argument list of the main program (which is probably empty). If you choose to do it this way the -command bind should look something like this:
$mw-> Button (-text =>'Get Statistics', -command =>[ \&get_statistics, '' ] )->p +lace(-x=>320, -y=>35);
In this way your get_statistics routine will be called with the argument ''. You should store your data to be analyzed in this file.

Replies are listed 'Best First'.
Re^6: Perl tk - How to integrate external scripts
by Giorgio C (Novice) on Jan 30, 2012 at 12:03 UTC
    Thanks but in this way i need to know before what is "". I wanted instead that this would be the $open variable called with the get_open( that show all my directories). chosed a file with get open in my dir and on that working the get statistic command: get_open => $open => get_statistics on $open Is there a really way ?
      Make $open a global variable and use it instead of '':
      -command => [ \&get_statistics , $open ]
      Variables are global by default - if you don't understand this just take care never to declare it with 'my' ( don't write "my $open='foo';" just "$open='foo';" ). Set the value for $open with your file selection widget and the bind will call the get_statistics routine with the appropriate value ('value of the $open global variable at the time of the button click') as an argument for you.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://950746]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2018-01-23 03:18 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (238 votes). Check out past polls.