Is it possible to include an AGI file in another one and call functions from it which execute as part of the AGI file it is being called from?
If yes, how to include one AGI in another?
Thank You.
Some sample code would be helpful, but I think you'll find your answer in the Asterisk::AGI documentation.
EDIT: you can include AGI files in other AGI files just as you would include any Perl file, with the require command. e.g.:
If your script is in the directory "var/lib/asterisk/agi-bin/directoryname/"
put this line in your AGI script:
require '/var/lib/asterisk/agi-bin/directoryname/yourscriptname';
Related
Unrecognized character \x90 at line..
I am getting above error while executing perlcode.exe, But when it is executed as Perl (i.e perlcode.pl) it works like a charm. And, I am surprised I haven't seen any such error in Google. Any help appreciated.
The input file is a LaTeX file which may or may not have Unicode.
Why is .pl working, but .exe is not working?
What is meant by the ERROR: Unrecognized character \x90 at line..?
Note that use utf8; is used in the Perl script.
I had this problem when I wasn't thinking straight. I had compiled the .pl file with perl2exe but was running the command
perl c:\tmp\myexe.exe
Obviously you don't need to have perl at the start - just run the exe
To change the perl code to an .exe file, you'll need to compile it. If you are saying that the pl code works allright, but the exe not, maybe that it's the issue.
One of the options is to use pp to do it. You can find it here.
its a typo mistake which has been made in a batch file while calling exe.
I have configure wamp for cgi scripts correctly but it is not running following code and giving following server error on executing.
Bad file descriptor: don't know how to spawn child process:
C:/wamp/www/New folder/hello.cgi, referer: http://localhost/New%20folder/
My active perl is installed on C:/wamp/www/perl
here is code:
#!C:\wamp\bin\perl.exe -w
print "Hello World.\n";
Windows does not pay attention to #! lines. You need to make sure that your file extension (.cgi in your case, or .pl more commonly) is associated with your perl executable in the registry.
More info:
There are two ways to run a perl program/script, one is to execute perl directly with the file name of the main program/script as a parameter:
C:\wamp\bin\perl.exe mydir\myprog.pl
Don't ever do this in the cgi directory of your web server.
The other way to execute a program is to just name the file to be run and depend on the OS's built in method to find the right program to run it.
mydir\myprog.pl
On a *nix OS, the 1st two bytes of the file are analyzed to determine what to do with it, if those two bytes are the equivalent of the ASCII string #! then the file is treated as text, & the rest of the 1st line is read with the expectation that it will contain the path to the file's interpreter.
On a Windows OS, the file extension is used to search the registry for the path to the interpreter associated with that file type.
I have a series of perl scripts that I want to run one after another on a unix system. What type of file would this be / could I reference it as in documentation? BASH, BATCH, Shell Script File?
Any help would be appreciated.
Simply put the commands you would use to run them manually in a file (say, perlScripts.sh):
#!/bin/sh
perl script1.pl
perl script2.pl
perl script3.pl
Then from the command line:
$ sh perlScripts.sh
Consider using Perl itself to run all of the scripts. If the scripts don't take command line arguments, you can simply use:
do 'script1.pl';
do 'script2.pl';
etc.
do 'file_name' basically copies the file's code into the current script and executes it. It gives each file its own scope, however, so variables won't clash.
This approach is more efficient, because it starts only one instance of the Perl interpreter. It will also avoid repeated loading of modules.
If you do need to pass arguments or capture the output, you can still do it in a Perl file with backquotes or system:
my $output = `script3.pl file1.txt`; #If the output is needed.
system("script3.pl","file1.txt"); #If the output is not needed.
This is similar to using a shell script. However, it is cross-platform compatible. It means your scripts only rely on Perl being present, and no other external programs. And it allows you to easily add functionality to the calling script.
I am very new for perl and we had very emergency requirment. I need to convert the bat file code into Perl script code. I am confused, how we add credentials in Perl.
In bat file: I have the above sample credentials
How can I change the above credentials in Perl. How to write the above credentials in Perl script.Help is very much appropriated
To execute an external command, you probably want to use the system built-in. It will not capture the output, however:
system "program", "-argument", "value", "-argument2", ...;
before using it, you should read the whole documentation and also look into exec, qx{} and open, for different nuances.
If your requirements are more complex, you should look into the IPC family of modules on CPAN.
Hey guys how to load lua cod from the command line, or lua command line??
thank you
Assuming a file x.lua in the current directory, try lua x.lua or dofile"x.lua"from the Lua prompt.
This might not be what you were asking but seems relevant to the question.
If you want to run simple code straight from command line you can do something like that:
lua -e "function hw(name) return 'hello world ' .. name end; print(hw('of sorrow'))"