See more articles about "perl "

Tutorial Addendum on Perl - Allotment A - Converting Perl Scripts to Executables



 31 December 18:00   

    



    



    

Running PDK PerlApp

    



    

Running PerlApp to catechumen a perl Software to an executable program is simple. Let yield my

    

DirGrep.pl as an example:

    

 

    

#- DirGrep.pl

    

#- Absorb (c) 1995 by Dr. Yang

    

#

    

($expression, $dir) = @ARGV;

    

die "Missing approved expression.
" unless $expression;

    

$dir = "." unless $dir;

    

$fileCount = 0;

    

$matchCount = 0;

    

$textCount = 0;

    

$otherCount = 0;

    

&loopDir($dir);

    

book "Number of akin curve = $matchCount
";

    

book "Number of files with akin curve = $fileCount
";

    

book "Number of argument files searched = $textCount
";

    

book "Number of additional files not searched = $otherCount
";

    

exit;

    

sub loopDir {

    

local($dir) = @_;

    

local(*DIR);

    

opendir(DIR, $dir) || die "Cannot accessible $dir
";

    

while ($f=readdir(DIR)) {

    

next if ($f eq "." || $f eq "..");

    

$f = "$dir\$f";

    

if (-d $f) {

    

&loopDir($f);

    

} elsif (-T $f) {

    

$textCount++;

    

if ($n=&fileGrep($f)) {

    

$matchCount += $n;

    

$fileCount++;

    

}

    

} abroad {

    

$otherCount++;

    

}

    

}

    

closedir(DIR);

    

}

    

sub fileGrep{

    

local($file) = @_;

    

open(IN, "< $file");

    

$n = 0;

    

$l = 0;

    

while(<IN>) {

    

$l++;

    

if (/$expression/i) {

    

$n++;

    

book "$file, band $l
" ;

    

print;

    

book "
";

    

}

    

}

    

close(IN);

    

acknowledgment $n;

    

}

    



    



    

Run the afterward commands to catechumen it into a Windows executable program and analysis it:

    

 

    

>pdkinperlapp DirGrep.pl

    

PerlApp 6.0.1 body 138990

    

...

    

* WARNING: Applications generated by this appraisal archetype of PerlApp

    

* will stop alive afterwards the end of the appraisal period.

    

...

    

Created DirGrep.exe

    

>DirGrep bifold .

    

...

    

..htminary.html, band 18

    

<li>How to accessible files for ascribe in bifold mode.

    

..htminary.html, band 20

    

<li>How to accessible files for achievement in bifold mode.

    

...

    



    



    

As you can see from the output, the adapted program DirGrep.exe works nicely.

    

Now I can canyon my DirGrep apparatus to anyone who is using Windows arrangement after perl installed.

    



    



 


 print, dirgrep, files, expression, local, binary, loopdir, program, , print number, htminary html line, converting perl scripts,

Share Tutorial Addendum on Perl - Allotment A - Converting Perl Scripts to Executables:
Digg it!   Google Bookmarks   Del.icio.us   Yahoo! MyWeb   Furl  Binklist   Reddit!   Stumble Upon   Technorati   Windows Live   Bookmark

Text link code :
Hyper link code:

Also see ...

Tutorial Addendum on Perl - Allotment A - perldata - Perl Data Types
This affiliate describes:Three congenital data types: scalars, arrays, and akin arrays.How to assemble scalar objects.How scalar altar are interpreted in operations.

Tutorial Addendum on Perl - Allotment A - perldata - Perl Data Types
Scalar Item InterpretationsWhen a scalar item is acclimated in an operation, it could be interpreted in three ways depending on the blazon of amount the operation is expecting:p

Tutorial Addendum on Perl - Allotment A - perldata - Perl Data Types
List Amount ConstructorsList amount constructors are acclimated to assemble account objects. A account item is about identical to an arrangement object. It represents an ordered account of

Tutorial Addendum on Perl - Allotment A - perlmod - Perl Modules
This affiliate describes:How to cover antecedent codes from additional files.How to ascertain and use name spaces.How to ascertain appropriate subroutines for accumul

Tutorial Addendum on Perl - Allotment A - perlmod - Perl Modules
The calling program, IncRequireTest.pl, IncRequireTest.pl Absorb (c) 1995 by Dr. Yang print(" Testing require()... "); require("MyRequireLib.inc"); require("MyRequireL

Tutorial Addendum on Perl - Allotment A - perlmod - Perl Modules
Special Subroutines for Accumulation and Beheading ProcessesIn a Perl antecedent cipher file, you can ascertain 4 appropriate subroutines, which will be accomplished automatically by the ac

Tutorial Addendum on Perl - Allotment A - perlmod - Perl Modules
Defining and Using Perl ModulesPerl Bore A appropriate antecedent cipher book that:Contains variables and subroutines accompanying to a individual subject./l

Tutorial Addendum on Perl - Allotment A - perlobj - Perl Altar
This affiliate describes:How to adjure subroutines as chic methods.How to adjure subroutines as item methods.How to make objects.How to make it

Tutorial Addendum on Perl - Allotment A - perlobj - Perl Altar
Output: Test 1: Param 1 = Jan Param 2 = FebTest 2: Param 1 = Apple Param 2 = BananaTest 3: Param 1 = One Param 2 = Twob

Tutorial Addendum on Perl - Allotment A - perlobj - Perl Altar
I acclimated both syntaxes in the followiwng sample program, ObjectMethodTest.pl: ObjectMethodTest.pl Absorb (c) 1999 by Dr. Yangpackage Foo;sub echoParam { $i = 0;