http://www.perlmonks.org?node_id=417423


in reply to Re: multiple method calls against the same object, revisited
in thread multiple method calls against the same object, revisited

Pascal! :)

Maybe an "on a" modifier?

.signal_connect( :clicked{ Gtk2.main_quit } ) on Gtk2::Button.new( "Quit" );

Indirect object syntax would make that sounds even more like English. But this is probably stretching it too far anyway.

Replies are listed 'Best First'.
Re^3: multiple method calls against the same object, revisited
by Aristotle (Chancellor) on Dec 28, 2004 at 09:57 UTC

    But how would you do multiple calls against the same thing?

    { .signal_connect( :delete{ Gtk2.main_quit } ); .set_title( "Test" ); .border_width( 15 ); .add( .signal_connect( :clicked{ Gtk2.main_quit } ) on Gtk2::Butto +n.new( "Quit" ) ); .show_all; } on Gtk2::Window.new( "toplevel" );

    There is a simple analogon in Perl5:

    my $window = map { $_->signal_connect( delete_event => sub { Gtk2->main_quit } ); $_->set_title( "Test" ); $_->set_border_width( 15 ); $_->add( map { $_->signal_connect( clicked => sub { Gtk2->main_quit } ); $_; } Gtk2::Button->new( "Quit" ) ); $_->show_all(); $_; } Gtk2::Window->new( "toplevel" );

    Meh. It puts things in the wrong order IMO.

    Makeshifts last the longest.