| View previous topic :: View next topic |
| Author |
Message |
honken Voice
Joined: 29 May 2005 Posts: 2 Location: Sweden
|
Posted: Sun Jan 15, 2006 3:46 pm Post subject: Load perl scripts to eggdrop |
|
|
Hi there.
Been trying now to find out if it's posible to load a perl script to eggdrop.
But when i try to rehash the bot it just died.
With error:
| Quote: |
[19:22] Writing user file...
[19:22] Writing channel file...
[19:22] Rehashing ...
[19:22] Listening at telnet port 3434 (bots).
[19:22] Listening at telnet port 4343 (users).
[19:22] Userinfo TCL v1.07 loaded (URL BF GF IRL EMAIL DOB PHONE ICQ).
[19:22] use '.help userinfo' for commands.
[19:22] Tcl error in file 'eggdrop.conf':
[19:22] invalid command name "use"
[19:31] while executing
[19:31] "use threads"
[19:31] (file "/home/bot/mother_mod.pl" line 5)
[19:31] invoked from within
[19:31] "source /home/bot/mother_mod.pl"
[19:31] (file "eggdrop.conf" line 1346)
[19:22] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
|
After this i was like "aww need perl modules" and did this in my terminal as root.
| Quote: |
perl -MCPAN -e "install Bundle::CPAN";
|
And after this i was sure it would work but you know what? id didn't.
So now im after some help to see if i can get this to work.
First part in the mother_mod.pl script that ends it all.
| Quote: |
#!/usr/bin/perl -w
#use strict;
use threads;
use Thread::Queue;
use HTML::TableExtract;
use lib qw( ..);
use LWP::UserAgent;
use HTTP::Cookies;
use Net::Telnet;
|
Anyone with any good ideas? _________________ Configure a new world. Since the default one sucks. |
|
| Back to top |
|
 |
KrzychuG Master

Joined: 16 Aug 2003 Posts: 306 Location: Torun, Poland
|
Posted: Sun Jan 15, 2006 4:15 pm Post subject: |
|
|
Loading a PERL scripts is not possible with Eggdrop 1.6.x. Proper module to support that scripting language exists in 1.9 version. _________________ Que? |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Sun Jan 15, 2006 5:16 pm Post subject: |
|
|
I wonder if it's of any use... did you test it? I know you're perl guy _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Mon Jan 16, 2006 11:10 am Post subject: |
|
|
there is only 1 way I would advise someone to use perl scripts in eggdrop:
make a TCL script, open a pipe to perl and just read the output and throw it in some vars, in a channel or simply eval it if the script returns TCL script.
This may look like something like that then:
| Code: | proc getrostatus:t {min h d m y} {
set sock [open {|perl euro.pl} r]
fileevent $sock readable [list getrostatus:cb $sock]
return 0
}
proc getrostatus:cb {sock} {
global euro
set status [read $sock]
if {[catch {close $sock} err]} {
putlog $err
} else {
array set euro $status
}
return 0
} |
Well, you still need to know some TCL, but you are nolonger bound to restrictions that might apply to TCL. But note that fileevent triggers only about twice a second, so you usually wont get the callback triggered within less than 500ms.
For exeption handling I believe you need to catch the close statement like mentioned above. _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Mon Jan 16, 2006 2:27 pm Post subject: |
|
|
using scripts written in languages other than Tcl (shell, Perl, whatever) by simply piping input/output seems kind of pointless to me (unless you need to do exactly that, i.e. you want to use already made script which is not related to eggdrop, and you are interested in input/only only, not in control) _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
|