1

I'm looking for the exact way to implement the SDL environment variable from a perl script that is the front end for launching a dosbox BBS.

I have the right approach from this link: running-dosbox-completely-headless

I'm just not sure how to implement it from inside the perl script.

export SDL_VIDEODRIVER=dummy

I'm launching dosbox with this script: telnetbbs-0.5

Here's the header. I assume it would need to go somewhere just before or after the first section.

#!/usr/bin/perl -wT
BEGIN {
        delete @ENV{qw(IFS CDPATH ENV BASH_ENV PATH)};
        $ENV{PATH} = "/bin:/usr/bin";
        $|++;
#        $SIG{__DIE__} = sub { require Carp; Carp::confess(@_); }
      }

I assumed I could manually edit the beginning of the script to set the variable, but that's where I'm stuck.

I have tried adding

$sdl = "export SDL_VIDEODRIVER=dummy";
system($sdl);

Maybe that is the right syntax for running a command from a perl script, but not the way to set the SDL environment variable.

I get the error "Can't exec export": No such file or directory at ./telnetbbs.pl "

I don't want to change SDL globally, just when the script is executed, as I might want to launch the BBS locally, as my pi is connected to a monitor and keyboard. I just don't want it to tie up a user desktop session. In the end I want to create a separate user and have that execute the script and launch dosbox upon connection, with the ability to log on as other users at the same time.

Any help would be greatly appreciated.

  • I don’t know Perl, but the $ENV{PATH} = "/bin:/usr/bin"; statement seems to be setting the PATH environment variable. You probably need to do something like that. – G-Man Aug 1 at 16:22
0

I glanced through the Perl script. It seems to me you should edit this part of the config file, not the Perl script:

##
## This is the command that will launch dosbox and pass it the configuration
## file.  You can add custom dosbox options to the command line below.
##
bbs_cmd = DISPLAY=__DISPLAY__  /usr/bin/dosbox -conf 

Add the environment variable alongside DISPLAY:

bbs_cmd = DISPLAY=__DISPLAY__ SDL_VIDEODRIVER=dummy /usr/bin/dosbox -conf 

This ensures the environment variable is tied to DOSBox. Since you only need it for that single command, there's no need to export it in the Perl code.

  • That doesn't seem to work, the window still opens. Could I get some tips on how to set SDL globally or in the Perl script to see if maybe the command line is not setting it properly? – Stettin Aug 2 at 3:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.