Solved

Passing parameters for a 'require'

Posted on 1998-08-06
5
161 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

Technology Partners: 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

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…

710 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