/usr/lib/x86_64-linux-gnu/perl5/5.22/Wx/Loader.pod is in libwx-perl 1:0.9923-4build3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | =head1 NAME
Wx::Loader - using custom dll loaders with Wx
=head1 SYNOPSIS
#---------------------------------------
# For Packagers
#---------------------------------------
# the order of these use()s is important
use MyCustomWxLoader;
use Wx;
or .....
use threads;
use threads::shared;
use MyCustomLoader;
use Wx;
or - Wx::Perl::Splashfast special case
use MyCustomWxLoader;
use Wx::Perl::SplashFast ("./logo.jpg",5000);
use Wx;
............. meanwhile in MyCustomWxLoader.pm
package MyCustomWxLoader;
require Wx::Mini;
our @ISA = qw( Wx::Loader::Standard );
$Wx::wx_binary_loader = __PACKAGE__;
...... or
$Wx::wx_binary_loader = __PACKAGE__->new;
#-----------------------------------------
# For binary distributions
#-----------------------------------------
# Provide a custom Wx::Loader::Custom
# to be loaded by Wx::Mini
package Wx::Loader::Custom
our @ISA = qw( Wx::Loader::Standard );
# be polite if another loader is already in place
$Wx::wx_binary_loader = __PACKAGE__ if !$Wx::wx_binary_loader;
...... or
$Wx::wx_binary_loader = __PACKAGE__->new() if !$Wx::wx_binary_loader;
=head1 DESCRIPTION
If you are providing binary distributions of Wx or packaging Wx
applications to run on machines without Perl (PAR, PerlApp),you
may need to override dll loading methods. Providing a custom
wx_binary_loader package allows you to do this.
=head1 Binary Distributions
A binary distribution my provide alternative sources and loading
methods for the wxWidgets dlls. It achieves this by providing a
Wx::Loader::Custom module in the distribution
package Wx::Loader::Custom
our @ISA = qw( Wx::Loader::Standard );
# be polite if another loader is already in place
$Wx::wx_binary_loader = __PACKAGE__ if !$Wx::wx_binary_loader;
...... or
$Wx::wx_binary_loader = __PACKAGE__->new() if !$Wx::wx_binary_loader;
# remember that Wx.pm has not necessarily been loaded so only
# Wx::Mini is available
=head1 Perl Application Packagers
Applications that package perl scripts to run on machines without
Perl (PAR, PerlApp etc) can override dll loading methods if necessary
by loading a custom package before wx
package MyCustomWxLoader;
require Wx::Mini;
our @ISA = qw( Wx::Loader::Standard );
$Wx::wx_binary_loader = __PACKAGE__;
...... or
$Wx::wx_binary_loader = __PACKAGE__->new;
# remember that Wx.pm has not necessarily been loaded so only
# Wx::Mini is available
=head1 METHODS
The following methods may be provided by custom loaders to override the
default behaviour
=head2 loader_info
should return an information string about the loader and MUST be provided.
The default loader has
sub loader_info { 'Standard Distribution'; }
so any custom loader should return something different
e.g.
sub loader_info { "Mark's Broken Distribution - it's all my fault"; }
=head2 set_binary_path
allows setting a custom path for the wxWidgets libraries.
sub set_binary_path {
my $class_or_object = shift;
... work out binary path
return $newbinarypath; # method MUST return a path
}
=head2 load_dll
Is called to load wxWidgets plugin dlls using a key for the $Wx::dlls hash
( see Wx::Mini )
sub load_dll {
my ($class_or_object, $dllkey) = @_;
..... load dll - or maybe not
}
the default loader does nothing - dependencies are loaded automatically
and determined by the standard methods of the os:
an example of pre loading a known dependency
sub load_dll {
return if $^O !~ /^(mswin|linux)/i;
local $ENV{PATH} = $Wx::wx_path . ';' . $ENV{PATH} if $Wx::wx_path;
return unless exists $Wx::dlls->{$_[1]} && $Wx::dlls->{$_[1]};
my $dll = $Wx::dlls->{$_[1]};
$dll = $Wx::wx_path . '/' . $dll if $Wx::wx_path;
Wx::_load_plugin( $dll );
}
=head2 unload_dll
Is called ONCE from within an END block
A custom loader may choose, for example to unload any dlls it has loaded
sub unload_dll {
my $class_or_object = shift;
... carry out END actions
}
The default unload_dll is a noop ( sub unload_dll {} )
=head2 external_set_load
A deprecated method of replacing the load function for plugins
A custom loader may override this to prevent a legacy loader replacing
the loading methods.
=head2 external_set_unload
A deprecated method of replacing the unload function for plugins
A custom loader may override this to prevent a legacy loader replacing
the unloading methods.
=head2 boot_overload
For binary distributions and packaged applications, normal shared
library loading semantics may not work. A custom loader may provide
this method to use in place of, or to supplement the standard XS load
of Wx.dll (Wx.so).
The method MUST return true or false, depending on whether it has
loaded Wx.dll (Wx.so).
For example, to load the core wxWidgets dlls before Wx is loaded
sub boot_overload {
shift;
require DynaLoader;
for my $dll ( qw( base core adv ) ) {
next unless exists $Wx::dlls->{$dll} && $Wx::dlls->{$dll};
my $file = ( $Wx::wx_path ) ? $Wx::wx_path . '/' . $Wx::dlls->{$dll} : $Wx::dlls->{$dll};
my $libref = DynaLoader::dl_load_file($file, 0);
push(@DynaLoader::dl_librefs,$libref) if $libref;
# Dynaloader should take care of unloading
}
#------------ IMPORTANT ----------
return 0; # we have not loaded Wx
#---------------------------------
}
Some packagers extract dlls at runtime, and then may attempt to remove them
at application close. This may fail for Wx. For example, on MSWin the directory
cleanup fails whilst on Linux the application will seg-fault on exit.
Packagers may avoid this by loading Wx.dll( Wx.so) from a non standard location
( perhaps a separate binary distribution of wx dlls ) that is not removed at
application exit.
For example
sub boot_overload {
my $class = shift
require DynaLoader;
for my $dll ( qw( base core adv ) ) {
next unless exists $Wx::dlls->{$dll} && $Wx::dlls->{$dll};
my $file = ( $Wx::wx_path ) ? $Wx::wx_path . '/' . $Wx::dlls->{$dll} : $Wx::dlls->{$dll};
my $libref = DynaLoader::dl_load_file($file, 0);
push(@DynaLoader::dl_librefs,$libref) if $libref;
# Dynaloader should take care of unloading
}
package
DynaLoader;
my $file = $class->get_the_location_to_wx_xs_module;
#------------------------------------------
# From XSLoader
#------------------------------------------
my $module = 'Wx';
my $boots = "$module\::bootstrap";
my $bootname = "boot_$module";
$bootname =~ s/\W/_/g;
@DynaLoader::dl_require_symbols = ($bootname);
my $boot_symbol_ref;
my $libref = dl_load_file($file, 0) or do {
require Carp;
Carp::croak("Can't load '$file' for module $module: " . dl_error());
};
push(@DynaLoader::dl_librefs,$libref); # record loaded object
my @unresolved = dl_undef_symbols();
if (@unresolved) {
require Carp;
Carp::carp("Undefined symbols present after loading $file: @unresolved\n");
}
$boot_symbol_ref = dl_find_symbol($libref, $bootname) or do {
require Carp;
Carp::croak("Can't find '$bootname' symbol in $file\n");
};
push(@DynaLoader::dl_modules, $module); # record loaded module
my $xs = dl_install_xsub($boots, $boot_symbol_ref, $file);
push(@DynaLoader::dl_shared_objects, $file); # record files loaded
#------------ IMPORTANT ----------
return 1; # we have loaded Wx
#---------------------------------
}
=head1 Full Custom Loader Example
################################################
# Custom loader for Wx distribution from
# http://www.wxperl.co.uk/repository
#
################################################
package Wx::Loader::Custom;
use strict;
use warnings;
our @ISA = qw( Wx::Loader::Standard );
$Wx::wx_binary_loader = __PACKAGE__ if !$Wx::wx_binary_loader;
sub loader_info { 'Linux PPM Distribution from http://www.wxperl.co.uk/repository'; }
sub boot_overload {
shift;
require DynaLoader;
for my $dll ( qw( base core adv ) ) {
next unless exists $Wx::dlls->{$dll} && $Wx::dlls->{$dll};
my $file = ( $Wx::wx_path ) ? $Wx::wx_path . '/' . $Wx::dlls->{$dll} : $Wx::dlls->{$dll};
my $libref = DynaLoader::dl_load_file($file, 0);
push(@DynaLoader::dl_librefs,$libref) if $libref;
# Dynaloader should take care of unloading
}
return 0;
}
# Allow legacy packaging call to override our load method
my( $load_fun ) = ( \&_load_dll );
sub _load_dll {
return unless exists $Wx::dlls->{$_[0]} && $Wx::dlls->{$_[0]};
my $dll = $Wx::dlls->{$_[0]};
$dll = $Wx::wx_path . '/' . $dll if $Wx::wx_path;
return Wx::_load_plugin( $dll );
}
sub external_set_load { $load_fun = $_[1] }
sub load_dll {
shift;
goto &$load_fun;
}
=cut
|