Thread Methodenaufruf anhand des Methodennamens "objektorientiert"
(8 answers)
Opened by Daniel at 2009-12-09 15:21
Oder:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 use JSON; use DateTime; my $dt = DateTime->now; print object_to_json($dt, qw/day month year hour minute second/), "\n"; sub object_to_json { my ( $object, @methods ) = @_; return to_json({ map { $_ => $object->$_ } @methods }); } Nicht mehr aktiv. Bei Kontakt: ICQ: 404181669 E-Mail: perl@david-raab.de
|