Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Passing parameters for a 'require'

Posted on 1998-08-06
5
Medium Priority
?
164 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
  • 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 100 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
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

916 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