Solved

Passing parameters for a 'require'

Posted on 1998-08-06
5
162 Views
Last Modified: 2010-03-05
I'm trying to modify the Matt's BBS script. What I want to do is to convert it in a multiple BBS system. It works with a .cfg file and I guess I should create several config files pointing to each BBS subdirectory I want to create, and pass to the script the cfg file name to use from the form.
I was trying to read a hidden variable and to use that variable with the 'require' statement, but what I tried didn't work. Can you help me? How to do it?
0
Comment
Question by:tenetor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Expert Comment

by:b2pi
ID: 1209119
I think the reason that you've not gotten an answer is that the question is incomprehensible.  Perhaps you could try and ask the question again, a bit more slowly?
0
 

Author Comment

by:tenetor
ID: 1209120
Edited text of question
0
 

Author Comment

by:tenetor
ID: 1209121
Edited text of question
0
 
LVL 5

Accepted Solution

by:
b2pi earned 50 total points
ID: 1209122
I have no clue what Matt's BBS script is, but perhaps this will give you a start: (3 different files (a.pl, b.pl, and c.pl) and then some command line stuff:

#-----------------------------------------
File : a.pl
#!/usr/bin/perl
$z = $ARGV[0];
die unless defined($z) && (-f $z);
eval {require ($z);} || die "eval of $z failed: $@";
&A;
print "All done\n";
#-----------------------------------------
File :b.pl
sub A {
  print "This is b.pl\n";
}
1;
#-----------------------------------------
File: c.pl
sub A {
  print "This is c.pl\n";
}
1;
#-----------------------------------------
>a.pl b.pl
This is b.pl
All done

>a.pl c.pl
This is c.pl
All done


0
 
LVL 5

Expert Comment

by:b2pi
ID: 1209123
Did this work? (It's considered polite to grade or re-open questions that have been answered)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question