in reply to Not able to execute perl sub routine
To get you started, here is something that you can just cut-n-paste your code into.
The module:#!/usr/bin/perl # This is a main program... use strict; use warnings; use ZipUtilDemo; #unzipping imported by default here print "starting main program\n"; unzipping(); #call unzipping sub in module ZipUtilDemo.pm __END__ Prints: starting main program Sub unzipping called!
#!/usr/bin/perl #This is file: ZipUtilDemo.pm package ZipUtilDemo; use strict; use warnings; use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION); use Exporter; our $VERSION=1.00; our @ISA = qw(Exporter); our @EXPORT = qw( unzipping ); our @EXPORT_OK = qw( ); sub unzipping { print "Sub unzipping called!\n"; #of course real code goes here. } 1; #IMPORTANT return a true value!
|
|---|