Perl Modules vs plugins
A Perl module is sort of like a plugin, but is usable from anywhere you use Perl.
I suggest that you check out PPM for ActiveState's Perl distribution or CPAN for others (Strawberry, etc) if you have no idea what is happening here. Understanding of OOP and namespace basics would be helpful as well. This would go in <PERL_DIR>/site/lib/EQEmu/Database.pm Part of this was shamelessly ganked from the existing plugin::LoadMysql(). You will need to have SQL::Statement installed for it to function. You should already have everything else if you have a current install. Code:
package EQEmu::Database; I ran it outside the emulator for testing. Note that I only called subroutines that did not begin with a _. This is intentional as the idea behind a module (or plugin) is to simplify things for "high level" coding. Code:
use EQEmu::Database; |
... and once you have access to data, you can build objects to consume it. You can make complex things simple and have code you can reuse anywhere. You can use it in a script that fires from an EVENT subroutine. You can use the same framework for a web interface for your website. Whatever is clever.
I guess this is as much a concept as a tutorial. It's the sort of thing that would make life easier for folks to understand what they can do with Perl in addition to other methods. They write books about this shit for a reason! <PerlDir>\site\lib\EQEmu\Mob.pm Code:
package EQEmu::Mob; |
I knew more about all this crap when I wrote it.
This is an indication of how long ago that was... Code:
package EQEmu::PlayerProfile_Struct; |
All times are GMT -4. The time now is 05:25 PM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.