home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / RiscOS / APP / DEVS / PERL / RPC106.ZIP / Rpc106 / !Perl / !Help < prev    next >
Text File  |  1998-03-09  |  8KB  |  206 lines

  1. ****************************************************************************
  2. *                                       *
  3. *                        Perl                   *
  4. *          Practical Extraction and Report Language           *
  5. *                  Version  5.004_04                   *
  6. *                  RISC OS port 1.06                   *
  7. *                   Staticly Linked                   *
  8. *                                       *
  9. ****************************************************************************
  10.  
  11.                  NO WARRANTY
  12.  
  13.      BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
  14. FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
  15. OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
  16. PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
  17. OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  18. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
  19. TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
  20. PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
  21. REPAIR OR CORRECTION.
  22.  
  23.      IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
  24. WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
  25. REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
  26. INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
  27. OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
  28. TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
  29. YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
  30. PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
  31. POSSIBILITY OF SUCH DAMAGES.
  32.  
  33.  
  34.  
  35. Perl is a language optimized for scanning arbitrary text files, extracting
  36. information from those text files, and printing reports based on that
  37. information. It's also a good language for many system management tasks.
  38. The language is intended to be practical (easy to use, efficient, complete)
  39. rather than beautiful (tiny, elegant, minimal).
  40.  
  41. This !Perl application contains a perl binary with staticly linked
  42. extensions (including socket support), standard perl libraries (providing
  43. many useful functions), and some RISC OS libraries providing RISC OS
  44. specific functions and perl-like interfaces to RISC OS system calls.  When
  45. first seen by the filer !Perl will set an icon for perl files, initialise
  46. some variables needed by the perl binary, add the directory containing the
  47. perl binary to your Run$Path, and set a run-type for perl files so that
  48. double-clicking will run perl.
  49.  
  50. Running the !Perl application will also open the directory, set the
  51. WimpSlot "next" to 1024K, and change directory to the !Perl directory.
  52.  
  53. You may wish to copy the perl binary to a library directory where you keep
  54. other command line programs (such as compilers). If so, you should ensure
  55. that the actions performed by the !Boot file inside !Perl occur when you
  56. start your machine, so that perl can find its libraries. This can be done by
  57. placing !Perl in the !Boot.Choices.Boot.Tasks directory on a Risc PC, or by
  58. placing !Perl in a directory that is "seen" when your machine starts (ie a
  59. directory where you keep your common applications).
  60.  
  61. Probably the three most powerful features of core perl are:
  62. *    its regular expressions for pattern matching.
  63. *    its ability to cope with arbitary length strings.
  64. *    its associative arrays (hashes) which allow data to be stored by
  65.     key/value pairs.
  66.  
  67. In addition, probably the three most useful features of the RISC OS port are
  68. *    filename globbing.
  69. *    *command/program output capture.
  70. *    full access to all SWIs - passing data to and from perl.
  71.  
  72.  
  73. The scripts directory contains many useful scripts which demonstrate how to
  74. use perl, and how some of the RISC OS specific functions work.
  75.  
  76. Some of the most useful are:
  77. SetType+    settype multiple files specified by wildcards.
  78. grep        find strings (patterns in files) - coupled with optional
  79.         throwback and files specified by recursive globs this is
  80.         very powerful.
  81. finger        finger in perl - how to write portable socket code.
  82.         (This script will run unmodified on Unix)
  83. rename        Larry Wall's clasic rename script, which allows files to
  84.         be renamed using a perl expression to generate the new
  85.         name from the old.
  86.  
  87.  
  88. If you have used a previous perl port....
  89.  
  90. Globbing improved
  91.     1: * and # can be used in all directory names, not just the final
  92.        leafname
  93.     2: .. matches any number of directories, so @..* matches all files
  94.        in the current directory and all subdirectories
  95.     3: path variables are searched (recursively) - path variables in the
  96.        returned list of filenames can either be left in place or
  97.        expanded fully. (see the library documentation for RiscOS::File)
  98.  
  99. Program output capture more reliable
  100.     Perl will capture program output without needing an internal lookup
  101.     table of what to treat as a *command
  102.  
  103. SWIs can now be called by name or number
  104.     Pass a number and it will be recognised as such - bypassing the long
  105.     overhead of the SWI name lookup
  106.  
  107. Almost all perl modules work
  108.     Bigint, Complex, File::Copy, ...
  109.     Many extensions work (eg Socket IO Fcntl)
  110.     All regression tests that the Config.pm say should pass do!
  111.  
  112.  
  113. *IF YOU HAVE USED A PREVIOUS PERL PORT* note that this perl defaults to
  114. "Unix style" filenames. (consistent with perl ports to other OSes)
  115. To *TURN OFF* automatic filename conversion
  116.  
  117.     use RiscOS::Filespec;
  118.  
  119. at the start of your script (or invoke perl as perl -MRiscOS::Filespec)
  120.  
  121.  
  122. -------------------------------Hints and Tips-------------------------------
  123.  
  124. The modules supplied with perl provide a large amount of common
  125. functionality, portable across many platforms. *Not* investigating and using
  126. the supplied modules is about as wise as not using the ANSI C library.
  127.  
  128. For example, to expand all the tabs in an array of lines of text:
  129.  
  130.     use Text::Tabs;
  131.     @lines_without_tabs = expand(@lines_with_tabs);
  132.  
  133.  
  134. If you want to copy anything:
  135.     use File::Copy;
  136.     copy <from> <to>
  137.     syscopy <from> <to> [<flags>]
  138.  
  139. in preference to *copy or calling OS_FSControl 26.
  140.  
  141. Flags default to 0 [*], and are as for OS_FSControl 26 *except* that bit 13
  142. is toggled. This means that *by default* an appropriately sized user buffer
  143. is provided internally, avoiding problems copying to/from archives.
  144. [Appropriately sized is currently implemented as min( <filesize>, 128K ) ]
  145. * If flags are not supplied then force is turned on unless the target is
  146. locked. This means that you can copy over a destination file automatically.
  147.  
  148. If you want the Internet hostname:
  149.     use Sys::hostname;
  150.     $name = hostname();
  151.    
  152. as it automatically tries all known methods to get this information.
  153. [See Unixlib's unix.c.gethostname for the implementation]
  154.  
  155.  
  156. Beware of full pathnames:
  157.  
  158. "ADFS::Bagpuss.$.!Boot" ne 'ADFS::Bagpuss.$.!Boot'
  159.  
  160. because $. is a variable that gets interpolated.
  161.  
  162. However even if you are careful and go:
  163.  
  164. $somevar = 'ADFS::Bagpuss.$.!Boot'
  165.  
  166. DONT:
  167.     $othervar =~ /^$somevar/;
  168.  
  169. this **will** come unstuck because $somevar is **interpolated AGAIN** in the
  170. regular expression.
  171.  
  172. DO:
  173.     $othervar =~ /^\Q$somevar\E/;
  174.  
  175. to stop this second interpolation! (looks like it should quote the '$').
  176. This won't screw up with \ in filenames, as \ is the Previously Set
  177. Directory, and the only character that can legally follow it is .
  178.  
  179.  
  180. Beware of <System$Variables> in filenames:
  181.  
  182. DONT:
  183.     open( FILE, $file );
  184.  
  185. this will fail if $file starts "<somesystem$var>"
  186.  
  187. DO:
  188.     open( FILE, "<$file" );
  189.  
  190. They also confuse the parser in globs, and the $ will get interpolated
  191.  
  192. DONT:
  193.     <<Obey$Dir>.*>
  194.  
  195. DO:
  196.     < <Obey\$Dir>.*>
  197.  
  198.  
  199. ----------------------------------------------------------------------------
  200.  
  201. Perl may be copied subject to the conditions of the "Artistic License"
  202. which you will find in the file "Artistic".
  203.  
  204. The perl source code and utilities needed to remake perl from scratch are
  205. available from ftp://www.unfortu.net/pub/flirble/users/nick/P/
  206.