Deliantra-Client

 view release on metacpan or  search on metacpan

bin/deliantra  view on Meta::CPAN

#!/opt/bin/perl

if ($ENV{DELIANTRA_CORO_DEBUG}) {
   eval '
      use Coro;
      use Coro::EV;
      use Coro::Debug;
      our $debug = new_unix_server Coro::Debug "/tmp/dc";
   ';
}

# do splash-screen thingy on win32
my $startup_done = sub { };
BEGIN {
   if (%PAR::LibCache && $^O eq "MSWin32") {
      while (my ($filename, $zip) = each %PAR::LibCache) {
         $zip->extractMember ("SPLASH.bmp", "$ENV{PAR_TEMP}/SPLASH.bmp");
      }

      require Win32::GUI::SplashScreen;

      Win32::GUI::SplashScreen::Show (
         -file => "$ENV{PAR_TEMP}/SPLASH.bmp",
      );

      # initialise the resolver now, as vista forces us back to the desktop
      # when doing this later.
      require AnyEvent::DNS;
      AnyEvent::DNS::resolver ();

      $startup_done = sub {
         Win32::GUI::SplashScreen::Done (1);
      };
   }
}

use common::sense;

use Carp 'verbose';

# do things only needed for single-binary version (par)
BEGIN {
   if (%PAR::LibCache) {
      @INC = grep ref, @INC; # weed out all paths except pars loader refs

      my $root = $ENV{PAR_TEMP};

      while (my ($filename, $zip) = each %PAR::LibCache) {
         for ($zip->memberNames) {
            next unless /^root\/(.*)/;
            $zip->extractMember ($_, "$root/$1")
               unless -e "$root/$1";
         }
      }

      if ($^O eq "MSWin32") {
         # pango is relocatable on win32
      } else {
         # OS X
         $ENV{PANGO_RC_FILE} = "$root/pango.rc";
         $ENV{DYLD_LIBRARY_PATH} = $root;
         chdir $root; # for pango modules, maybe other things
      }

      unshift @INC, $root;
   }
}

# prepend private library directory and prepare env
BEGIN {
   for (grep !ref, @INC) {
      my $path = "$_/Deliantra/Client/private";
      if (-d $path) {
         unshift @INC, $path;
         last;
      }
   }
}

# need to do it again because that pile of garbage called PAR nukes it before main
unshift @INC, $ENV{PAR_TEMP}
   if %PAR::LibCache;

use EV;
BEGIN { *time = \&EV::time }



( run in 0.886 second using v1.01-cache-2.11-cpan-99c4e6809bf )