Thread Projekt Term::ReadLine::Tiny (23 answers)
Opened by Kuerbis at 2014-07-13 16:40

Kuerbis
 2014-08-19 09:24
#176911 #176911
User since
2011-03-20
942 Artikel
BenutzerIn
[default_avatar]
Hallo!

Das folgende scheint mir nicht ganz korrekt zu sein (Code):

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
sub new {
    my $class = shift;
    my ( $name ) = @_;
    my $self = bless {
        name       => $name,
        handle_in  => \*STDIN,
        handle_out => \*STDOUT,
    }, $class;
    ...
}

sub __print_readline {
    my ( $self, ... ) = @_;
    ...
    print $string;
    ...
}


Sollte ich das eher so umändern:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
sub new {
    my $class = shift;
    my ( $name ) = @_;
    my $self = bless {
        name       => $name,
        handle_in  => \*STDIN,
        handle_out => \*STDOUT,
    }, $class;
    ...
}

sub __print_readline {
    my ( $self, ... ) = @_;
    ...
    print { $self->{handle_out} } $string;
    ...
}


oder so?

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
sub new {
    my $class = shift;
    my ( $name ) = @_;
    my $self = bless {
        name       => $name,
        handle_in  => \*STDIN,
        handle_out => select,
    }, $class;
    ...
}

sub __print_readline {
    my ( $self, ... ) = @_;
    ...
    print $string;
    ...
}

View full thread Projekt Term::ReadLine::Tiny