LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-21-2017, 01:00 PM   #1
TheStr3ak5
Member
 
Registered: Feb 2016
Location: Zaragoza, Spain
Distribution: Xubuntu, Tails, etc.
Posts: 55

Rep: Reputation: 9
Problems executing perl script with inputs when executing under other perl scripts


Hi again, I where programmig perl when i needed to call a perl script from another one, the called perl script have inputs, so when I tryed with the command "do" the program were runned but without ask me a input or nothing, only ignoring the "do", ¿This problem is a limitation of "do"?¿There is a module who can place code of other script under other? If possible, i dont want to make packages with .pm, i find that way very confusing, thanks in advance!
(I add the code, i dont think it might be a error of the code, but attach information isnt bad)
Code:
#there is more code after and before, but this is the part i think is important......
elsif ($CMD eq "#Mkdir") {
		do "$SH_PATH/builtin/mkdir.pl" ;
	}
#more........
Code:
#this is mkdir.pl
use POSIX ;
use Term::ANSIColor ;
use warnings ;

print "Choose a name for the new folder, and a mask separated by a comma if you want (by omision is 0777)Ej='Folder,0475'\n";
print color('red');
print "[Mkdir]>> " ;
print color('reset') ;
my $MkdiR = <STDIN> ;
chomp $MkdiR ;
mkdir $MkdiR or die "Folder cannot be created: $!\n";
 
Old 04-21-2017, 01:18 PM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 5,356
Blog Entries: 3

Rep: Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654
You can use the system() function or else set up the other program as a perl module if the other script's functions are frequently used in other programs.

See the "Camel Book" if you have it or can buy it or borrow it. If not see

Code:
man perlfunc
 
2 members found this post helpful.
Old 04-21-2017, 02:55 PM   #3
TheStr3ak5
Member
 
Registered: Feb 2016
Location: Zaragoza, Spain
Distribution: Xubuntu, Tails, etc.
Posts: 55

Original Poster
Rep: Reputation: 9
Quote:
Originally Posted by Turbocapitalist View Post
You can use the system() function or else set up the other program as a perl module if the other script's functions are frequently used in other programs.

See the "Camel Book" if you have it or can buy it or borrow it. If not see

Code:
man perlfunc
Well, i will try to make a module with that, if i have any problem, i will come here again, thx for the help!
 
Old 04-22-2017, 01:25 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 5,356
Blog Entries: 3

Rep: Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654Reputation: 2654
Quote:
Originally Posted by TheStr3ak5 View Post
Well, i will try to make a module with that, if i have any problem, i will come here again, thx for the help!
Ok. The instructions for making your own module will be in these:

Code:
man perlmodlib
man perlmodstyle
And the full index of all things perl here:

Code:
man perl
 
Old 04-22-2017, 05:07 AM   #5
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
You can also look into using "require"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl 5.10 on RHEL 6.2: The "for" loop code is not executing within my Perl Script hcbj44 Linux - Newbie 5 01-25-2013 12:26 AM
Procmail executing perl script jjrowan Linux - General 2 01-14-2011 08:58 PM
Executing Perl Script TalkingMarble Linux - Newbie 4 08-05-2008 09:33 AM
Executing perl scripts in apache kladizkov Linux - Server 2 10-04-2006 08:35 AM
executing perl script through .forward file skverma_in Linux - Newbie 3 10-21-2004 08:24 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration