Solved

Passing parameters for a 'require'

Posted on 1998-08-06
5
157 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
Comment Utility
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
Comment Utility
Edited text of question
0
 

Author Comment

by:tenetor
Comment Utility
Edited text of question
0
 
LVL 5

Accepted Solution

by:
b2pi earned 50 total points
Comment Utility
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
Comment Utility
Did this work? (It's considered polite to grade or re-open questions that have been answered)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 …
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

743 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now