package MyFrndJk; ## save as MyFrndJk.pm (so its a module) use strict; use warnings; use autodie; ## error checking for open/close... our $VERSION = 0.01; sub create { my( $xpathConfig, $input, $urlCompetitors, $dirCompetitors, $dirToList ) = @_; use autodie qw/ open close opendir closedir /; ## specific my $config = getConfig( $xpathConfig ); open my( $infh ), '<', $input; ## or die by autodie open $firstHtmlOut, '>', $urlCompetitors; while( my $url = <$infh> ) { $url =~ s/\s+$//; ## CHOMP my $competitor = domain_check( $config, $url ); print $firstHtmlOut "$competitor.html\n"; } close $infh; close $firstHtmlOut; open my( $compfh ), '>', $competitorsHtml; opendir my( $dir ), '<', $dirToList; my @files = grep /\.html$/, readdir $dir; closedir $dir; for my $file ( @files ) { print $comfh "$file\n"; } close $compfh; } ## end sub create ## fully quaified name of this subroutine in module MyFrndJk sub MyFrndJk::CompareMyLists { ...; } ## end sub MyFrndJk::CompareMyLists sub MyFrndJk::difference { my( %args ) = @_; ## code what used to be 'C:/Users/jeyakuma/Desktop/perl/tescm.pl'; } ## end sub MyFrndJk::difference sub MyFrndJk::getConfig { my( $confFile ) = @_; my $s = Safe->new; $s->permit_only( "anonlist", "anonhash", "pushmark", "const", "undef", "list", "lineseq", "padany", "leaveeval", # needed for Safe to operate, is safe without entereval ); return $s->reval( $confFile ); } ## end sub MyFrndJk::getConfig 1; ## all modules end with this 1