[17697] in Perl-Users-Digest
Perl-Users Digest, Issue: 5117 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 15 03:06:42 2000
Date: Fri, 15 Dec 2000 00:05:31 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <976867530-v9-i5117@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 15 Dec 2000 Volume: 9 Number: 5117
Today's topics:
Re: #include files? sort of (Stan Brown)
Re: #include files? sort of (Stan Brown)
Re: #include files? sort of (Stan Brown)
Re: .NET in One Day Seminar - 2001 Schedule (Tad McClellan)
Re: 3 questions <tinamue@zedat.fu-berlin.de>
Re: ??newbie: s/// and \r <sue@pennine.com>
Re: ??newbie: s/// and \r <lincmad001@telecom-digest.zzn.com>
Re: ??newbie: s/// and \r (Logan Shaw)
Re: [q] split in while loop (Garry Williams)
advice <ng@fnmail.com>
Re: Algorithm::Diff -- unexpected behavior? <stephenk@cc.gatech.edu>
Re: Algorithm::Diff -- unexpected behavior? <ned@bike-nomad.com>
Re: Algorithm::Diff -- unexpected behavior? (Randal L. Schwartz)
Re: Associate more than one FH with a $cgi? <tinamue@zedat.fu-berlin.de>
backspace issues <ep@w3dzine.net>
Re: backspace issues (Chris Fedde)
Re: backspace issues <m_arc@world.std.com>
Re: backspace issues <ep@w3dzine.net>
Re: backspace issues <ep@w3dzine.net>
Can someone plz help me? <ktsang@telus.net>
Re: Can someone plz help me? (Logan Shaw)
Re: Can someone plz help me? <tinamue@zedat.fu-berlin.de>
Re: CGI: Dealing with checkboxes and multiple <SELECTS> <elephant@squirrelgroup.com>
Re: dclone [Was Re: Dereferencing hash within hash] (Garry Williams)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 Dec 2000 19:05:39 -0500
From: stanb@panix.com (Stan Brown)
Subject: Re: #include files? sort of
Message-Id: <91bn8j$o9u$1@panix6.panix.com>
In <eli$0012141557@qz.little-neck.ny.us> Eli the Bearded <elijah@workspot.net> writes:
>In comp.lang.perl.misc, <nobull@mail.com> wrote:
>> stanb@panix.com (Stan Brown) writes:
>> > I have a small perl script that will eventually be one of a pair of
>> > co-operating tasks. I am planing on using on confiugration file for
>> > both tasks. Since the code for pareseing this file is common, I wnat to
>> > pull it out into a file to "#included" by both scripts.
>...
>> > How can I acomplish this in a simple manner?
>> You are free to fall back on Perl4 techniques and simply require the
>> file. Ignore all the stuff about modules, all you need to do is put
>> "1;" on the last line of the file and act like you'd used #include in
>> C.
>And since this is perl, there are other ways...
> do EXPR Uses the value of EXPR as a filename and executes
> the contents of the file as a Perl script. Its
> primary use is to include subroutines from a Perl
> subroutine library.
> do 'stat.pl';
> is just like
> scalar eval `cat stat.pl`;
> except that it's more efficient and concise, keeps
> track of the current filename for error messages,
> searches the @INC libraries, and updates `%INC' if
>[...]
Great! This looks lot's easier than the export method.
Thanks for the tip.
------------------------------
Date: 14 Dec 2000 19:10:21 -0500
From: stanb@panix.com (Stan Brown)
Subject: Re: #include files? sort of
Message-Id: <91bnhd$opk$1@panix6.panix.com>
In <iigi3tc4q0foktlmko4irr20ulsde9ovpd@4ax.com> Bart Lateur <bart.lateur@skynet.be> writes:
>Stan Brown wrote:
>> I have a small perl script that will eventually be one of a pair of
>> co-operating tasks. I am planing on using on confiugration file for
>> both tasks. Since the code for pareseing this file is common, I wnat to
>> pull it out into a file to "#included" by both scripts. Hees what I
>> have at the top of the existing script.
>...
>># variable set (Potentialy) from the config file
>># These need to be declared here, even though they are set in a subroutine
>>my ( $my_pid_file, $my_tags_file, $my_ftp_lock_file, $my_max_ftp_wait );
>>my ( $my_csv_db_dir, $my_sleep_time_per_cycle, $my_lock_wait, $my_lock_tries);
>>my ( $my_log_file, $my_partner_task_has_lock, $my_max_data_wait);
>>my ( $my_max_tags_in_que, $my_max_data_wait_per_tag, $my_loglevel);
>>my ( $my_badinit);
>...
>>$my_pid_file = $state->get("pid_file");
>>$my_tags_file = $state->get("tags_file");
>>$my_log_file = $state->get("log_file");
>>$my_ftp_lock_file = $state->get("ftp_task_lock_file");
>>$my_max_ftp_wait = $state->get("max_ftp_delay");
>...
>> What I want to do, is put this section it it's own file, and have the
>> global varibales, and the subroutine be accessiable to booht scripts.
>> How can I acomplish this in a simple manner?
>Hold your horses. First of all, you declare your variables with "my", so
>they are NOT global variables. They are, in this incarnation, file
>scoped variables. Therefore, the config library file cannot touch them
>directly. Why don't you really make them global variables, by dropping
>the "my"? If you just put "::" in font of the variable's names, then you
>don't need to declare them, not even when using strict, and better
>still, the config file can set them directly. Like this:
Ah, I had not picked up on thta. I jsut started puting my in front of
them when I turned strict on, and it brought on the complaints. I did
figure out not to use local. which was my first inclination.
I was not aware of teh :: syntaz, thnaks for the tipe.
> $::pid_file = '/opt/local/run/pi_collect.pid';
>You may get the complaint from Perl that some variables are used only
>once. It's nothing serious, it's just that these are used once in two
>different script files, and Perl doesn't make the connection. Use them
>more than once, or actually declare them (use vars, or our()).
>And, why are't you using a hash?
> $config{pid_file} = '/opt/local/run/pi_collect.pid';
Geuss, I just have not gotten into the perl way of thinking. I think I
will fix this, thanks for this tip also.
------------------------------
Date: 14 Dec 2000 22:28:36 -0500
From: stanb@panix.com (Stan Brown)
Subject: Re: #include files? sort of
Message-Id: <91c354$ck4$1@panix6.panix.com>
In <iigi3tc4q0foktlmko4irr20ulsde9ovpd@4ax.com> Bart Lateur <bart.lateur@skynet.be> writes:
>Stan Brown wrote:
>> I have a small perl script that will eventually be one of a pair of
>> co-operating tasks. I am planing on using on confiugration file for
>> both tasks. Since the code for pareseing this file is common, I wnat to
>> pull it out into a file to "#included" by both scripts. Hees what I
>> have at the top of the existing script.
>...
>Hold your horses. First of all, you declare your variables with "my", so
>they are NOT global variables. They are, in this incarnation, file
>scoped variables. Therefore, the config library file cannot touch them
>directly. Why don't you really make them global variables, by dropping
>the "my"? If you just put "::" in font of the variable's names, then you
>don't need to declare them, not even when using strict, and better
>still, the config file can set them directly. Like this:
> $::pid_file = '/opt/local/run/pi_collect.pid';
Just to make certain I understand. If I declare a variable like this,
and it's outside a block, it will be global across files?
I could not figure out how to do that. Then I can use it like:
$foo = $pid_file; ?
------------------------------
Date: Thu, 14 Dec 2000 16:46:39 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: .NET in One Day Seminar - 2001 Schedule
Message-Id: <slrn93ijef.10k.tadmc@maxim.metronet.com>
Uri Guttman <uri@sysarch.com> wrote:
>
>keep this spam crap out of this newsgroup. it doesn't mention perl once
>nor refer to any perl issues, just this massive redmondware hunk of shit
>that will only run on their platforms.
I seem to recall seeing SPAM for Bertrand Meyer before.
I don't think this is the first time...
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 15 Dec 2000 00:49:52 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: 3 questions
Message-Id: <91bprf$3jrkb$2@fu-berlin.de>
hi,
In comp.lang.perl.misc Konstantin Stupnik <skv@iis.nsk.su> wrote:
> "Chris Fedde" <cfedde@fedde.littleton.co.us> wrote in message
> news:soZZ5.231$B9.188798464@news.frii.net...
>> In article <3A385DF4.43499BF2@best.com>,
>> Bill Chapman <bchapman@best.com> wrote:
>> >-=-=-=-=-=-
>> >
>> > % myprog >myfile.txt
>>
>> open(F, ">myfile.txt") or die "$0: can't open myfile.txt: $!";
>> open(G, "myprog |") or die "$0: can't start myprog: $!";
> You can find out that an error happened only
> by checking close;
>> while (<G>) {
>> print F;
>> }
> close F;
> close G or die "$0: failed to start myprog: $!";
well, than i'd prefer using $? instead of $!
perldoc perlvar
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanx
------------------------------
Date: 14 Dec 2000 14:57:08 -0800
From: Sue Spence <sue@pennine.com>
Subject: Re: ??newbie: s/// and \r
Message-Id: <91bj8401uem@drn.newsguy.com>
In article <141220000440015655%lincmad001@telecom-digest.zzn.com>, Linc says...
>
>In article <3A38B296.1B20FB27@fujitsu-siemens.com>, Josef Moellers
><josef.moellers@fujitsu-siemens.com> wrote:
>
>> \012 is "newline".
>
>Only because Unix DEFINED it that way. ASCII does *NOT* define \012 as
>"newline."
>
>\012 is "LINE FEED" which is NOT the same thing as "newline" to the
>rest of the world.
>
>(Yes, I was wrong about vertical tab, but I'm right about line feed.)
>
>Line Feed is a poor choice for a newline character, objectively
>speaking, since it has a fundamentally INCOMPATIBLE meaning.
>
>The carriage return has a meaning that is fundamentally COMPATIBLE with
>"newline," because carriage return means return to the leftmost column
>of output. Line Feed does NOT contain that meaning.
And this matters because...? The names and meanings of most of the first 32
ASCII chars are relics of a bygone era (that I miss very much but hey, life goes
on). Newline is a concept, and is not any particular ASCII char (or chars).
>
>But anyway, I've said my piece on the subject for now.
Loved the all-caps bits. Very kooky, dude.
------------------------------
Date: Thu, 14 Dec 2000 19:09:28 -0800
From: Linc Madison <lincmad001@telecom-digest.zzn.com>
Subject: Re: ??newbie: s/// and \r
Message-Id: <141220001909280105%lincmad001@telecom-digest.zzn.com>
In article <91bj8401uem@drn.newsguy.com>, Sue Spence <sue@pennine.com>
wrote:
> And this matters because...? The names and meanings of most of the
> first 32 ASCII chars are relics of a bygone era (that I miss very
> much but hey, life goes on). Newline is a concept, and is not any
> particular ASCII char (or chars).
My point was that the poster who said that ^J was the only sensible
choice for newline, was being unduly provincial (and, to borrow your
word, "kooky"); that, in fact, if anything, it is the least sensible of
the three most common choices.
It represents a redefinition of a symbol (^J) when another symbol (^M)
already had the desired meaning and further when the previous meaning
of ^J got lost in the shuffle, even though it's a useful meaning to
have included.
I certainly don't expect that the entire Unix world will at this point
correct the mistake of choosing the wrong character for newline, but I
do expect Unix backers to refrain from the laughable enterprise of
telling the rest of us that we got it wrong.
This is a religious argument, and, as always, I am right.[*]
[*] except of course when I intentionally screw up just to throw people
off balance
------------------------------
Date: 14 Dec 2000 23:13:53 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: ??newbie: s/// and \r
Message-Id: <91c9ah$e5j$1@boomer.cs.utexas.edu>
In article <141220001909280105%lincmad001@telecom-digest.zzn.com>,
Linc Madison <lincmad001@telecom-digest.zzn.com> wrote:
>My point was that the poster who said that ^J was the only sensible
>choice for newline, was being unduly provincial (and, to borrow your
>word, "kooky"); that, in fact, if anything, it is the least sensible of
>the three most common choices.
>
>It represents a redefinition of a symbol (^J) when another symbol (^M)
>already had the desired meaning and further when the previous meaning
>of ^J got lost in the shuffle, even though it's a useful meaning to
>have included.
Just for the record, just ^M as a newline character also
represents a redefinition. Those who have used plain old dot
matrix or daisy-wheel printers know this -- carriage return
moves the print head to the left column, and line feed
rotates the platen by an amount equivalent to one line.
Thus, sending "a b c\r 1 2 3\r" to a printer will result in this
output (karats, etc. mark the position of the print head):
+v-----+
>a1b2c3<
+^-----+
while sending "a b c\n 1 2 3\n" will result in this output:
+-----------v+
|a b c |
| 1 2 3 |
> <
+-----------^+
Thus, if you want to view it from a functional point of view, neither
\r nor \n by itself is acceptable, but either \n\r or \r\n is.
Of course, most people on most systems never had to deal with this
issue, because most operating systems have a driver that takes text
bound for the printer and substitutes \r\n or \n\r for the line
delimiter character before the text is sent to the printer.
The fact that some systems have drivers brings up an interesting
point. In the bad old days, computers were very literal. There were
not (commonly) drivers that did automatic translation from one format
to another, such as from text to that which was to be sent to a
printer. Software wrote straight to the VGA (or EGA or CGA or MGA) on
PCs. Amiga people talked of a coming version of AmigaDOS with a great
new feature called "DIG": device independent graphics. A package for
making charts and graphs on IBM VM required you to tell it just exactly
which model of printer you were going to send them to. The Unix "man"
command spit out a^Ha^Ha^Ha to make a bold "a".
Nowadays, things are different. File formats describe how things
should look, not how to make them look that way. The Unix "man"
command still spits out a^Ha^Ha^Ha, but there are utilities that will
convert this to HTML, which uses <B> instead.
The point is that at some point, ASCII and character sets took on a
subtly different role than they originally had. Instead of driving
printers (or teletypes), they became part of the basis for a file
format that describes text.
And now the real point (you were hoping there was one, right?). The
real point is that if you are representing a text file in the abstract,
then a single-character is more convenient. If you're doing a
different kind of task (sending output to a terminal or printer), then
each character is a command and a two-command sequence is more
traditional and convenient (unless you want less capability).
Given that, at least as far as I know, the second type of task (using
characters as commands to be sent to peripherals) came before the first
type (using characters as symbols), all attempts to define which
characters are used as symbols for what are all arbitrary, and none is
more right than any other.
So, my conclusion is that while neither is right or wrong,
single-character solutions (\r and \n) are more convenient for
processing.
On the other hand, now that we have unicode, the idea of writing
software that can assume we have a fixed-length code for every logical
entity has gone out the window anyway...
- Logan
------------------------------
Date: Fri, 15 Dec 2000 01:39:28 GMT
From: garry@zweb.zvolve.net (Garry Williams)
Subject: Re: [q] split in while loop
Message-Id: <kDe_5.1096$uF3.67115@eagle.america.net>
On Thu, 14 Dec 2000 16:51:47 -0500, Stephen Kloder
<stephenk@cc.gatech.edu> wrote:
>Drew Myers wrote:
>
>> my $free = split(" ",$_)[1];
>
>the [1] is applied to (" ",$_), sintead of the output of the split
>statement. Instead, you should use:
>my $free = (split / /)[1];
>(use slashes instead of quotes, as quotes can be misleading in split
>statements)
Quotes are not misleading in the first parameter to split(). The use
of quotes is documented in the perlfunc manual page:
split /PATTERN/,EXPR,LIMIT
...
The pattern `/PATTERN/' may be replaced with an expression to
specify patterns that vary at runtime.
There is a semantic difference between
split / /
and
split " "
The default pattern for split is C<' '>. That's quote-space-quote --
not slash-space-slash. That is treated by split() as a _special_
_case_. Here's the quote from the perlfunc manual page:
As a special case, specifying a PATTERN of space (`' '') will split on
white space just as `split' with no arguments does. Thus, `split(' ')'
can be used to emulate awk's default behavior, whereas `split(/ /)' will
give you as many null initial fields as there are leading spaces. A
`split' on `/\s+/' is like a `split(' ')' except that any leading
whitespace produces a null first field. A `split' with no arguments
really does a `split(' ', $_)' internally.
The original poster presumably wants the "awk" behavior because he
wrote `split(" ",$_)' which has the same meaning as `split' or `split
" "', but has a different meaning than `split / /'.
--
Garry Williams
------------------------------
Date: Thu, 14 Dec 2000 23:06:05 -0600
From: "Enrico Ng" <ng@fnmail.com>
Subject: advice
Message-Id: <91c8s0$7de$1@info1.fnal.gov>
I am making a website with three frames where all the pages are generated by
perl scripts.
I am considering two ways to make this:
first,
set cookies and have the scripts generate the pages depending on the cookie
values.
the scripting might be a little tricky
second,
setup every link so that it passes parameters to one (or a few) scripts.
I might have problems if I reload two pages at once.
If I use the second method I would prob, be calling the same script three
times at once.
if I use the first method, I would be calling three difference scripts at
once.
I'm just not sure which way is better, of if it even makes any difference
--
Enrico Ng <ng@fnmail.com>
------------------------------
Date: Thu, 14 Dec 2000 17:59:57 -0500
From: Stephen Kloder <stephenk@cc.gatech.edu>
Subject: Re: Algorithm::Diff -- unexpected behavior?
Message-Id: <3A3950EC.17A6E758@cc.gatech.edu>
Weston Cann wrote:
> I'm using Algorithm::Diff (the diff function therefrom) to find
> differences between two texts, and I'm getting some results that
> don't seem right.
>
> Take:
>
> @text1 = ( 'The','patient','was','21','years','old' );
> @text2 = ( 'The','patient','was','a','21','year','old','male');
>
> so when I do:
>
> @diffs = diff(\@text1,\@text2);
>
> I get @diffs = ( [[+, 3, a ]],
> [[-, 4, years]],
> [[+, 5, year ]],
> [[+, 7, male ]] );
>
> Which is, as I understand it, the list of operations necessary to turn
> @text1 into @text2.
>
As far as I can tell, the indices are for the array that they were found
in. Therefore, [-,4,'years'] means that $text1[4] = 'years' and 'years' in
not in that area of @text1.
Therefore, to translate from @text1 to @text2, apply all the - entries in
decreasing order, then apply all + entries in increasing order.
HTH. HAND.
--
Stephen Kloder | "I say what it occurs to me to say.
stephenk@cc.gatech.edu | More I cannot say."
Phone 404-874-6584 | -- The Man in the Shack
ICQ #65153895 | be :- think.
------------------------------
Date: Thu, 14 Dec 2000 15:22:00 +0800
From: "Ned Konz" <ned@bike-nomad.com>
Subject: Re: Algorithm::Diff -- unexpected behavior?
Message-Id: <t3ilo9qdkuo13c@corp.supernews.com>
In article <121220001448148220%iowa8_song8.remove_eights@hotmail.com>,
"Weston Cann" <iowa8_song8.remove_eights@hotmail.com> wrote:
> I'm using Algorithm::Diff (the diff function therefrom) to find
> differences between two texts, and I'm getting some results that don't
> seem right.
>
> Take:
>
> @text1 = ( 'The','patient','was','21','years','old' );
> @text2 = ( 'The','patient','was','a','21','year','old','male');
>
> so when I do:
>
> @diffs = diff(\@text1,\@text2);
>
> I get @diffs = ( [[+, 3, a ]],
> [[-, 4, years]],
> [[+, 5, year ]],
> [[+, 7, male ]] );
>
> Which is, as I understand it, the list of operations necessary to turn
> @text1 into @text2.
The output is not a list of instructions. The numbers in the '+' entries
are indices into @text2, while the numbers in the '-' entries are
indices into @text1.
That is, the first '[+, 3, a]' means that @text2 has an added
member 'a' at its position 3.
--
Ned Konz
currently: Stanwood, WA
email: ned@bike-nomad.com
homepage: http://bike-nomad.com
------------------------------
Date: 14 Dec 2000 15:55:16 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Algorithm::Diff -- unexpected behavior?
Message-Id: <m1d7eur21n.fsf@halfdome.holdit.com>
>>>>> "Weston" == Weston Cann <iowa8_song8.remove_eights@hotmail.com> writes:
Weston> I'm using Algorithm::Diff (the diff function therefrom) to find
Weston> differences between two texts, and I'm getting some results that
Weston> don't seem right.
To add to the other answers in this thread, I'd also suggest looking
at <http://www.stonehenge.com/merlyn/UnixReview/col35.html>, where I
use Algorithm::Diff to red/green colorize a sequence of text with
changes. It uses the easier to understand (IMHO) traverse_sequences
to extract the useful information.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 15 Dec 2000 02:01:13 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Associate more than one FH with a $cgi?
Message-Id: <91bu19$3jrkb$3@fu-berlin.de>
hi,
alazarev1981@my-deja.com wrote:
> However, what I really want to do is get data from more than one CGI
> file from within the same perl program. So I'm thinking about coding
i can't think of any way doing this with opening the two filehandles
at once.
you can create 2 cgi-objects and join the parameters
manually with the param-method, or you can
get the query_strings and append them.
see the section on "saving the state..." in
perldoc CGI,
they suggest to append already at storing time,
so that you just have one file.
(the files end with a line "=", that's
the reason why a simple appending of the
files doesn't work)
joining the query_string would be easy like
my $string = ($q1->query_string)."&".($q2->query_string);
my $q = new CGI($string);
hth,
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanx
------------------------------
Date: Thu, 14 Dec 2000 19:51:59 -0800
From: "Harley Green" <ep@w3dzine.net>
Subject: backspace issues
Message-Id: <3a3996ad_1@isp.uncensored-news.com>
Hi,
I am making a calculator and the user can enter numbers via the keyboard or
buttons on screen. And they can use the delete key and backspace key and
that works great but when they use the backspace button it needs to have the
same effect as backspace on the keyboard. I tried :
$entry->delete('insert');
but that deletes the character after the one I want deleted.
Is there a way to invoke the backspace key on the keyboard?
How should I deal with this? Is there a way to get the current index number
and then use some scalar manipulation?
Thanks,
Harley
______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
With Servers In California, Texas And Virginia - The Worlds Uncensored News Source
------------------------------
Date: Fri, 15 Dec 2000 04:33:24 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: backspace issues
Message-Id: <oah_5.253$B9.189618176@news.frii.net>
In article <3a3996ad_1@isp.uncensored-news.com>,
Harley Green <ep@w3dzine.net> wrote:
>Hi,
>I am making a calculator and the user can enter numbers via the keyboard or
>buttons on screen. And they can use the delete key and backspace key and
>that works great but when they use the backspace button it needs to have the
>same effect as backspace on the keyboard. I tried :
>
>$entry->delete('insert');
>but that deletes the character after the one I want deleted.
>Is there a way to invoke the backspace key on the keyboard?
>How should I deal with this? Is there a way to get the current index number
>and then use some scalar manipulation?
>
I'm guessing that this question has something to do with Perl/Tk.
You might want to post to comp.lang.perl.tk to get an audience
with better chances of answering your question correctly.
--
This space intentionally left blank
------------------------------
Date: Fri, 15 Dec 2000 04:37:28 GMT
From: Marc Dashevsky <m_arc@world.std.com>
Subject: Re: backspace issues
Message-Id: <MPG.14a36a134b5cb969989cab@nntp.ne.mediaone.net>
In article <3a3996ad_1@isp.uncensored-news.com>, ep@w3dzine.net says...
> Hi,
> I am making a calculator and the user can enter numbers via the keyboard or
> buttons on screen. And they can use the delete key and backspace key and
> that works great but when they use the backspace button it needs to have the
> same effect as backspace on the keyboard. I tried :
>
> $entry->delete('insert');
> but that deletes the character after the one I want deleted.
> Is there a way to invoke the backspace key on the keyboard?
> How should I deal with this? Is there a way to get the current index number
> and then use some scalar manipulation?
Is this a real Entry widget, or is it one of those entrynumplain things?
If the former, then the following should work:
my $insert = $entry->index('insert');
$entry->delete($insert - 1) if $insert;
--
Marc Dashevsky (remove "_" from address to reply by e-mail)
------------------------------
Date: Thu, 14 Dec 2000 23:00:45 -0800
From: "Harley Green" <ep@w3dzine.net>
Subject: Re: backspace issues
Message-Id: <3a39c2e3_7@isp.uncensored-news.com>
Its that NumEntryPlain widget. Its in the standard active perl documentation
under tk.
"Harley Green" <ep@w3dzine.net> wrote in message
news:3a3996ad_1@isp.uncensored-news.com...
> Hi,
> I am making a calculator and the user can enter numbers via the keyboard
or
> buttons on screen. And they can use the delete key and backspace key and
> that works great but when they use the backspace button it needs to have
the
> same effect as backspace on the keyboard. I tried :
>
> $entry->delete('insert');
> but that deletes the character after the one I want deleted.
> Is there a way to invoke the backspace key on the keyboard?
> How should I deal with this? Is there a way to get the current index
number
> and then use some scalar manipulation?
>
> Thanks,
> Harley
>
>
>
> ______________________________________________________________________
> Posted Via Uncensored-News.Com - Still Only $9.95 -
http://www.uncensored-news.com
> With Servers In California, Texas And Virginia - The Worlds Uncensored
News Source
>
______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
With Servers In California, Texas And Virginia - The Worlds Uncensored News Source
------------------------------
Date: Thu, 14 Dec 2000 23:01:52 -0800
From: "Harley Green" <ep@w3dzine.net>
Subject: Re: backspace issues
Message-Id: <3a39c326_7@isp.uncensored-news.com>
Sweet it worked thanks.
"Marc Dashevsky" <m_arc@world.std.com> wrote in message
news:MPG.14a36a134b5cb969989cab@nntp.ne.mediaone.net...
> In article <3a3996ad_1@isp.uncensored-news.com>, ep@w3dzine.net says...
> > Hi,
> > I am making a calculator and the user can enter numbers via the keyboard
or
> > buttons on screen. And they can use the delete key and backspace key and
> > that works great but when they use the backspace button it needs to have
the
> > same effect as backspace on the keyboard. I tried :
> >
> > $entry->delete('insert');
> > but that deletes the character after the one I want deleted.
> > Is there a way to invoke the backspace key on the keyboard?
> > How should I deal with this? Is there a way to get the current index
number
> > and then use some scalar manipulation?
>
> Is this a real Entry widget, or is it one of those entrynumplain things?
> If the former, then the following should work:
>
> my $insert = $entry->index('insert');
> $entry->delete($insert - 1) if $insert;
>
> --
> Marc Dashevsky (remove "_" from address to reply by e-mail)
______________________________________________________________________
Posted Via Uncensored-News.Com - Still Only $9.95 - http://www.uncensored-news.com
With Servers In California, Texas And Virginia - The Worlds Uncensored News Source
------------------------------
Date: Fri, 15 Dec 2000 00:54:14 GMT
From: "Nathan T" <ktsang@telus.net>
Subject: Can someone plz help me?
Message-Id: <WYd_5.2940$uK6.376195@news1.telusplanet.net>
i have code that reads:
echo "<input type=hidden name=\"title[$book[id]]\" value=\"$book[title]\">"
when this is sent w/ the form, the receiving script doesn't treat the
variable "title,"
which is sent as something like -title%5B17%5D=The+Fountainhead- as an
array. Do
you have any idea why?
when i have something like <input type=checkbox name=something[]
value="whatever">
it's treated as an array.
------------------------------
Date: 14 Dec 2000 18:59:29 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Can someone plz help me?
Message-Id: <91bqdh$bvg$1@boomer.cs.utexas.edu>
In article <WYd_5.2940$uK6.376195@news1.telusplanet.net>,
Nathan T <ktsang@telus.net> wrote:
>i have code that reads:
>
>echo "<input type=hidden name=\"title[$book[id]]\" value=\"$book[title]\">"
>
>when this is sent w/ the form, the receiving script doesn't treat the
>variable "title,"
>which is sent as something like -title%5B17%5D=The+Fountainhead- as an
>array. Do
>you have any idea why?
>
>when i have something like <input type=checkbox name=something[]
>value="whatever">
>it's treated as an array.
How is this a Perl question?
If you want an answer, it might be best to ask in a different group,
one where your question is related to the topic of the group.
- Logan
------------------------------
Date: 15 Dec 2000 02:11:29 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Can someone plz help me?
Message-Id: <91bukh$3jrkb$4@fu-berlin.de>
hi,
Nathan T <ktsang@telus.net> wrote:
> i have code that reads:
> echo "<input type=hidden name=\"title[$book[id]]\" value=\"$book[title]\">"
> when this is sent w/ the form, the receiving script doesn't treat the
> variable "title,"
> which is sent as something like -title%5B17%5D=The+Fountainhead- as an
> array. Do
> you have any idea why?
no. i even don't see the array you are speaking of.
the following code
$s="title%5B17%5D=The+Fountainhead";
print CGI::unescape($s);
returns:
title[17]=The Fountainhead
is that false?
what did you expect?
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanx
------------------------------
Date: Fri, 15 Dec 2000 12:43:04 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: CGI: Dealing with checkboxes and multiple <SELECTS>
Message-Id: <MPG.14a422317fff7e00989898@localhost>
Adam Levenstein wrote ..
>As I'm working on this project, I notice that my CGI script (Perl 5,
>UNIX) is only returning the last value selected with multiple
>checkboxes and <SELECT MULTIPLE> fields. Any way to get around this?
yeah .. use a module like CGI.pm which caters for this sort of thing ..
then read the documentation associated with that module which
specifically mentions multiple selections in the help on the param()
method
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Fri, 15 Dec 2000 03:45:57 GMT
From: garry@zweb.zvolve.net (Garry Williams)
Subject: Re: dclone [Was Re: Dereferencing hash within hash]
Message-Id: <Vtg_5.1117$uF3.68377@eagle.america.net>
On Thu, 14 Dec 2000 22:05:24 GMT, James Kufrovich
<eggie@REMOVE_TO_REPLYsunlink.net> wrote:
>On Thu, 14 Dec 2000 20:31:03 GMT, Garry Williams
><garry@ifr.zvolve.net> wrote:
>>On Thu, 14 Dec 2000 18:29:59 GMT, Dave Sherohman
>><esper@news.visi.com> wrote:
>>
>>>Although this does answer my standing curiousity about {} being
>>>used both for code blocks and hash keys: hash keys _are_ code
>>>blocks.
>>
>>Yes; code blocks that return strings.
>
> Hrmm, would this explain a slight problem I had with dclone?
>I have data stored as a hash of hashes as an MLDBM dbm file (with
>DB_FILE and Storable), and tied to %hash. But running dclone on
>\%hash gives a "cannot use CODE" error, or something along those
>lines. I was trying to run dclone on the hash because every time one
>accesses the data in the tied hash, it calls the appropriate FETCH
>method, so the MLDBM man page says. So just make a copy of the tied
>hash in one fell swoop, then read the data from there, was my
>reasoning. Is that a reasonable approach, or would running dclone
>call FETCH just as many times?
I note that another poster pointed out the the {} in $hash{key} is
_not_ a code block. It is part of the syntax for retrieving an
element of a hash. My comment above was wrong.
As for MLDBM, I've never used it, so I cannot answer your question.
As for references to a tied hash, _any_ reference to an element will
invoke FETCH() on the hash, so I guess it's six of one and a
half-dozen of the other.
--
Garry Williams
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 5117
**************************************