home *** CD-ROM | disk | FTP | other *** search
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <HTML>
-
- <HEAD>
- <TITLE>ActivePerl faq5 - Implementation Quirks</TITLE>
- <LINK rev="made" href="mailto:support@ActiveState.com">
- <META name="GENERATOR" charset="iso-8859-1" content="Microsoft FrontPage 4.0">
- <META name="ProgId" content="FrontPage.Editor.Document">
- <LINK rel="STYLESHEET" href="../../Active.css" type="text/css" media="screen">
- </HEAD>
-
- <BODY bgcolor="#ffffff">
-
- <TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
- <TR>
- <TD class="block" valign="MIDDLE" width="100%" bgcolor="#cccccc"><STRONG>
- <P class="block"> ActivePerl FAQ</P>
- </STRONG></TD>
- </TR>
- </TABLE>
-
- <UL>
- <LI><A href="#NAME">NAME</A></LI>
- <LI><A href="#DESCRIPTION">DESCRIPTION</A>
- <UL>
- <LI><A href="#Certain_functions_don_t_seem_to_">Certain functions don't seem to work on
- ActivePerl.</A></LI>
- <LI><A href="#The_exec_function_doesn_t_seem_t">The exec function doesn't seem to work under
- Perl for ISAPI, Perl for WebSite, or PerlScript. Why not?</A></LI>
- <LI><A href="#What_s_the_difference_between_Pe">What's the difference between ActivePerl and
- the old 3xx builds?</A></LI>
- <LI><A href="#What_s_the_difference_between_ru">What's the difference between running
- ActivePerl on Windows NT</A></LI>
- <LI><A href="#Why_don_t_the_examples_from_the_">Why don't the examples from the Camel book
- work?</A></LI>
- <LI><A href="#Why_don_t_certain_standard_libra">Why don't certain standard library modules
- work?</A></LI>
- <LI><A href="#How_do_I_make_a_UNIX_based_scrip">How do I make a UNIX-based script work?</A></LI>
- <LI><A href="#How_does_the_chmod_function_work">How does the chmod function work on Win32
- platforms?</A></LI>
- <LI><A href="#4DOS_doesn_t_recognize_on_the">4DOS doesn't recognize \" on the command
- line.</A></LI>
- <LI><A href="#STDIN_and_STDOUT_and_Piping_don">STDIN and STDOUT, and Piping don't always work
- on NT.</A></LI>
- <LI><A href="#Signal_Handling">Why doesn't signal handling work on Windows.</A></LI>
- </UL>
- </LI>
- <LI><A href="#AUTHOR_AND_COPYRIGHT">AUTHOR AND COPYRIGHT</A></LI>
- </UL>
- <HR>
- <H1><A name="NAME">NAME</A></H1>
- <P>ActivePerl faq5 - Implementation Quirks</P>
- <HR>
- <H1><A name="DESCRIPTION">DESCRIPTION</A></H1>
- <P>Issues specific to ActivePerl.</P>
- <HR>
- <H2><A name="Certain_functions_don_t_seem_to_">Certain functions don't seem to work on ActivePerl.</A></H2>
- <P>There are several functions that are unimplemented in the ActivePerl system. Primary among these
- is <CODE>alarm()</CODE>, which is used in a few Perl modules. Because they're missing in ActivePerl,
- you can't use those modules. Here is a complete list of unimplemented functions:</P>
- <DL>
- <DT><STRONG>Functions for processes and process groups</STRONG></DT>
- <DD>
- <P><CODE>alarm(),</CODE> <CODE>fork(),</CODE> <CODE>getpgrp(),</CODE> <CODE>getppid(),</CODE> <CODE>getpriority(),</CODE>
- <CODE>setpgrp(),</CODE> <CODE>setpriority()</CODE></P>
- </DD>
- <DT><STRONG><A name="item_Fetching">Fetching user and group info</A></STRONG></DT>
- <DD>
- <P><CODE>endgrent(),</CODE> <CODE>endpwent(),</CODE> <CODE>getgrent(),</CODE> <CODE>getgrgid(),</CODE>
- <CODE>getgrnam(),</CODE> <CODE>getpwent(),</CODE> <CODE>getpwnam(),</CODE> <CODE>getpwuid(),</CODE>
- <CODE>setgrent(),</CODE> <CODE>setpwent()</CODE></P>
- </DD>
- <DT><STRONG><A name="item_System">System V interprocess communication functions</A></STRONG></DT>
- <DD>
- <P><CODE>msgctl(),</CODE> <CODE>msgget(),</CODE> <CODE>msgrcv(),</CODE> <CODE>msgsnd(),</CODE> <CODE>semctl(),</CODE>
- <CODE>semget(),</CODE> <CODE>semop(),</CODE> <CODE>shmctl(),</CODE> <CODE>shmget(),</CODE> <CODE>shmread(),</CODE>
- <CODE>shmwrite()</CODE></P>
- </DD>
- <DT><STRONG>Functions for filehandles, files, or directories</STRONG></DT>
- <DD>
- <P><CODE>link(),</CODE> <CODE>symlink(),</CODE> <CODE>chroot()</CODE></P>
- </DD>
- <DT><STRONG><A name="item_Input">Input and output functions</A></STRONG></DT>
- <DD>
- <P><CODE>syscall()</CODE></P>
- </DD>
- <DT><STRONG>Fetching network info</STRONG></DT>
- <DD>
- <P><CODE>getnetbyname(),</CODE> <CODE>getnetbyaddr(),</CODE> <CODE>getnetent(),</CODE> <CODE>getprotoent(),</CODE>
- <CODE>getservent(),</CODE> <CODE>sethostent(),</CODE> <CODE>setnetent(),</CODE> <CODE>setprotoent(),</CODE>
- <CODE>setservent(),</CODE> <CODE>endhostent(),</CODE> <CODE>endnetent(),</CODE> <CODE>endprotoent(),</CODE>
- <CODE>endservent(),</CODE> <CODE>socketpair()</CODE></P>
- </DD>
- </DL>
- <P>See the perlport and perlwin32 documentation pages for more information on the portability of
- builtin functions in ActivePerl.</P>
- <HR>
- <H2><A name="The_exec_function_doesn_t_seem_t">The exec function doesn't seem to work under Perl for
- ISAPI, Perl for WebSite, or PerlScript. Why not?</A></H2>
- <P>Perl for ISAPI, Perl for WebSite, and PerlScript share a process space with the web server and
- any number of other extensions. As a result, the <CODE>exec()</CODE> function is unimplemented,
- because it would cause the web server to terminate (the <CODE>exec()</CODE> function executes a
- system command and never returns).</P>
- <HR>
- <H2><A name="What_s_the_difference_between_Pe">What's the difference between ActivePerl and the old
- 3xx builds?</A></H2>
- <P>At one time, Perl on the Win32 platform was found in two versions, Gurusamy Sarathy's port, and
- the ActiveState port. The ActiveState port of Perl included such tools as Perl for ISAPI and
- PerlScript, at the expense of exposing Perl's internals in a slightly different fashion than
- standard Perl. Sarathy's port featured a high degree of compatibility with standard Perl, which
- enabled users of Sarathy's port to use many modules that were not compatible with ActiveState Perl.</P>
- <P>The oneperl effort brought both ports of Perl together, and ActivePerl is the standard perl
- distribution for the Win32 system. All modules that can be used on Win32 can be used with this port.
- You no longer have to worry about whose perl the module is for. Just grab it, compile it (if
- needed), and use it.</P>
- <HR>
- <H2><A name="What_s_the_difference_between_ru">What's the difference between running ActivePerl on
- Windows NT versus running it on Windows 95?</A></H2>
- <P>There should be little difference between running Perl on the two operating systems. You should
- watch for the following, though:</P>
- <UL>
- <LI>
- <P>The Win32::NetAdmin, Win32::NetResource, and Win32::EventLog modules will not run on Windows
- 95.</P>
- </LI>
- <LI>
- <P>Some functions that work on Windows NT reportedly do not work or are buggy on Windows 95. An
- example is <CODE>flock().</CODE></P>
- </LI>
- <LI>
- <P>Finally, many helpful programs that are available on Windows NT are not there on Windows 95. <CODE>hostname</CODE>,
- for example, is not available on Windows 95.</P>
- </LI>
- </UL>
- <P>If you're worried about using a feature from one or the other, check the result of the function
- Win32::IsWinNT() to see what OS you're running on. See <A href="../Windows/ActivePerl-Winfaq9.html#What_modules_come_with_the_Perl_">What
- modules come with the ActivePerl distribution?</A>.</P>
- <HR>
- <H2><A name="Why_don_t_the_examples_from_the_">Why don't the examples from the Camel book work?</A></H2>
- <P>The Camel book (aka <EM>Programming Perl</EM>, Wall et.al., O'Reilly & Associates 1996) was
- written by UNIX people for, in general, UNIX people.</P>
- <P>Some of the examples in the Camel book will work. Some will not. If they fail, it's because
- either the functions used are not available, the external tools used are not available, or the
- modules used are not available. Usually, for small scripts, it's not to hard to fiddle with them
- until they come out correct (see <A href="#How_do_I_make_a_UNIX_based_scrip">How do I make a
- UNIX-based script work?</A>).</P>
- <P>The Camel and Llama books are good learning tools. However, one of the things you learn as a
- ActivePerl programmer is how to port UNIX-targeted scripts and modules to ActivePerl.</P>
- <P>For better examples of using ActivePerl, you may want to look at the Gecko book, ``Learning Perl
- on Win32 Systems,'' published by O'Reilly.</P>
- <HR>
- <H2><A name="Why_don_t_certain_standard_libra">Why don't certain standard library modules work?</A></H2>
- <P>With ActivePerl, almost all modules will work with ActivePerl as long as they can be built to run
- on Win32. The problems that existed with the 3xx versions of Perl for Win32 no longer exist: modules
- work on Win32, not just this port or that port of Perl for the Win32 platform!</P>
- <P>If a module doesn't work, it may be because the functions it uses are specific to UNIX and won't
- work on Win32, or specific to NT and won't work on Windows 95 or Windows 98.</P>
- <HR>
- <H2><A name="How_do_I_make_a_UNIX_based_scrip">How do I make a UNIX-based script work?</A></H2>
- <P>First, make extra-super sure that you are using the script or module in the way it was intended.
- Many of us are quick to blame the module, the operating system, or the interpreter when, in reality,
- it is our own code that isn't working right.</P>
- <P>If you're sure that it's not a problem in your code, the best way to make a UNIX-based script
- work is to desk-check it before running it. Look for some of the following things:</P>
- <UL>
- <LI>
- <P>Calls to functions unimplemented in ActivePerl. For a list, see <A href="#Certain_functions_don_t_seem_to_">Certain
- functions don't seem to work on ActivePerl.</A>.</P>
- </LI>
- <LI>
- <P>Calls to standard library modules or CPAN modules that aren't available on ActivePerl, or
- that don't work.</P>
- </LI>
- <LI>
- <P><CODE>system()</CODE> or backtick (``) calls to system tools that aren't available on
- ActivePerl.</P>
- </LI>
- <LI>
- <P>Reading and writing files that may be binary. See <A href="../Windows/ActivePerl-Winfaq8.html#Reading_from_and_writing_to_file">Reading
- from and writing to files mysteriously fails. What's wrong?</A>.</P>
- </LI>
- <LI>
- <P>File-system dependent path names and path name parsing. Watch for hard-coded UNIX paths like <EM>/usr/lib</EM>.</P>
- </LI>
- <LI>
- <P>The module or script may require a specific version of Perl or another module. Watch out for
- things like <CODE>require 5.003;</CODE> or <CODE>require Sockets 1.03;</CODE> Check to see if
- the script or module really requires the new version.</P>
- </LI>
- </UL>
- <P>Of course, it should go without saying that for everything you take out you'll have to put in a
- work-around.</P>
- <P>Once you've worked around UNIX dependencies in the script or module, try running it through the
- debugger to see if what you did helps. If the script or module comes with a <EM>.t</EM> test file,
- try using that to test your changed version.</P>
- <P>If you do make a change to a UNIX-based script or module, please let the author know. Sometimes
- the author will be gracious enough to make changes that will let the program run on ActivePerl. If
- the author won't change the program, ask if you can make the altered version available to other
- users.</P>
- <HR>
- <H2><A name="How_does_the_chmod_function_work">How does the chmod function work on Win32 platforms?</A></H2>
- <P><CODE>chmod()</CODE> is supported in ActivePerl. However, it can only be used for setting
- "owner" read/write access. (The "group" and "other" bits are ignored.)</P>
- <P>UNIX-style security for files is not applicable to files on Win32 systems. Win32 systems inherit
- from DOS four possible file attributes: archived (A), read-only (R), hidden (H), and system (S).
- These can be checked and set with the Win32::File::Get/SetAttributes().</P>
- <P>Windows NT systems using NTFS can also have more specific permissions granted on individual files
- to users and groups. For builds 300 and above, and the Perl Resource Kit for Win32, you can use the
- Win32::FileSecurity module to maintain file permissions.</P>
- <HR>
- <H2><A name="4DOS_doesn_t_recognize_on_the">4DOS doesn't recognize \" on the command line.</A></H2>
- <P>4DOS doesn't recognize the escaped quote on the command line, because all double-quote characters
- are seen as delimiters for command line parameters. This is one of the few points (if not the only
- one) where 4DOS doesn't quite match up to <EM>COMMAND.COM</EM>.</P>
- <P>To get around this, you can enter</P>
- <PRE>
- perl -e "print \"Hello, World\n\""
- </PRE>
- <P>as</P>
- <PRE>
- perl -e "print qq(Hello, World\n)"
- </PRE>
- <P>using Perl's alternative quoting mechanism. The alternative quotes are <CODE>qq()</CODE> for
- double quotes, <CODE>q()</CODE> for single quotes, <CODE>qx()</CODE> for backquotes, and <CODE>qw()</CODE>
- for list quotes. The parentheses can be substituted for just about anything (like + or | or {} or
- <> or #), but that looks weird.</P>
- <HR>
- <H2><A name="STDIN_and_STDOUT_and_Piping_don">STDIN and STDOUT, and Piping don't always work on NT.</A></H2>
- <P>You may get unexpected results when you try to redirect the output of files that use Windows NT's
- file association feature. You can use pl2exe or pl2bat to convert a Perl script to an executable or
- a batch file. This should solve any problems you may have with redirection.</P>
- <HR>
- <H2><A name="#Signal_Handling">Why doesn't signal handling work on Windows?</A></H2>
- <P>Signals are unsupported by the Win32 API. The C Runtime provides crude support for signals, but
- there are serious caveats, such as inability to die() or exit() from a signal handler. Perl itself
- does not guarantee that signal handlers will not interrupt critical operations such as memory
- allocation, which means signal invocation may throw perl internals into disarray. For these reasons,
- signals are unsupported at this time.</P>
- <HR>
- <H1><A name="AUTHOR_AND_COPYRIGHT">AUTHOR AND COPYRIGHT</A></H1>
- <P>This FAQ was originally assembled and maintained by Evangelo Prodromou. It has been revised and
- updated by Brian Jepson of O'Reilly and Associates, and David Grove, David Dmytryshyn, and David
- Sparks of ActiveState.</P>
- <P>This FAQ is in the public domain. If you use it, however, please ensure that you give credit to
- the original authors.</P>
- <TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
- <TR>
- <TD class="block" valign="MIDDLE" width="100%" bgcolor="#cccccc"><STRONG>
- <P class="block"> ActivePerl FAQ</P>
- </STRONG></TD>
- </TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-