10 More Discussions You Might Find Interesting
1. OS X (Apple)
Hi guys and gals...
After much searching on the good ol' internet I could find nothing, so this is the result.
ALthough many people seem to have asked this question no-one seems to have a solution so here we go.
I need for AudioScope.sh, 'xterm' to run a second program for some of its... (2 Replies)
Discussion started by: wisecracker
2 Replies
2. BSD
Just wondering -- is there a way to play a song in iTunes from the terminal app? (1 Reply)
Discussion started by: Straitsfan
1 Replies
3. Ubuntu
Hi,
I would like to ask if someone knows or accomplished this task in the terminal multiplexer in a single window with multiple splitted pane:
In the script run multiple command at the same time in diff splitted pane or simulatneously.
As an example: I would like to run iptraf, iotop, htop,... (2 Replies)
Discussion started by: jao_madn
2 Replies
4. UNIX for Dummies Questions & Answers
Hey, I am trying to write a script that will open all of my session windows, and then secure shell into the appropriate server in the new windows. Seems simple, but I cant get it to work! Please help! :confused: (1 Reply)
Discussion started by: sojo1024
1 Replies
5. OS X (Apple)
Dear All,
Anyone knows how to start a new bash terminal from command line?
Another question: when I use "open" command (open test.pdf) to open a pdf file, the PDF reader will start up, but cannot associate with that file. Anyone knows why? (1 Reply)
Discussion started by: andrewust
1 Replies
6. UNIX Desktop Questions & Answers
Hi All,
I work on a Linux platform which runs Red Hat (forget which version) and use both korn and bash shells. Is there a way of making the command line appear at the top of the terminal window and any lists, commands or directory names etc to appear below the top, that is to say reverse the... (1 Reply)
Discussion started by: ray_m
1 Replies
7. Shell Programming and Scripting
Hello,
I am trying to learn how to pass something more than a one-command startup for gnome-terminal.
I will give an example of what I'm trying to do here:
#! /bin/bash
#
#TODO write this for gnome and xterm
USAGE="
______________________________________________
${0##*/}
run... (0 Replies)
Discussion started by: Narnie
0 Replies
8. OS X (Apple)
Under Leopard, I like to conveniently open Terminal windows onto remote systems. I've created several settings files in Terminal, one for each remote system that I want to access. To open window, I right-click on the Terminal icon in the Dock, expand the "New Window" menu item, and select the... (0 Replies)
Discussion started by: siemsen
0 Replies
9. Shell Programming and Scripting
i am having a weird error on mac os x running some shell scripts. i am a complete newbie at this and this question concerns 2 scripts. one of which a friend of mine wrote (videochecker.sh) a couple weeks ago and it's been running fine on another machine.
then last week i wrote capture.sh and it... (2 Replies)
Discussion started by: danpaluska
2 Replies
10. Windows & DOS: Issues & Discussions
Hi.
I was, not too long ago, an OS X home user. One of the things I remember from using the Apple-installed Terminal is: whenever an executable that took more than a split second to do its thing was running, its name would appear in the title bar in a way similar to "Terminal: ssh" or "Terminal:... (0 Replies)
Discussion started by: SilversleevesX
0 Replies
Plack::Builder(3pm) User Contributed Perl Documentation Plack::Builder(3pm)
NAME
Plack::Builder - OO and DSL to enable Plack Middlewares
SYNOPSIS
# in .psgi
use Plack::Builder;
my $app = sub { ... };
builder {
enable "Deflater";
enable "Session", store => "File";
enable "Debug", panels => [ qw(DBITrace Memory Timer) ];
enable "+My::Plack::Middleware";
$app;
};
# use URLMap
builder {
mount "/foo" => builder {
enable "Foo";
$app;
};
mount "/bar" => $app2;
mount "http://example.com/" => builder { $app3 };
};
# using OO interface
my $builder = Plack::Builder->new();
$builder->add_middleware('Foo', opt => 1);
$app = $builder->mount('/app' => $app);
$app = $builder->to_app($app);
DESCRIPTION
Plack::Builder gives you a quick domain specific language (DSL) to wrap your application with Plack::Middleware subclasses. The middleware
you're trying to use should use Plack::Middleware as a base class to use this DSL, inspired by Rack::Builder.
Whenever you call "enable" on any middleware, the middleware app is pushed to the stack inside the builder, and then reversed when it
actually creates a wrapped application handler. "Plack::Middleware::" is added as a prefix by default. So:
builder {
enable "Foo";
enable "Bar", opt => "val";
$app;
};
is syntactically equal to:
$app = Plack::Middleware::Bar->wrap($app, opt => "val");
$app = Plack::Middleware::Foo->wrap($app);
In other words, you're supposed to "enable" middleware from outer to inner.
INLINE MIDDLEWARE
Plack::Builder allows you to code middleware inline using a nested code reference.
If the first argument to "enable" is a code reference, it will be passed an $app and is supposed to return another code reference which is
PSGI application that consumes $env in runtime. So:
builder {
enable sub {
my $app = shift;
sub {
my $env = shift;
# do preprocessing
my $res = $app->($env);
# do postprocessing
return $res;
};
};
$app;
};
is equal to:
my $mw = sub {
my $app = shift;
sub { my $env = shift; $app->($env) };
};
$app = $mw->($app);
URLMap support
Plack::Builder has a native support for Plack::App::URLMap with "mount" method.
use Plack::Builder;
my $app = builder {
mount "/foo" => $app1;
mount "/bar" => builder {
enable "Foo";
$app2;
};
};
See Plack::App::URLMap's "map" method to see what they mean. With builder you can't use "map" as a DSL, for the obvious reason :)
NOTE: Once you use "mount" in your builder code, you have to use "mount" for all the paths, including the root path ("/"). You can't have
the default app in the last line of "builder" like:
my $app = sub {
my $env = shift;
...
};
builder {
mount "/foo" => sub { ... };
$app; # THIS DOESN'T WORK
};
You'll get warnings saying that your mount configuration will be ignored. Instead you should use "mount "/" => ..." in the last line to set
the default fallback app.
builder {
mount "/foo" => sub { ... };
mount "/" => $app;
}
Note that the "builder" DSL returns a whole new PSGI application, which means
o "builder { ... }" should normally the last statement of a ".psgi" file, because the return value of "builder" is the application that
actually is executed.
o You can nest your "builder" block, mixed with "mount" (see URLMap support above):
builder {
mount "/foo" => builder {
mount "/bar" => $app;
}
}
will locate the $app under "/foo/bar" since the inner "builder" block puts it under "/bar" and it results a new PSGI application which
is located under "/foo" because of the outer "builder" block.
CONDITIONAL MIDDLEWARE SUPPORT
You can use "enable_if" to conditionally enable middleware based on the runtime environment. See Plack::Middleware::Conditional for
details.
SEE ALSO
Plack::Middleware Plack::App::URLMap Plack::Middleware::Conditional
perl v5.14.2 2012-05-17 Plack::Builder(3pm)