Try passing your array as a ref to your sub:
my @info;
my $button_submit = $lf->Button(
-text => 'Search',
-command => [\&get_data, \@info],
)->pack(qw//);
...this should pass the
\@info ref into your
get_data sub. You can also add your Tk widget as another parameter and call configure on that ref.
my @info;
my $button_submit = $lf->Button(
-text => 'Search',
-command => [\&get_data, \@info, $TkWidget],
)->pack(qw//);
...
sub get_data {
my ($info_ref, $tkwidget_ref) = @_;
# add/delete/modify elements of $info_ref
# call configure on the widget
$tkwidget_ref->configure(...);
}
This is the method I use when I want to modify a data structure using a callback.
--
hiseldl
What time is it? It's Camel Time!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.