-1

I have Debian 6.

I want install script PHP with perl demon. I install perl etc.

apt-get install perl build-essential

In demon.pl I have lines:

use Frontier::Daemon::Forking;

use Crypt::XXTEA;

use Cfg::Config; Blockquote use Unix::PasswdFile;

use MIME::Base64;

use File::Find;

use File::Slurp;

use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmove dirmove pathempty pathrmdir);

I found, that I must open:

perl -MCPAN -e shell

and install

install Frontier::Daemon::Forking

install Crypt::XXTEA

install Cfg::Config

install Unix::PasswdFile

install MIME::Base64

install File::Find

install File::Slurp

install File::Copy::Recursive

With all is ok without Cfg::Config, I have error:

    Warning: Cannot install Cfg::Config, don't know what it is.
Try the command

    i /Cfg::Config/

to find objects with matching identifiers.
CPAN: Time::HiRes loaded ok (v1.9719)

On end I try run demon.pl but have errors

./demon.pl: line 1: use: command not found
: command not found
./demon.pl: line 2: use: command not found
: command not found
./demon.pl: line 3: use: command not found
: command not found
./demon.pl: line 4: use: command not found
: command not found
./demon.pl: line 5: use: command not found
: command not found
./demon.pl: line 6: use: command not found
: command not found
./demon.pl: line 7: use: command not found
: command not found
./demon.pl: line 8: syntax error near unexpected token `('
./demon.pl: line 8: `use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmov' dirmove pathempty pathrmdir);
brian d foy
  • 129,424
  • 31
  • 207
  • 592
Piotr
  • 1
  • The `demon.pl` error messages come from the shell, as if `bash` is trying to interpret your Perl script. Run it as `perl demon.pl`, or make sure your script starts with a proper `#!/path/to/perl` line. – mob Aug 10 '12 at 23:33

2 Answers2

1

Cfg::Config cannot be installed from CPAN because there is no such module on CPAN.

ikegami
  • 367,544
  • 15
  • 269
  • 518
1

I suspect that Cfg::Config module is something that comes from somewhere outside of CPAN. That might be something that should come with demon.pl.

The other errors you see come from the shell. You're calling it like this:

 % ./demon.pl

The shell tries to execute that file as a program. It sees that it's a text file, so it looks at the first two bytes to see if they are #!. If so, it uses the path after #! as the intrepreter that will handle the text. This line is called the "shebang line". In a Perl program, it often looks something like:

 #!/usr/bin/perl

You only need that line if you want to make the shell figure out what to do with the file. You can specify that you want to use perl:

% perl demon.pl

Since you're trying to figure out if your Perl program is working and has all the modules it needs, you might try a syntax check:

% perl -c demon.pl

If you want to add the shebang line, you should find our where your perl is:

% which perl
/usr/bin/perl

Take that path and construct your shebang and put it at the top of your Perl program:

#!/usr/bin/perl
... # rest of program
brian d foy
  • 129,424
  • 31
  • 207
  • 592