home *** CD-ROM | disk | FTP | other *** search
- ****************************************************************************
- * *
- * Perl *
- * Practical Extraction and Report Language *
- * Version 5.005 *
- * RISC OS port 1.13 *
- * Statically Linked *
- * *
- ****************************************************************************
-
-
- STOP
-
-
- As warned the incorrect 'RiscOS' has gone. Packages are now RISCOS::
- and $^O reports 'riscos'. To find everything that needs changing try:
-
- scripts.grep -t RiscOS myscriptdir..*
-
- Beware: as RISC OS filesystems are case insensitive, use RiscOS; will find
- RISCOS, but not import subroutines. This will lead to a lot of wacky syntax
- errors. The brute-force solution is to
-
- perl -i~ -p 's/RiscOS/RISCOS/' myscriptdir..*
-
- (By the way, .. recursive globbing can be quite useful.)
-
- The directory structure has changed since 1.11 :-)
- Most of the perl library is now in a single zip file, and I've hacked perl to
- read libraries direct from a zip file. You *can* read the zip file with Infozip
- or SparkFS, but *please* leave it settype'd data, else perl will use SparkFS to
- read from it (which is probably slower). Again it is best to back up any changes
- you made to your !Perl, and start afresh with this copy if you're using 1.11 or
- earlier. I'm experimenting with sfio to get the remaining few library files
- inside the zip (those which use __DATA__).
-
- UnixLib still can't cope with command lines like
-
- perl -le 'print @ARGV' <Wimp$Scrap>
-
- as it thinks you mean
-
- perl -le 'print @ARGV' <"Wimp$Scrap" >
-
- and tries to open the (illegaly named) Wimp$Scrap for input redirection. This
- causes problems with programs such as !Netplex. Try changing the lines
- with set Alias$@RunType_102 in !Boot and !Run, replacing "perl" with "do perl".
- "do" is supplied with RiscPCs, and expands the variables before perl runs.
- Strictly UnixLib is doing nothing wrong. Due to popular demand UnixLib will
- probably be improved to guess when OS variables are wanted.
-
- (consider perl somescript <Foo>Bar - redirect from Foo to Bar, or use the OS
- variable Foo to make a filename to put in @ARGV? There are ambiguous cases)
-
- Anyway, back to the regular diatribe:
-
- NO WARRANTY
-
- BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
- FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
- OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
- PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
- OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
- TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
- PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
- REPAIR OR CORRECTION.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
- REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
- INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
- OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
- TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
- YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
- PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGES.
-
-
-
- Perl is a language optimized for scanning arbitrary text files, extracting
- information from those text files, and printing reports based on that
- information. It's also a good language for many system management tasks.
- The language is intended to be practical (easy to use, efficient, complete)
- rather than beautiful (tiny, elegant, minimal).
-
- This !Perl application contains a perl binary with statically linked
- extensions (including socket support), standard perl libraries (providing
- many useful functions), and some RISC OS libraries providing RISC OS
- specific functions and perl-like interfaces to RISC OS system calls. The
- convention used throughout the scripts, modules and regression tests is that
- if a file is unmodified from the Unix source distribution is set filetyped
- text, whereas if a file needed any modification it is filetyped perl (102).
-
- When first seen by the filer !Perl will set an icon for perl files, initialise
- some variables needed by the perl binary, add the directory containing the
- perl binary to your Run$Path, and set a run-type for perl files so that
- double-clicking will run perl.
-
- Running the !Perl application will also open the scripts directory and set
- the WimpSlot "next" to 1024K. BEWARE - this still may not be enough memory for
- some scripts.
-
- You may wish to copy the perl binary to a library directory where you keep
- other command line programs (such as compilers). If so, you should ensure
- that the actions performed by the !Boot file inside !Perl occur when you
- start your machine, so that perl can find its libraries. This can be done by
- placing !Perl in the !Boot.Choices.Boot.Tasks directory on a Risc PC, or by
- placing !Perl in a directory that is "seen" when your machine starts (ie a
- directory where you keep your common applications).
-
- Probably the three most powerful features of core perl are:
- * its regular expressions for pattern matching.
- * its ability to cope with arbitary length strings.
- * its associative arrays (hashes) which allow data to be stored by
- key/value pairs.
-
- In addition, probably the four most useful features of the RISC OS port are
- * filename globbing.
- * *command/program output capture.
- * full access to all SWIs - passing data to and from perl.
- * the DrawFile manipulation library.
-
-
- The scripts directory contains many useful scripts which demonstrate how to
- use perl, and how some of the RISC OS specific functions work.
-
- Some of the most useful are:
- grep find strings (patterns in files) - coupled with optional
- throwback and files specified by recursive globs allows
- entire source trees to be searched. Very powerful.
- finger finger in perl - how to write portable socket code.
- (This script will run unmodified on Unix)
- SetType+ settype multiple files specified by wildcards.
- rename Larry Wall's clasic rename script, which allows files to
- be renamed using a perl expression to generate the new
- name from the old.
- drawfile 10 line script to demonstrate manipulating DrawFiles
- (Try changining all instances of 'Homerton.Medium' to
- 'Sassoon.Primary' in multiple drawfiles within nested
- groups using some other system...)
-
- If you have used a previous perl port....
-
- Globbing improved
- 1: * and # can be used in all directory names, not just the final
- leafname
- 2: .. matches any number of directories, so @..* matches all files
- in the current directory and all subdirectories
- 3: path variables are searched (recursively) - path variables in the
- returned list of filenames can either be left in place or
- expanded fully. (see the library documentation for RISCOS::File)
-
- Program output capture more reliable
- Perl will capture program output without needing an internal lookup
- table of what to treat as a *command
-
- SWIs can now be called by name or number
- Pass a number and it will be recognised as such - bypassing the long
- overhead of the SWI name lookup
-
- Almost all perl modules work
- Bigint, Complex, File::Copy, ...
- Many extensions work (eg Socket IO Fcntl)
- All regression tests that the Config.pm say should pass do!
-
-
- *IF YOU HAVE USED A PREVIOUS PERL PORT* note that this perl defaults to
- "Unix style" filenames. (consistent with perl ports to other OSes)
- To *TURN OFF* automatic filename conversion
-
- use RISCOS::Filespec;
-
- at the start of your script (or invoke perl as perl -MRISCOS::Filespec)
-
-
- -------------------------------Hints and Tips-------------------------------
-
- The modules supplied with perl provide a large amount of common
- functionality, portable across many platforms. *Not* investigating and using
- the supplied modules is about as wise as not using the ANSI C library.
-
- For example, to expand all the tabs in an array of lines of text:
-
- use Text::Tabs;
- @lines_without_tabs = expand(@lines_with_tabs);
-
-
- If you want to copy anything:
- use File::Copy;
- copy <from> <to>
- or
- use RISCOS::File 'copy';
- copy <from> <to> [<flags>]
-
- in preference to *copy or calling OS_FSControl 26.
-
- Flags default to 0 [*], and are as for OS_FSControl 26 *except* that bit 13
- is toggled. This means that *by default* an appropriately sized user buffer
- is provided internally, avoiding problems copying to/from archives.
- [Appropriately sized is currently implemented as min( <filesize>, 128K ) ]
- * If flags are not supplied then force is turned on unless the target is
- locked. This means that you can copy over a destination file automatically.
-
- If you want the Internet hostname:
- use Sys::hostname;
- $name = hostname();
-
- as it automatically tries all known methods to get this information.
- [See Unixlib's unix.c.gethostname for the implementation]
-
-
- Beware of full pathnames:
-
- "ADFS::Bagpuss.$.!Boot" ne 'ADFS::Bagpuss.$.!Boot'
-
- because $. is a variable that gets interpolated.
-
- However even if you are careful and go:
-
- $somevar = 'ADFS::Bagpuss.$.!Boot'
-
- DONT:
- $othervar =~ /^$somevar/;
-
- this **will** come unstuck because $somevar is **interpolated AGAIN** in the
- regular expression.
-
- DO:
- $othervar =~ /^\Q$somevar\E/;
-
- to stop this second interpolation! (looks like it should quote the '$').
- This won't screw up with \ in filenames, as \ is the Previously Set
- Directory, and the only character that can legally follow it is .
-
-
- Beware of <System$Variables> in filenames:
-
- DONT:
- open( FILE, $file );
-
- this will fail if $file starts "<somesystem$var>"
-
- DO:
- open( FILE, "<$file" );
-
- They also confuse the parser in globs, and the $ will get interpolated
-
- DONT:
- <<Obey$Dir>.*>
-
- DO:
- < <Obey\$Dir>.*>
-
-
- ----------------------------------------------------------------------------
-
- Perl may be copied subject to the conditions of the "Artistic License"
- which you will find in the file "Artistic".
-
- The perl source code and utilities needed to remake perl from scratch are
- available from ftp://ftp.unfortu.net/pub/flirble/users/nick/P/
-
- Nicholas Clark <nick@unfortu.net>
-
- PS Now look at !Perl.scripts.drawfile
-