| iMatix home page | Libero home page | Libero documentation | << | < | > | >> |
Libero Version 2.32 |
Code fragments:
################# MODULE FUNCTION NAME ################# sub module_function_name { # Empty module needs no code } function private_function_name { $the_next_event = $ok_event; &\raise_exception ($error_event); }
If you have used Perl, you will appreciate the way it combines the best of all the UNIX text processing and programming tools. For example, you need only a few lines of Perl to read and parse a parameter file ('ini file') like this:
#============================================================ # Parameters for program #============================================================ [General] OutBox=outbox # Subdirectory for sent faxes [Connect] HostName=Badoit # For Telnet UserName=autofax Password=autofax [FaxDriver] PauseChar="~" # Substitute for commas [Station] Id=Station1 # Name of this local system open (INI, "autofax.ini") || die "Can't open autofax.ini: $!\n"; while (<INI>) { chop; # Remove trailing newline # [SectionName] followed by optional comment if (/^\s*\[(\w+)\]\W*(#.*)?$/) { ($section = $1) =~ tr/A-Z/a-z/; } # Keyword=Value followed by optional comment if (/^\W*(\w+)=("[^"*]"|\w+)\W*(#.*)?$/) { ($keyword = $1) =~ tr/A-Z/a-z/; ($value = $2) =~ s/"//g; # Remove any quotes $initial {$section, $keyword} = $value; } } close (INI);
Similar code in C is several pages. This applies to many aspects of Perl, so that a complex program may be only a few hundred lines long.
Perl is also fast, and works well with Libero. The 'require' statement lets me hide the generated code in a separate file.
The Perl development cycle is simple: when you change your dialog, re-run Libero. When you change the Perl program, re-run it. Hint: get your hands on the 'Programming Perl' Nutshell Handbook.
| << | <
| > | >>
| Libero's Languages | The Awk Language | The C Language | The C++ Language | The COBOL Language | The GNU Borne-Again Shell Language | The Java Language | The Microsoft Setup Basic Language | The MS Visual Basic Language | The Perl Language | The Rexx Language | The UNIX C Shell Language | The UNIX Bourne Shell Language | The UNIX Korn Shell Language | The 80x86 Assembler Language |
Copyright © 1996-97 iMatix |