Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


September 1998

Inside the New Perl Resource Kit


RSS
Subscribe to Windows IT Pro | See More Resource Kit Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Download the Code Here

After creating objPerlCOM, the script creates a new scalar variable (sProperty) and initializes it with the string to the right of the assignment operator (=). You must enclose the Perl code that you want to pass to EvalScript in double quotes. The script then uses the standard VBScript MsgBox function and dot notation to access and display the property's value.

The code at B uses EvalScript to define the Perl subroutine, vbsBackTicks. This subroutine becomes the method that executes the external command and returns the command's standard output as a string. You must enclose the Perl code that you pass to EvalScript in double quotes. When the code spans several lines, you must use VBScript's line continuation character (_) and string concatenation character (&) to ensure that the script passes the entire subroutine to EvalScript as one string.

Like sProperty, the vbsBackTicks subroutine is basic Perl code. The subroutine begins by initializing the two local scalars, $command and $delimiter. (When the script later invokes vbsBackTicks, the script passes these values to the subroutine.) The next line of the subroutine executes the user-defined command using Perl's backtick operator (`) and assigns the command's output to the @output array. The subroutine's last line uses Perl's join operator and the user-defined delimiter to translate the array into a string and return the string to the calling object.

The next line in the script calls the vbsBackTicks method and passes the desired command ("net use") and delimiter ("@") to the vbsBackTicks method. The variable sOutput stores the value vbsBackTicks returns. The script uses VBScript's MsgBox function to display the output. The last line in the script uses VBScript's Nothing keyword to destroy the objPerlCOM object before the script ends.

After you run the BackTicks.vbs script, you will see the message boxes in Screen 2 and Screen 3. But PerlCOM's magic doesn't end here. You can use PerlCOM to create instances of Perl modules. With PerlCOM, you can extend Perl modules to any COM programming environment. For example, WSH doesn't provide a mechanism to read from or write to NT's event logs. You can use PerlCOM to create an instance of the Win32::EventLog module, making its functions available to WSH.

Extensive Documentation
The Perl resource kit features four volumes of documentation, totaling more than 1500 pages. Whether you're a novice or expert Perl programmer, you'll find the information in the four volumes of documentation useful.

The first volume is the Perl Utilities Guide, which covers the Perl Resource Kit's installation and setup, Perl language basics, and Perl programming for Web servers (including information specific to all major Web server platforms). This volume also contains the documentation for all the software included in the kit. The second module is Programming with Perl Modules, which teaches you how to leverage the hundreds of reusable Perl modules available from the Comprehensive Perl Archive Network (CPAN) at http://www.perl.com/CPAN. Programming with Perl Modules also teaches you how to create modules. The third and fourth modules constitute the Perl Module Reference. This two-volume set includes a comprehensive module index from which you can easily locate detailed module descriptions and usage instructions for hundreds of Perl modules.

A Significant Event
If you wrote BASIC programs in the late 1980s, you'll probably agree that what Microsoft has done to evolve the BASIC language is remarkable. You can say the same for what O'Reilly, ActiveState, and the Perl developer community have done for Perl. With a common code base in Perl 5.005, new utilities, new tools, and extensive documentation, Perl clearly becomes the most comprehensive scripting environment available for the Win32 platform.

You can purchase Perl Resource Kit--Win32 Edition from many retail bookstores. You can also purchase it online from O'Reilly & Associates (http://www.ora.com) and various online bookstores.

End of Article

   Previous  1  [2]  Next  


Reader Comments
tyytrytrytr

Anonymous User November 10, 2004


You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Top Viewed ArticlesView all articles
WinInfo Short Takes: Week of November 23, 2009

An often irreverent look at some of the week's other news, including some post-PDC some soul searching, a Google Chrome OS announcement and a Microsoft response, Windows 7 off to a supposedly strong start, the Jonas Brothers and Xbox 360, and so much more ...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

2009 Windows IT Pro Editors' Best and Community Choice Awards

Picking a favorite product from an impressive crowd of competitive offerings is never an easy task, and such was the case with our Editors' Best and Community Choice awards this year. ...


Related Articles Perl COM Objects

Task Automation Whitepapers From Development to Production: Streamlining SharePoint Deployment with DocAve Deployment Manager

Related Events Deep Dive into Windows Server 2008 R2 presented by John Savill

Check out our list of Free Email Newsletters!

Task Automation eBooks Spam Fighting and Email Security for the 21st Century

A Guide to Windows Certification and Public Keys

Keeping Your Business Safe from Attack: Patch Management

Related Task Automation Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2009 Penton Media, Inc. Terms of Use | Privacy Statement