egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Load perl scripts to eggdrop

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Eggdrop Help
View previous topic :: View next topic  
Author Message
honken
Voice


Joined: 29 May 2005
Posts: 2
Location: Sweden

PostPosted: Sun Jan 15, 2006 3:46 pm    Post subject: Load perl scripts to eggdrop Reply with quote

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
View user's profile Send private message Visit poster's website
KrzychuG
Master


Joined: 16 Aug 2003
Posts: 306
Location: Torun, Poland

PostPosted: Sun Jan 15, 2006 4:15 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Jan 15, 2006 5:16 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Mon Jan 16, 2006 11:10 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Mon Jan 16, 2006 2:27 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Eggdrop Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber