⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 perlos2.pod

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 POD
📖 第 1 页 / 共 5 页
字号:
in subdirectories may be buggy, and would not run as "child" scripts.  Theinterdependency of modules can strike you; however, since non-XS modulesare already installed, the prerequisites of most modules have a very goodchance to be present.If you discover some glitches, move directories of problematic modules to adifferent location; if these modules are non-XS modules, you may just ignorethem - they are already installed; the remaining, XS, modules you need toinstall manually one by one.After each such removal you need to rerun the C<Makefile.PL>/C<make> process;usually this procedure converges soon.  (But be sure to convert all thenecessary external C libraries from F<.lib> format to F<.a> format: run one of  emxaout foo.lib  emximp -o foo.a foo.libwhichever is appropriate.)  Also, make sure that the DLLs for externallibraries are usable with with executables compiled without C<-Zmtd> options.When you are sure that only a few subdirectorieslead to failures, you may want to add C<-j4> option to C<make> to speed upskipping subdirectories with already finished build.When you are satisfied with the results of tests, install the build C librariesfor extensions:  make install |& tee 00aout_iNow you can rename the file F<./perl.exe> generated during the last phaseto F<perl_5.8.2.exe>; place it on C<PATH>; if there is an inter-dependencybetween some XS modules, you may need to repeat the C<test>/C<install> loopwith this new executable and some excluded modules - until the procedureconverges.Now you have all the necessary F<.a> libraries for these Perl modules in theplaces where Perl builder can find it.  Use the perl builder: change to anempty directory, create a "dummy" F<Makefile.PL> again, and run  perl_5.8.2.exe Makefile.PL |& tee 00c  make perl		     |& tee 00pThis should create an executable F<./perl.exe> with all the statically loadedextensions built in.  Compare the generated F<perlmain.c> files to make surethat during the iterations the number of loaded extensions only increases.Rename F<./perl.exe> to F<perl_5.8.2.exe> on C<PATH>.When it converges, you got a functional variant of F<perl_5.8.2.exe>; copy itto C<perl_.exe>.  You are done with generation of the local Perl installation.=item 8.Make sure that the installed modules are actually installed in the locationof the new Perl, and are not inherited from entries of @INC given forinheritance from the older versions of Perl: set C<PERLLIB_582_PREFIX> toredirect the new version of Perl to a new location, and copy the installedfiles to this new location.  Redo the tests to make sure that the versions ofmodules inherited from older versions of Perl are not needed.Actually, the log output of L<pod2ipf> during the step 6 gives a very detailedinfo about which modules are loaded from which place; so you may use it asan additional verification tool.Check that some temporary files did not make into the perl install tree.Run something like this  pfind . -f "!(/\.(pm|pl|ix|al|h|a|lib|txt|pod|imp|bs|dll|ld|bs|inc|xbm|yml|cgi|uu|e2x|skip|packlist|eg|cfg|html|pub|enc|all|ini|po|pot)$/i or /^\w+$/") | lessin the install tree (both top one and F<sitelib> one).Compress all the DLLs with F<lxlite>.  The tiny F<.exe> can be compressed withC</c:max> (the bug only appears when there is a fixup in the last 6 bytes of apage (?); since the tiny executables are much smaller than a page, the bugwill not hit).  Do not compress C<perl_.exe> - it would not work under DOS.=item 9.Now you can generate the binary distribution.  This is done by running thetest of the CPAN distribution C<OS2::SoftInstaller>.  Tune up the fileF<test.pl> to suit the layout of current version of Perl first.  Do notforget to pack the necessary external DLLs accordingly.  Include thedescription of the bugs and test suite failures you could not fix.  Includethe small-stack versions of Perl executables from Perl build directory.Include F<perl5.def> so that people can relink the perl DLL preservingthe binary compatibility, or can create compatibility DLLs.  Include the difffiles (C<diff -pu old new>) of fixes you did so that people can rebuild yourversion.  Include F<perl5.map> so that one can use remote debugging.=item 10.Share what you did with the other people.  Relax.  Enjoy fruits of your work.=item 11.Brace yourself for thanks, bug reports, hate mail and spam coming as resultof the previous step.  No good deed should remain unpunished!=back=head1 Building custom F<.EXE> filesThe Perl executables can be easily rebuilt at any moment.  Moreover, one canuse the I<embedding> interface (see L<perlembed>) to make very customizedexecutables.=head2 Making executables with a custom collection of statically loaded extensionsIt is a little bit easier to do so while I<decreasing> the list of staticallyloaded extensions.  We discuss this case only here.=over=item 1.Change to an empty directory, and create a placeholder <Makefile.PL>:  use ExtUtils::MakeMaker;  WriteMakefile NAME => 'dummy';=item 2.Run it with the flavor of Perl (F<perl.exe> or F<perl_.exe>) you want torebuild.  perl_ Makefile.PL=item 3.Ask it to create new Perl executable:  make perl(you may need to manually add C<PERLTYPE=-DPERL_CORE> to this commandline onsome versions of Perl; the symptom is that the command-line globbing does notwork from OS/2 shells with the newly-compiled executable; check with  .\perl.exe -wle "print for @ARGV" *).=item 4.The previous step created F<perlmain.c> which contains a list of newXS() callsnear the end.  Removing unnecessary calls, and rerunning  make perlwill produce a customized executable.=back=head2 Making executables with a custom search-pathsThe default perl executable is flexible enough to support most usages.However, one may want something yet more flexible; for example, one may wantto find Perl DLL relatively to the location of the EXE file; or one may wantto ignore the environment when setting the Perl-library search patch, etc.If you fill comfortable with I<embedding> interface (see L<perlembed>), suchthings are easy to do repeating the steps outlined in L<Makingexecutables with a custom collection of statically loaded extensions>, anddoing more comprehensive edits to main() of F<perlmain.c>.  The people withlittle desire to understand Perl can just rename main(), and do necessarymodification in a custom main() which calls the renamed function in appropriatetime.However, there is a third way: perl DLL exports the main() function and severalcallbacks to customize the search path.  Below is a complete example of a"Perl loader" which=over=item 1.Looks for Perl DLL in the directory C<$exedir/../dll>;=item 2.Prepends the above directory to C<BEGINLIBPATH>;=item 3.Fails if the Perl DLL found via C<BEGINLIBPATH> is different from what wasloaded on step 1; e.g., another process could have loaded it from C<LIBPATH>or from a different value of C<BEGINLIBPATH>.  In these cases one needs tomodify the setting of the system so that this other process either does notrun, or loads the DLL from C<BEGINLIBPATH> with C<LIBPATHSTRICT=T> (availablewith kernels after September 2000).=item 4.Loads Perl library from C<$exedir/../dll/lib/>.=item 5.Uses Bourne shell from C<$exedir/../dll/sh/ksh.exe>.=backFor best results compile the C file below with the same options as the PerlDLL.  However, a lot of functionality will work even if the executable is notan EMX applications, e.g., if compiled with  gcc -Wall -DDOSISH -DOS2=1 -O2 -s -Zomf -Zsys perl-starter.c -DPERL_DLL_BASENAME=\"perl312F\" -Zstack 8192 -Zlinker /PM:VIOHere is the sample C file:  #define INCL_DOS  #define INCL_NOPM  /* These are needed for compile if os2.h includes os2tk.h, not os2emx.h */  #define INCL_DOSPROCESS  #include <os2.h>  #include "EXTERN.h"  #define PERL_IN_MINIPERLMAIN_C  #include "perl.h"  static char *me;  HMODULE handle;  static void  die_with(char *msg1, char *msg2, char *msg3, char *msg4)  {     ULONG c;     char *s = " error: ";     DosWrite(2, me, strlen(me), &c);     DosWrite(2, s, strlen(s), &c);     DosWrite(2, msg1, strlen(msg1), &c);     DosWrite(2, msg2, strlen(msg2), &c);     DosWrite(2, msg3, strlen(msg3), &c);     DosWrite(2, msg4, strlen(msg4), &c);     DosWrite(2, "\r\n", 2, &c);     exit(255);  }  typedef ULONG (*fill_extLibpath_t)(int type, char *pre, char *post, int replace, char *msg);  typedef int (*main_t)(int type, char *argv[], char *env[]);  typedef int (*handler_t)(void* data, int which);  #ifndef PERL_DLL_BASENAME  #  define PERL_DLL_BASENAME "perl"  #endif  static HMODULE  load_perl_dll(char *basename)  {      char buf[300], fail[260];      STRLEN l, dirl;      fill_extLibpath_t f;      ULONG rc_fullname;      HMODULE handle, handle1;      if (_execname(buf, sizeof(buf) - 13) != 0)          die_with("Can't find full path: ", strerror(errno), "", "");      /* XXXX Fill `me' with new value */      l = strlen(buf);      while (l && buf[l-1] != '/' && buf[l-1] != '\\')          l--;      dirl = l - 1;      strcpy(buf + l, basename);      l += strlen(basename);      strcpy(buf + l, ".dll");      if ( (rc_fullname = DosLoadModule(fail, sizeof fail, buf, &handle)) != 0           && DosLoadModule(fail, sizeof fail, basename, &handle) != 0 )          die_with("Can't load DLL ", buf, "", "");      if (rc_fullname)          return handle;		/* was loaded with short name; all is fine */      if (DosQueryProcAddr(handle, 0, "fill_extLibpath", (PFN*)&f))          die_with(buf, ": DLL exports no symbol ", "fill_extLibpath", "");      buf[dirl] = 0;      if (f(0 /*BEGINLIBPATH*/, buf /* prepend */, NULL /* append */,            0 /* keep old value */, me))          die_with(me, ": prepending BEGINLIBPATH", "", "");      if (DosLoadModule(fail, sizeof fail, basename, &handle1) != 0)          die_with(me, ": finding perl DLL again via BEGINLIBPATH", "", "");      buf[dirl] = '\\';           if (handle1 != handle) {          if (DosQueryModuleName(handle1, sizeof(fail), fail))              strcpy(fail, "???");          die_with(buf, ":\n\tperl DLL via BEGINLIBPATH is different: \n\t",                   fail,                   "\n\tYou may need to manipulate global BEGINLIBPATH and LIBPATHSTRICT"                   "\n\tso that the other copy is loaded via BEGINLIBPATH.");      }      return handle;  }  int  main(int argc, char **argv, char **env)  {      main_t f;      handler_t h;          me = argv[0];      /**/      handle = load_perl_dll(PERL_DLL_BASENAME);      if (DosQueryProcAddr(handle, 0, "Perl_OS2_handler_install", (PFN*)&h))          die_with(PERL_DLL_BASENAME, ": DLL exports no symbol ", "Perl_OS2_handler_install", "");      if ( !h((void *)"~installprefix", Perlos2_handler_perllib_from)           || !h((void *)"~dll", Perlos2_handler_perllib_to)           || !h((void *)"~dll/sh/ksh.exe", Perlos2_handler_perl_sh) )          die_with(PERL_DLL_BASENAME, ": Can't install @INC manglers", "", "");      if (DosQueryProcAddr(handle, 0, "dll_perlmain", (PFN*)&f))          die_with(PERL_DLL_BASENAME, ": DLL exports no symbol ", "dll_perlmain", "");      return f(argc, argv, env);  }=head1 Build FAQ=head2 Some C</> became C<\> in pdksh.You have a very old pdksh. See L<Prerequisites>.=head2 C<'errno'> - unresolved externalYou do not have MT-safe F<db.lib>. See L<Prerequisites>.=head2 Problems with tr or sedreported with very old version of tr and sed.=head2 Some problem (forget which ;-)You have an older version of F<perl.dll> on your LIBPATH, whichbroke the build of extensions.=head2 Library ... not foundYou did not run C<omflibs>. See L<Prerequisites>.=head2 Segfault in makeYou use an old version of GNU make. See L<Prerequisites>.=head2 op/sprintf test failureThis can result from a bug in emx sprintf which was fixed in 0.9d fix 03.=head1 Specific (mis)features of OS/2 port=head2 C<setpriority>, C<getpriority>Note that these functions are compatible with *nix, not with the olderports of '94 - 95. The priorities are absolute, go from 32 to -95,lower is quicker. 0 is the default priority.B<WARNING>.  Calling C<getpriority> on a non-existing process could lockthe system before Warp3 fixpak22.  Starting with Warp3, Perl will usea workaround: it aborts getpriority() if the process is not present.This is not possible on older versions C<2.*>, and has a racecondition anyway.=head2 C<system()>Multi-argument form of C<system()> allows an additional numericargument. The meaning of this argument is described inL<OS2::Process>.When finding a program to run, Perl first asks the OS to look for executableson C<PATH> (OS/2 adds extension F<.exe> if no extension is present).If not found, it looks for a script with possible extensions added in this order: no extension, F<.cmd>, F<.btm>, F<.bat>, F<.pl>.  If found, Perl checks the start of the file for magicstrings C<"#!"> and C<"extproc ">.  If found, Perl uses the rest of thefirst line as the beginning of the command line to run this script.  Theonly mangling done to the first line is extraction of arguments (currentlyup to 3), and ignoring of the path-part of the "interpreter" name if it can'tbe found using the full path.E.g., C<system 'foo', 'bar', 'baz'> may lead Perl to findingF<C:/emx/bin/foo.cmd> with the first line being extproc /bin/bash    -x   -cIf F</bin/bash.exe> is not found, then Perl looks for an executable F<bash.exe> onC<PATH>.  If found in F<C:/emx.add/bin/bash.exe>, then the above system() istranslated to  system qw(C:/emx.add/bin/bash.exe -x -c C:/emx/bin/foo.cmd bar baz)One additional translation is performed: instead of F</bin/sh> Perl usesthe hardwired-or-customized shell (see C<L<"PERL_SH_DIR">>).The above search for "interpreter" is recursive: if F<bash> executable is notfound, but F<bash.btm> is found, Perl will investigate its first line etc.The only hardwired limit on the recursion depth is implicit: there is a limit4 on the number of additional arguments inserted before the actual argumentsgiven to system().  In particular, if no additional arguments are specifiedon the "magic" first lines, then the limit on the depth is 4.If Perl finds that the found executable is of PM type when thecurrent session is not, it will start the new process in a separate session ofnecessary type.  Call via C<OS2::Process> to disable this magic.B<WARNING>.  Due to the described logic, you need to explicitlyspecify F<.com> extension if needed.  Moreover, if the executableF<perl5.6.1> is requested, Perl will not look for F<perl5.6.1.exe>.[This may change in the future.]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -