05-21-2010
Hi,
thanks anchal_khare.It works as expected.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello ,
I am trying to print the footer of evry file in the given directory with xargs command like follows
ls -1 | xargs -I {} gzcat {} | tail -1
now problem with this is only last file foooter is getting printed as " | tail -1 " is getting executed for the last file.
I know this can... (4 Replies)
Discussion started by: nilesrex
4 Replies
2. Shell Programming and Scripting
Execute some commands in script and store result in excel sheet
Kindly help me........... (1 Reply)
Discussion started by: Computer_baby
1 Replies
3. UNIX for Advanced & Expert Users
Hi ,
I have a situation i need to write a while loop until the end of control file.In the control file i have a 5 lines which contains commands.how can i execute all with out waiting for the first one to complete.
Ex ControlFile:
ScripitName Test
ScriptName Test1
ScriptName Test2
... (1 Reply)
Discussion started by: ukatru
1 Replies
4. Shell Programming and Scripting
Hi guys,
I am new to AWK and unix scripting. Please see below my problem and let me know if anyone you can help.
I have 2 input files (example given below)
Input file 2 is a standard file (it will not change) and we have to get the name (second column after comma) from it and append it... (5 Replies)
Discussion started by: sksahu
5 Replies
5. Shell Programming and Scripting
Please help with this simple example. I can not figure out how to do it. A file named “job” contains only this one line:var=5I need a script to read the job file and execute it as a command. This is my attempt (it does not work):#!/bin/sh
exec < job
echo "var = $var"output should read “var = 5”... (5 Replies)
Discussion started by: wolfv
5 Replies
6. Shell Programming and Scripting
hye there...
i have a problem to copy file in specific folder
that will change the name according to
host,time(%m%s) and date(%Y%M%D)
example folder name:
host_20100531.154101801
this folder name will always change...
but i just want to copy the AAA.txt and BBB.txt file..
really need... (17 Replies)
Discussion started by: annetote
17 Replies
7. UNIX for Dummies Questions & Answers
Hi all,
I have a command I need to run on a large number of folders. It needs only one input, namely one of the 150 files in the folder (doesn't matter which one):
command filenameThe problem is that the names of the files are random, so I was trying to just get the first file by using list and... (5 Replies)
Discussion started by: Linnnnn
5 Replies
8. Shell Programming and Scripting
I made a configuration file for my shell script in that all the values that the shell scipt needs, are defined, but I don't know how to let the shell script use those defined variables.
Thank you for your help :) (3 Replies)
Discussion started by: Alkali
3 Replies
9. Shell Programming and Scripting
Hi,
I am using solaris 10 and bash shell.Script execution follows below.Initially it will check whether a directory exists or not if does not exist it will create it.(This I have completed)
Second step:I have four users say user1,user2,user3,user4.Script should prompt for the user id and... (11 Replies)
Discussion started by: muraliinfy04
11 Replies
10. Shell Programming and Scripting
hi,
is there a way i can execute a batch file containing ftp commands like we execute sftp batch file.
sftp -b batchfile user@server > output
how to create a batch file for ftp executing command and how to run the batch file from a shell script? (2 Replies)
Discussion started by: Little
2 Replies
LEARN ABOUT DEBIAN
cgi::emulate::psgi
CGI::Emulate::PSGI(3pm) User Contributed Perl Documentation CGI::Emulate::PSGI(3pm)
NAME
CGI::Emulate::PSGI - PSGI adapter for CGI
SYNOPSIS
my $app = CGI::Emulate::PSGI->handler(sub {
# Existing CGI code
});
DESCRIPTION
This module allows an application designed for the CGI environment to run in a PSGI environment, and thus on any of the backends that PSGI
supports.
It works by translating the environment provided by the PSGI specification to one expected by the CGI specification. Likewise, it captures
output as it would be prepared for the CGI standard, and translates it to the format expected for the PSGI standard using CGI::Parse::PSGI
module.
CGI.pm
If your application uses CGI, be sure to cleanup the global variables in the handler loop yourself, so:
my $app = CGI::Emulate::PSGI->handler(sub {
use CGI;
CGI::initialize_globals();
my $q = CGI->new;
# ...
});
Otherwise previous request variables will be reused in the new requests.
Alternatively, you can install and use CGI::Compile from CPAN and compiles your existing CGI scripts into a sub that is perfectly ready to
be converted to PSGI application using this module.
my $sub = CGI::Compile->compile("/path/to/script.cgi");
my $app = CGI::Emulate::PSGI->handler($sub);
This will take care of assigning an unique namespace for each script etc. See CGI::Compile for details.
You can also consider using CGI::PSGI but that would require you to slightly change your code from:
my $q = CGI->new;
# ...
print $q->header, $output;
into:
use CGI::PSGI;
my $app = sub {
my $env = shift;
my $q = CGI::PSGI->new($env);
# ...
return [ $q->psgi_header, [ $output ] ];
};
See CGI::PSGI for details.
METHODS
handler
my $app = CGI::Emulate::PSGI->handler($code);
Creates a PSGI application code reference out of CGI code reference.
emulate_environment
my %env = CGI::Emulate::PSGI->emulate_environment($env);
Creates an environment hash out of PSGI environment hash. If your code or framework just needs an environment variable emulation, use
this method like:
local %ENV = (%ENV, CGI::Emulate::PSGI->emulate_environment($env));
# run your application
If you use "handler" method to create a PSGI environment hash, this is automatically called in the created application.
AUTHOR
Tokuhiro Matsuno <tokuhirom@cpan.org>
Tatsuhiko Miyagawa
COPYRIGHT AND LICENSE
Copyright (c) 2009-2010 by tokuhirom.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
SEE ALSO
PSGI CGI::Compile CGI::PSGI Plack CGI::Parse::PSGI
perl v5.14.2 2012-03-18 CGI::Emulate::PSGI(3pm)