AutoLoader nebo neco takoveho?
Jan Kasprzak
kas na fi.muni.cz
Čtvrtek Listopad 12 10:43:24 CET 2009
Honza Pazdziora wrote:
: > Jak byste to delali? Mit v PERL5LIB neco jako MujProgram/text_plain.pm
: > a dalsi, pri startu programu projit adresar a "require" nacist vsechny
: > moduly ktere tam jsou? Nebo nejaky autoloader? Nebo?
:
: Ani neni nutne pri startu, proste require v okamziku pouziti. Kdyz se
: podivas treba na LWP::Protocol, tak tam je
:
: return '' unless $scheme =~ /^([.+\-\w]+)$/; # check valid URL schemes
: $scheme = $1; # untaint
: $scheme =~ s/[.+\-]/_/g; # make it a legal module name
:
: # scheme not yet known, look for a 'use'd implementation
: $ic = "LWP::Protocol::$scheme"; # default location
: $ic = "LWP::Protocol::nntp" if $scheme eq 'news'; #XXX ugly hack
: no strict 'refs';
: # check we actually have one for the scheme:
: unless (@{"${ic}::ISA"}) {
Jo, nakonec jsem to udelal nejak takto, akorat jsem evaloval
use misto require a testoval svym hashem, ne existenci @ISA (BTW,
@ISA je v kazdem package?).
-Y.
--
| Jan "Yenya" Kasprzak <kas at {fi.muni.cz - work | yenya.net - private}> |
| GPG: ID 1024/D3498839 Fingerprint 0D99A7FB206605D7 8B35FCDE05B18A5E |
| http://www.fi.muni.cz/~kas/ Journal: http://www.fi.muni.cz/~kas/blog/ |
Please don't top post and in particular don't attach entire digests to your
mail or we'll all soon be using bittorrent to read the list. --Alan Cox
Další informace o konferenci Perl