Leser: 17
1 2 3 4 5 6 7 8 9 10 11 12
sub on_public { my ( $self, $event ) = @_; my ( $nick, $mynick ) = ( $event->nick, $self->nick ); my ($channel) = ( $event->to )[0]; my ($line) = ( $event->args ); my ($arg) = ( $event->args ); $arg =~ /^(\S+)\s*(.*)$/; ( $arg, my $extarg ) = ( $1, $2 ); if ( $line =~ /^!schreibwas/ ){ output('blablub'); } }
1 2 3 4 5
sub output { my $line = shift; my ($channel) = ( $event->to )[0]; $self->privmsg( $channel, "$line" ); }
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
sub on_public { my ( $self, $event ) = @_; my ( $nick, $mynick ) = ( $event->nick, $self->nick ); my ($channel) = ( $event->to )[0]; my ($line) = ( $event->args ); my ($arg) = ( $event->args ); $arg =~ /^(\S+)\s*(.*)$/; ( $arg, my $extarg ) = ( $1, $2 ); if ( $line =~ /^!schreibwas/ ){ output($self,$event,"blablub"); } } sub output { my $self = shift; my $event = shift; my $line = shift; my $nick = ( $event->nick ); my $channel = ( $event->to )[0]; if($msgswitch eq 'public'){ $self->privmsg( $channel, "$line" ); } elsif($msgswitch eq 'query'){ $self->privmsg( $nick, "$line" ); } }
1 2 3 4 5 6
sub on_public { ... if ( $line =~ /^!schreibwas/ ){ output('blablub', $channel); # Wobei ich hier $channel und $line vertauschen wuerde. } }
1 2 3 4
sub output { my ($line, $channel) = @_; $self->privmsg( $channel, "$line" ); }