#perl - Sun 1 Apr 2007 between 16:35 and 16:49



integralWhy don't you try using the actual reference.
Spaceknarfhm wait
let me see if I can get some simplified example code
rhalffI can call an external function with $func(); or not ?
s/external//g
Ani-_rhalff: no. func();
rhalffdynamic..
Ani-_rhalff: the word 'dynamic' makes no sense in this context.
rhalffthe callback kind
integralYou have a subroutine reference in $func?
Then you can use &{...}() and ...->(), the later being more favoured
rhalfflike call $variable_function();
integral: yeah the name of a subroutine
integralperlbot, varvarname
perlbotWhy it's stupid to `use a variable as a variable name' - http://perl.plover.com/varvarname.html
integralDon't do that dear, you'll hurt yourself.
Ani-_Perhaps you should explain what you really want to do...
integralIt's only a butter knife; stabbing myself with it won't hurt a bit!
rmahintegral: I could kill you with a butter knife. it would hurt a lot too.
rhalffAni-_: create an installer subroutine that excecutes the installer function based on the name of the installer, like call install_drupal() install_joomla() etc.
Ani-_rhalff: then use a hash table and use proper subroutine references.
rhalffwhere drupal and joomla are in a variable like $type.
Ani-_: what are proper subroutine references
Ani-_rhalff: as in: my %installers = (drupal => \&install_drupal, ...); if (exists $installers{$installer}) { $installers{installer}->(); }
integralsee perlref, perlreftut, perldsc, perllol, perldata, etc
rhalffhmz
if(exists $installer) { $installer=>(); } won't work ? if $installer = 'install_drupal' ?
Ani-_That is a bad idea.
Do NOT do that.
MonieI need help with parsing data from http://site.wii-battle.com/forums/viewonline.php I want my bot to get that then send to the channel whos online
alamarwhen creating a socket using IO::Socket::INET and then adding the handle to and IO::Select object - what happens if the socket is being closed from the remote side? (is the handle automatically removed or is there some other way I can detect the closing?)
rhalffhm ok
Ani-_alamar: it is not automatically removed. You ahve to remove it yourself.
alamar: if you don't remove it then ->select(), ->can_raed(), ... will return instantly.
alamarAni-_: hm what's the best way to detect the close from the remote side?
SpaceknarfI hate this
my simplified version works as expected...
actionCPAN upload: sys-MON-Lite-0.02 by JNBROOKES
CPANupload: sys-MON-Lite-0.02 by JNBROOKES
actionCPAN upload: BBS-Perm-v0.0.2 by SUNNAVY
CPANupload: BBS-Perm-v0.0.2 by SUNNAVY
Ani-_alamar: What I do: I check if $socket->connected is false. If it is I remove it. In addition to that: if read/sysread returns 0 then I do a shutdown $some_socket, 0; # to tell the other side that I stopped readinig.

Page: 2 9 16 23 30 37 44 51 58 65 72 79 

IrcArchive