I don't know exactly how your script is intended to work, but I wrote an example script to demonstrate traversing hierarchical menu choices. Maybe it will help (no guarantees that you can't break the script; it makes assumptions).
Hello all,
I'm developing a deployment script at work and at one point it would need to display something like this:
Which version of ADMIN would you like to deploy?
1) 1.0.0 (store1, 10 Jan 2004)
2) 1.0.1 (store1, 20 Jun 2004)
3) 1.0.2 (store1, 15 Jul 2004)
Select a version :
I know... (5 Replies)
Hi all
is menu driven by SELECT can be a dynamic ?
My requirement is that i want SELECT to be created on run time not predefine . The select should be created as per the no of
words in a file
thanks in advance
rawat (2 Replies)
I have a file that reads File (X.txt)
Contents of record 1:
rdrDESTINATION_ADDRESS (String) "91 971502573813"
rdrDESTINATION_IMSI (String) "000000000000000"
rdrORIGINATING_ADDRESS (String) "d0 movies"
rdrORIGINATING_IMSI (String) "000000000000000"
rdrTRAFFIC_EVENT_TIME... (0 Replies)
How do I assign values to reference variables?
I am assigning a variable name to --> $user_var
Then I am trying to change its underlying variable value by
$((user_var))=$user_value .. its failing,,
Please let me know if there is a way to do this dynamically..
FileA.props... (5 Replies)
I need to create a dynamic drop down menu which is populated by entries such as;
htdocs/client1/index.php
htdocs/client2/index.php
htdocs/client3/index.php
htdocs/client4/index.php
etc.
So htdocs/client*/index.php
Is this possible?
I know how to do this using normal arrays, but not... (2 Replies)
hi all i am a newbie to this
is there any examples on creating a main menu with 3 sub menu
main menu -> option a , b and c
a menu -> option 1 ,2 and 3
b menu -> option 1 ,2
c menu -> option 1 ,2
i am getting headache as my code kept getting unexpected EOF
---------- Post... (0 Replies)
Hi guys, i would like to create a program that allow user to show the information of certain thing such as network card.
I would like the menu to be dynamic, for example:
my computer system have 2 network card inserted at the moment, therefore the menu will have 2 choice for the user.
eth0... (12 Replies)
Hi!
I am looking to build dynamic menu (named: lookup.sh) that reads a pipe delimited file for input.
for example, contents of input.txt could be:
user1|srv1
user3|srv1
user4|srv1
user2|srv2
I want the menu look like:
1) get password for user1 on srv1
2) get password for user3 on... (7 Replies)
I installed CentOS 8 with Gnome 3.28.2 and I noticed that the "switch user" menu item disappeared from under the system menu of Gnome classic (Both X11 & Wayland). I checked google and this problem seems to have a history going back several releases of Gnome.
Unfortunately, I never found a... (1 Reply)
Discussion started by: bodisha
1 Replies
LEARN ABOUT DEBIAN
text::context::eitherside
Text::Context::EitherSide(3pm) User Contributed Perl Documentation Text::Context::EitherSide(3pm)NAME
Text::Context::EitherSide - Get n words either side of search keywords
SYNOPSIS
use Text::Context::EitherSide;
my $text = "The quick brown fox jumped over the lazy dog";
my $context = Text::Context::EitherSide->new($text);
$context->as_string("fox") # "... quick brown fox jumped over ..."
$context->as_string("fox", "jumped")
# "... quick brown fox jumped over the ..."
my $context = Text::Context::EitherSide->new($text, context => 1);
# 1 word on either side
$context->as_string("fox", "jumped", "dog");
# "... brown fox jumped over ... lazy dog",
Or, if you don't believe in all this OO rubbish:
use Text::Context::EitherSide qw(get_context);
get_context(1, $text, "fox", "jumped", "dog")
# "... brown fox jumped over ... lazy dog"
DESCRIPTION
Suppose you have a large piece of text - typically, say, a web page or a mail message. And now suppose you've done some kind of full-text
search on that text for a bunch of keywords, and you want to display the context in which you found the keywords inside the body of the
text.
A simple-minded way to do that would be just to get the two words either side of each keyword. But hey, don't be too simple minded, because
you've got to make sure that the list doesn't overlap. If you have
the quick brown fox jumped over the lazy dog
and you extract two words either side of "fox", "jumped" and "dog", you really don't want to end up with
quick brown fox jumped over brown fox jumped over the the lazy dog
so you need a small amount of smarts. This module has a small amount of smarts.
EXPORTABLE
get_context
This is primarily an object-oriented module. If you don't care about that, just import the "get_context" subroutine, and call it like so:
get_context($num_of_words, $text, @words_to_find)
and you'll get back a string with ellipses as in the synopsis. That's all that most people need to know. But if you want to do clever
stuff...
METHODS
new
my $c = Text::Context::EitherSite->new($text [, context=> $n]);
Create a new object storing some text to be searched, plus optionally some information about how many words on either side you want. (If
you don't like the default of 2.)
context
$c->context(5);
Allows you to get and set the number of the words on either side.
as_sparse_list
$c->as_sparse_list(@keywords)
Returns the keywords, plus n words on either side, as a sparse list; the original text is split into an array of words, and non-contextual
elements are replaced with "undef"s. (That's not actually how it works, but conceptually, it's the same.)
as_list
$c->as_list(@keywords)
The same as "as_sparse_list", but single or multiple "undef"s are collapsed into a single ellipsis:
(undef, "foo", undef, undef, undef, "bar")
becomes
("...", "foo", "...", "bar")
as_string
$c->as_string(@keywords)
Takes the "as_list" output above and joins them all together into a string. This is what most people want from "Text::Context::EitherSide".
EXPORT
"get_context" is available as a shortcut for
Text::Context::EitherSide->new($text, context => $n)->as_string(@words);
but needs to be explicitly imported. Nothing is exported by default.
SEE ALSO
Text::Context is an even smarter way of extracting a contextual string.
AUTHOR
Current maintainer: Tony Bowden
Original author: Simon Cozens
BUGS and QUERIES
Please direct all correspondence regarding this module to:
bug-Text-Context-EitherSide@rt.cpan.org
COPYRIGHT AND LICENSE
Copyright 2002-2005 by Kasei Limited, http://www.kasei.com/
You may use and redistribute this module under the terms of the Artistic License 2.0.
http://www.perlfoundation.org/artistic_license_2_0
perl v5.10.0 2009-05-04 Text::Context::EitherSide(3pm)