in reply to Re^2: Verbose Tk Code
in thread Verbose Tk Code

I've lately been doing things like this

$mw->Button(-text => $_->[0], -command => $_->[1], -font => 24, )->pack( -side => 'left', -fill => 'x', -expand => 1) for [Restart => \&restart], ['Previous State' => \&previous], ['Random Move' => \&random], [Help => \&help], [Exit => sub {$mw->destroy}];

which is a section from my chess player on RosettaCode https://rosettacode.org/wiki/Chess_player#Perl and I probably would do the same kind of thing for those five Labels.

One might consider for to be a perl approximation of with :)

Replies are listed 'Best First'.
Re^4: Verbose Tk Code
by LanX (Saint) on Feb 28, 2021 at 20:52 UTC
    Thanks

    > One might consider for to be a perl approximation of with :)

    yep, I was also thinking of offering a $_ default

    with { meth1(); meth2(); ... } for @objects;

    Tho your example didn't alias the objects but the attributes.

    But Tk might not be the best use case here, Choroba privately suggested to look at XML::LibXML .

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery