title: 'Using Perl Scripts with Mac (or Linux)' #
Using Perl Scripts with Mac (or Linux) #
Author: RedOrion
Please note that installing perl and running scripts in the beginning can be a frustrating process. Many times the simplest of typos or errors can make the entire thing not work. Literally 1 character being off or a space being in the wrong place. If for any reason during the install process you run into problems, remember.. There are other people to help you. If at anytime it just gets too frustrating, please feel free to contact me or anyone else within the expanse for help. If you are unfamiliar with DOS, Perl, Scripting, Programming and just cannot learn to start scripting, please check with someone in your alliance as they may be able to run scripts for you.
sudo perl -MCPAN -e shell
or in user account version (OS X only)
perl -MCPAN -e shell
install CPAN reload cpan
install AnyEvent AppConfig Browser::Open Bundle::CPAN Bundle::LWP Class::MOP Class::MOP::Class Class::XSAccessor Class:C3:Componentised Class:DBI Clone Crypt::SSLeay Data::Dumper Date::Format Date::Parse DateTime DateTime::Format::Duration DateTime::Format::ICal DateTime::Format::Strptime DateTime::Locale DateTime::TimeZone DBD::mysql DBD:SQLite::db DBI DBIx::Class DBIx::Class::DynamicSubclass DBIx::Class::InflateColumn::Serializer DBIx::Class::Row DBIx::Class::Schema DBIx::Class::TimeStamp Digest::Perl::MD5 Email::MIME Email::Send Email::Send::Test Email::Simple Email::Stuff Email::Valid Exception::Class Exporter
install File::Find::Rule::Perl File::Path File::Remove File::Temp File::Type FindBin Games::Lacuna::Client GD GD::SecurityImage Getopt::Long Graph::Directed HTML::Parser HTTP::Date HTTP::Request HTTP::Response HTTP::Tiny Image::Size Imager IO::Interactive IO::Interactive IO::String IPC::Run3 JSON JSON::RPC JSON::RPC::Common JSON::RPC::Common::Marshal::Text JSON::RPC::Common::Procedure::Call JSON::RPC::LWP JSON::XS lib List::MoreUtils List::Util List::Util::WeightedChoice LWP::UserAgent Mac::Carbon Math::BigFloat Math::BigInt::FastCalc Math::BigRat Math::Round MIME::Lite Moose Moose::Exporter MooseX::Aliases
install MooseX::LazyRequire MooseX::SetOnce Mozilla::CA namespace::autoclean namespace::clean Net::FTP Number::Format ORLite Params::Validate Perl::MinimumVersion Pod::POM POSIX prefork RPC::PlClient Scalar::Util Spreadsheet::ParseExcel Template Template::Stash Template::Stash::XS Test::Exception Test::MinimumVersion Test::NoWarnings Test::Object Test::Pod::Coverage Test::SubCalls Test::TrailingSpace Test::Warn Text::CSV Text::CSV_XS Text::RecordParser Time::HiRes Time::Warp Try::Tiny URI URI::file XML::LibXML XML::NamespaceSupport XML::SAX XML::SAX::Base YAML YAML::Any YAML::Tiny YAML::XS
I combined the long list into 1 big install list. This will make it easier. Note that in some cases the installation of a module may fail. This can usually be rectified by running the installation command more than once.
Get yourself an API key Note, this step is optional. You need to do this if you want to look up statistics about your essentia consumption and RPC use, among some other things. If you don't need this simply using "anonymous" as your API key will allow your scripts to run.
The website for requesting an API key can be found here
Keep track of these API keys. The public key is what you will use for scripts/applications that log into your account. The private key will be for tracking your usage and things of that nature.
Acquire the GLC libraries
Download the zip from the link here.
Extract the zip archive to a folder of your choice
users/username/Applications/LE (is a good choice)
Using Finder, browse to users/username/Applications/LE
Rename the folder you extrated into here to "GLC"
You should now have a users/username/Applications/LE/GLC folder
Browse to LE\GLC\examples
Copy myaccount.yml into LE\GLC
Rename LE\GLC\myaccount.yml to lacuna.yml
Modify the configuration file
Your config file should looke like this:
---
server_url: 'https://us1.lacunaexpanse.com'
api_key: API Key Provided by link above
empire_name: Your Empire Name
empire_password: Your Empire Password
session_persistent: 1
The api_key to be used is the public key you got from step 3
empire_name is the exact same thing as the name you use to log in
empire_password most of the time will be your sitter password, however sometimes it will need to be your normal password.
session_persistent means that if you run a script and it logs you in, it will use that logged in session if possible before doing another log in to prevent awaste of RPCs from logging in constantly.
Copy the configuration file into the bin and data folders. This simplifies running scripts without being required to keep the --config paths up to date.
Download the Star Map CSV file. Note that this step isn't necessariy for many scripts. I think tha majority of people skip this. You can go ahead and do it, or you can skip it. If you regret skipping it you can always do it later.
Download the stars.csv file for your server
This file is a comma separated value file that contains the X|Y coordinates of every star in the "Lacunaverse"
Currently, there is only one server in addition to the public test server.
You can download the US1 CSV file from here
http://us1.lacunaexpanse.com.s3.amazonaws.com/stars.csv
You can download the PT CSV file from here
http://pt.lacunaexpanse.com.s3.amazonaws.com/stars.csv
Copy the stars.csv file to LE\GLC\
Set up the Stars database
Open a command prompt and navigate to LE\GLC\examples
Type the following pressing enter after every line:
star_db_util.pl --config ../lacuna.yml --db ../stars.db --no-fetch --create-db
populate_db.pl --db ../stars.db --csv ../stars.csv
this script should be located in LE\GLC\Examples if you got your GLC libraries and stuff from the link above.
Watch the fun . . .
Start running scripts
At this point, everything should be up and running and you should be able to try running a script or two. Assuming you have everything set up right, you should be able to fire up any script you like.
Open a command prompt and navigate to LE\GLC\examples
Community notes #
Zephyr: If Strawberry Perl installation was set up like this one I might be able to install and do scripting. Very clear steps here in comparison.