Choosing a Scripting Language on NetWare
Articles and Tips: article
Senior Software Engineer
Novell Applications Group
rvenkat@novell.com
01 Aug 2000
This AppNote takes a look at the scripting languages available on NetWare: Novell Script for NetWare, Perl 5, and ScriptEase, comparing the various features included in each language.
What's the Hullaballoo About Scripting?
The Net has transformed so many things in the world. Some people envision an age when software would not need to be written, when IS Managers would be able to download required components from the Net and "assemble" them to get the software of their choice. Software development is already headed in that direction, with component technologies gaining momentum.
Today, the easiest way to build software using components is to use scripting languages. Scripting languages power Web sites, spice up Web pages, and even help in proliferation of viruses! There is a whole new genre of developers working with scripting languages, because they:
are easy to learn and use
allow quick development of applications
dramatically reduce cost of development
Novell has bundled one or more scripting languages with NetWare, right from the 4.x days and delivered some others through the Novell Developer Kit (NDK). But with NetWare 5.1 being positioned as a Web server platform, it was essential to provide a choice of scripting language for the developer. So, we had Novell Script for NetWare (NSN), Perl 5 for NetWare and ScriptEase for NetWare, along with good old NetBasic.
Three Aces and a Joker
Novell Script for NetWare (NSN) is the new avatar of NetBasic, which still gets bundled with NetWare.
It is 100% VBScript compatible, with a few features of VBA also thrown in.
It allows compiled scripts for secure distribution and better performance.
It comes with a whole range of UCX (Universal Component eXtension) components, which cover NetWare services and mimic FrontPage compatible server-side ActiveX controls, among other things.
Perl 5 for NetWare is the port of the leading CGI scripting language.
It is the port of the 5.003 version, with the 5.(00)6 version slated to follow soon.
It includes all standard modules, including DBI.
ScriptEase for NetWare is the JavaScript clone from Nombas Inc.
It is 100% ECMAScript compliant. It is also based on C script.
It includes a set of extensions and utility libraries, including C kind of functions.
It has a unique remote debugging facility.
Universal Component System (UCS) is the glue that binds these scripting languages with the world of components, which includes Java classes and Beans, ActiveX controls and UCX components. UCS extends the freedom of the script developer to a choice of components too. For more details, refer to the NDK page on UCS (http://developer.novell.com/ndk/ucs.htm).
Clash of the Titans
It was not a pleasant situation when the only option to develop on NetWare was NLM programming, using C/C++. But now, when a range of scripting languages is available, there is room for confusion. This section attempts to clear up the confusion.
Before we analyze point-by-point, take a look at the comparison table below.
NSN
|
Perl
|
SE
|
|
CGI |
Yes |
Yes |
Yes |
Shell |
Yes |
No |
Yes |
Server Console |
Yes |
YesYes |
Yes |
Support Modules |
Native UCX components covering NetWare services, Web publishing services and others |
Standard modules covering a variety of utility functions |
Libraries and extensions covering basic utility functions |
Debugger |
Built-in server-based debugger |
Built-in server-based debugger |
Remote debugger |
Directory Access |
Yes - NWDir UCX component |
Yes - NWDir UCX component or JavaBean |
Yes - NWDir UCX component or JavaBean |
Database Access |
Yes - NDO UCX component |
Yes - DBI module, NDO UCX component |
Yes - SEDBC extension, NDO UCX component |
Works with ASP? |
Yes - default language of NSP |
Partially - does not support ASP components |
Partially - does not support ASP components |
HTML Support |
Yes - Document UCX component |
Yes - CGI module |
Yes - tinyhtml.jsh |
Compiler |
Yes - uses a project file |
No |
Yes - straightforward |
String Matching |
Primitive built-in functions |
Powerful built-in regular expression syntax |
RegExp extension |
Objects |
No |
Yes |
Yes |
C/C++/Java interfacing |
Yes - can call into NLMs |
Yes - can access C/C++ libraries using SWIG; also can be embedded into C/C++/Java programs |
Yes - can call into NLMs using built-in objects |
Open Source |
No |
Yes |
No |
Target Users |
5 million VB users |
1million Perl users |
JavaScript users - estimates not available |
Interfaces
The basic features of all the languages are more or less the same, with CGI, shell, and console-based interfaces. Perl does not have a shell, which is the case on other platforms too. So, Perl programmers would not feel particularly handicapped.
Support Modules
NSN has the clear edge here since all NetWare services are wrapped up as UCX components. So, NSN is probably the easy way to go if you are interested in programming on NetWare. There is another set of components which mimic FrontPage compatible ActiveX server-side controls like Ad Rotator and Page Counter.
Perl includes a wide variety of utility modules ranging from Socket to Math.
ScriptEase scores with C kind of functions like printf and getch.
Debugger
While NSN and Perl have a built-in debugger, ScriptEase provides a client- based debugger, the obvious advantage of which is debugging scripts on remote servers.
NSN is still better than Perl, since it gives a window-based interface.
Directory and Database Access
NDS is one of Novell's key products and a lot of people are interested in programming to it. Scripting simplifies this task by allowing use of the NWDir UCX component (as shown in the code snippets below) or the NWDir JavaBean. Similarly, there is the NDO UCX component for accessing databases. NSN has the advantage of having UCX components as native, whereas the other languages have to use it through UCS. For database, however, Perl and ScriptEase have their own arrangements.
NSN
Set Nds1 = CreateObject("UCX:NWDIR") Nds1.Login("admin", "novell") Print ("Full Name: " Nds1.Fullname) Set Entries = Nds1.Entries Print ("Entry List:") Entries.Reset () While (Entries.Hasmoreelements()) Set Entry = entries.Next() Print (Entry.ShortName) WEnd Nds1.Logout ()
Perl
use UCSExt; $nds1 = UCSExt- new("UCX:NWDIR"); $nds1- login("username","password"); $fullname = $nds1- {"fullname"}; print "Full Name: $fullname \n"; $entries = $nds1- {"entries"}; print "Entry List:\n"; $entries- reset();while($entries- hasMoreElements()) { $entry = $entries- next(); print $entry- {"shortName"} . "\n"; } $nds1- logout();
ScriptEase
#link "ucsjs" var nds1 = CreateObject("UCX:NWDIR"); nds1.login("username", "password"); Clib.printf("Full Name: %s\n",nds1.fullname); var entries = nds1.entries Clib.printf("Entry List:\n"); entries.reset(); while(entries.hasmoreelements()) { var Entry = entries.Next(); Clib.printf("%s\n",Entry.ShortName); } nds1.logout()
ASP
Active Server Pages (ASP) technology from Microsoft has carved its own niche in the server-side scripting arena. Novell provides Novell Script Pages (NSP) which clones ASP. Since NSN is VBScript compatible, it is natural that NSN is the default language of NSP. Perl and ScriptEase do not have the luxury of the built-in ASP components like Server, Request, and Response; but can still be used with NSP.
HTML Support
All the languages provide some form of HTML support. Perl has a very mature implementation, but the same cannot be said about the other two.
Compiler
NSN and ScriptEase provide a pseudo-compiler, which converts scripts into a binary form, but require the respective interpreters for execution. The advantage is a preservation of source code and slightly quicker execution. But compiling NSN scripts is a bit cumbersome involving project files, whereas it is straightforward in ScriptEase.
String Matching
If we consider each aspect of our analysis as an award, this one has been instituted just so that we can give it away to Perl! Perl's powerful regular expresion syntax beats all the rest hands down. ScriptEase tries to make up with a RegExp object, while NSN is content with basic functions.
Objects
ScriptEase and Perl follow today's norm of providing for the object paradigm, but the former's implementation is a bit cumbersome. NSN does not support objects by itself, although UCX components are instantiated as objects.
C / C++ / Java Interfacing
NSN requires a small declaration indicating which function and which NLM you would access.
Perl provides SWIG to access C/C++ libraries. It can also be embedded into C/C++ and Java programs and compiled.
ScriptEase also permits calling into NLMs using the Nlm.link built-in function.
Target Users
NSN aims to tap into the 5 million strong pool of Visual Basic / VBScript programmers.
Perl is provided on NetWare to attract the 1 million strong community, most of whom are in Unix environments.
ScriptEase is for the unestimated millions of JavaScript programmers, mostly on the client-side.
Speed
Perl is reportedly the fastest on NetWare. ScriptEase follows close behind.
Peace
This analysis shows that no particular language stands apart from the rest. Each of them has its own advantages and disadvantages.
If you are a JavaScript fan, you'll be inclined to use ScriptEase. If you're moving from NT onto NetWare, NSN would be the best bet. If you feel that Perl is "practical rather than beautiful," you might want to stick to it.
No matter which scripting language you choose on NetWare, you get more or less the same features. But some language might be more suitable for a particular kind of application. Ultimately, it boils down to your preferred scripting language and the nature of your application.
Clever of me to throw the ball back into your court, eh?
References
Here are some references for further information:
Perl Mongers
Microsoft Scripting Technologies
Web Developer's Virtual Library
ScriptEase Desktop Edition
ScriptEase Web Server Edition
* Originally published in Novell AppNotes
Disclaimer
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.