Thread Überschreiben einer Funktion (13 answers)
Opened by Kuerbis at 2015-09-10 13:56

Kuerbis
 2015-09-10 18:31
#182148 #182148
User since
2011-03-20
947 Artikel
BenutzerIn
[default_avatar]
Wenn ich es so mache, dann hat das z.B. keine Auswirkung a __choose, angenommen __choose verwendet die Funktion _print_columns.

Code (perl): (dl )
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
package Term::Choose_HAE;

use warnings;
use strict;
use 5.010001;

our $VERSION = '0.005';
use Exporter 'import';
our @EXPORT_OK = qw( choose );

use Unicode::GCString;

use parent 'Term::Choose';


sub _print_columns {
    ( my $str = $_[0] ) =~ s/\e\[[\d;]*m//msg;
    Unicode::GCString->new( $str )->columns();
};


sub choose {
    if ( ref $_[0] ne 'Term::Choose_HAE' ) {
        return Term::Choose_HAE->new()->Term::Choose::__choose( @_ );
    }
    my $self = shift;
    return $self->Term::Choose::__choose( @_ );
}

1;
__END__

View full thread Überschreiben einer Funktion