From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Perl Perl Sent: 11 March 2009 16:50 To: perl-win32-users@listserv.activestate.com Subject: Calling subroutine from different file
> Dear All, > > I have coded few scripts as mentioned below. My aim is to call the files and function without using a extra > file ( call.pl as mentioned below) and with the single click. > > I have two files, > file1.pl & file2.pl > In above files, I will call the common subroutine ( say code_send() ) which is located in fun.pl . Put common functions in a module, for example, If the file CommonFunctions.pm contained the following: --------------------------------- use strict; use warnings; package CommonFunctions; use base qw{Exporter}; our @EXPORT_OK = qw{code_send}; sub code_send { print "This is code_send\n"; } 1; --------------------------------- Any scripts that want to use that function will include: --------------------------------- use CommonFunctions qw{code_send}; ... code_send(); --------------------------------- See 'perldoc perlmod' for documentation on Perl modules, and 'perldoc Exporter' on exporting symbols from modules. > > Now my task is to execute the above scripts in one click. > So I thougt to create a file by name > call.pl > here in this file I will add two system calls as below. > system("perl file1.pl"); > system("perl file2.pl"); > > I hope there is a better way to do this. If it is then please help me. I'm not sure that I understand what you are asking. Unless it is feasible to put the code from file1.pl and file2.pl into a single file, the executing them in sequence seems a reasonable thing to do. HTH -- Brian Raven ----------------------------------------------------------------------------------------------------------- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs