1 2 3 4
sub mach_was { my $self = shift; return $self->{austauschbares_objekt}->mach_was(); }
my $foo = MyModule::create_platform_object();
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
package Term::MiniExample; use strict; use warnings; BEGIN { if ( $^O eq 'MSWin32' ) { require Term::Size::Win32; Term::Size::Win32::->import( 'chars' ); *term_size = sub{ my $self = shift; my ( $width, $height ) = chars( $self->{out} ); return $width - 1, $height; } } else { require Term::ReadKey; Term::ReadKey::->import( 'GetTerminalSize' ); *term_size = sub { my $self = shift; return GetTerminalSize( $self->{out} ); } } } sub new { my $class = shift; my $self = { out => \*STDOUT }; bless $self, $class; return $self; } sub say_term_size { my $self = shift; my @termsize = $self->term_size(); print "@termsize\n"; } 1; __END__