[29169] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 413 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 7 21:14:26 2007

Date: Mon, 7 May 2007 18:14:15 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 7 May 2007     Volume: 11 Number: 413

Today's topics:
        Multiple copy and paste thing in Perl <gmarkowsky@gmail.com>
    Re: Multiple copy and paste thing in Perl <stoupa@practisoft.cz>
    Re: Multiple copy and paste thing in Perl <gmarkowsky@gmail.com>
    Re: Multiple copy and paste thing in Perl <jurgenex@hotmail.com>
    Re: need a quick script <uri@stemsystems.com>
    Re: need a quick script <noreply@gunnar.cc>
    Re: need a quick script <tadmc@augustmail.com>
    Re: need a quick script <stoupa@practisoft.cz>
    Re: need a quick script <jurgenex@hotmail.com>
    Re: need a quick script <yankeeinexile@gmail.com>
        new CPAN modules on Mon May  7 2007 (Randal Schwartz)
    Re: Select from drop down menu multipel times in the sa <jurgenex@hotmail.com>
    Re: selecting particular form with field <xicheng@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 6 May 2007 18:41:17 -0700
From: TefJlives <gmarkowsky@gmail.com>
Subject: Multiple copy and paste thing in Perl
Message-Id: <1178502077.800790.92800@y80g2000hsf.googlegroups.com>

Hi all,

For my job, I often have a group of about 10 commands that I need to
type very often. I am thinking that it would be nice to rig up a
program(unless there already is one) where I could enter a bunch of
strings, and then when I press RightControl-r it would enter one
string, then RightContrl-q for another, etc, up to 26 possible
strings. Just like copy and paste, but with many different
possibilities. I thought, if possible, I could make it use the right
control because I never use that key. So, does anyone know if
something like that is doable in Perl? I don't know how to isolate the
right control, I also don't know how to make it paste it where the
cursor is. I have no idea whether this is possible, but if anyone has
any suggestions that would be great. Also, maybe Perl isn't the right
language, but I don't know what is.

Greg



------------------------------

Date: Mon, 7 May 2007 16:40:00 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: Multiple copy and paste thing in Perl
Message-Id: <f1ndv5$bl3$1@ns.felk.cvut.cz>

"TefJlives" <gmarkowsky@gmail.com> píse v diskusním príspevku 
news:1178502077.800790.92800@y80g2000hsf.googlegroups.com...
> Hi all,
>
> For my job, I often have a group of about 10 commands that I need to
> type very often. I am thinking that it would be nice to rig up a
> program(unless there already is one) where I could enter a bunch of
> strings, and then when I press RightControl-r it would enter one
> string, then RightContrl-q for another, etc, up to 26 possible
> strings. Just like copy and paste, but with many different
> possibilities. I thought, if possible, I could make it use the right
> control because I never use that key. So, does anyone know if
> something like that is doable in Perl? I don't know how to isolate the
> right control, I also don't know how to make it paste it where the
> cursor is. I have no idea whether this is possible, but if anyone has
> any suggestions that would be great. Also, maybe Perl isn't the right
> language, but I don't know what is.
>
As I know to isolate RightControl key is not possible because it is not 
handled by hardware. You can detect right or left Shift or Alt but not 
Control.
-- 

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail 
from another non-spammer site please.)




------------------------------

Date: 7 May 2007 08:13:27 -0700
From: TefJlives <gmarkowsky@gmail.com>
Subject: Re: Multiple copy and paste thing in Perl
Message-Id: <1178550807.011968.163440@p77g2000hsh.googlegroups.com>

OK, thanks, I can use shift then.

Greg

On May 7, 10:40 am, "Petr Vileta" <sto...@practisoft.cz> wrote:
> "TefJlives" <gmarkow...@gmail.com> p=EDse v diskusn=EDm pr=EDspevkunews:1=
178502077.800790.92800@y80g2000hsf.googlegroups.com...
>
> > Hi all,
>
> > For my job, I often have a group of about 10 commands that I need to
> > type very often. I am thinking that it would be nice to rig up a
> > program(unless there already is one) where I could enter a bunch of
> > strings, and then when I press RightControl-r it would enter one
> > string, then RightContrl-q for another, etc, up to 26 possible
> > strings. Just like copy and paste, but with many different
> > possibilities. I thought, if possible, I could make it use the right
> > control because I never use that key. So, does anyone know if
> > something like that is doable in Perl? I don't know how to isolate the
> > right control, I also don't know how to make it paste it where the
> > cursor is. I have no idea whether this is possible, but if anyone has
> > any suggestions that would be great. Also, maybe Perl isn't the right
> > language, but I don't know what is.
>
> As I know to isolate RightControl key is not possible because it is not
> handled by hardware. You can detect right or left Shift or Alt but not
> Control.
> --
>
> Petr Vileta, Czech republic
> (My server rejects all messages from Yahoo and Hotmail. Send me your mail
> from another non-spammer site please.)




------------------------------

Date: Mon, 07 May 2007 16:09:29 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Multiple copy and paste thing in Perl
Message-Id: <ZaI%h.5511$dj2.3190@trndny02>

TefJlives wrote:
> For my job, I often have a group of about 10 commands that I need to
> type very often.

Now, are you talking about 10 commands that you type in a command shell or 
10 commands of a programming language the you type in an editor?

In the first case you could simply create an alias (if supported by your 
command shell) or write a tiny (shell) script or whatever that executes 
those commands.

In the later case any decend text editor has macro capabilities. Just create 
a simple text macros, that inserts that piece of program code.
However, if you typing the same lines of code over and over again, then 
maybe it would be better to create a subroutine for this part.

jue




------------------------------

Date: Sun, 06 May 2007 19:13:25 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: need a quick script
Message-Id: <x7zm4h4kbu.fsf@mail.sysarch.com>

>>>>> "GH" == Gunnar Hjalmarsson <noreply@gunnar.cc> writes:

  GH> Sherm Pendley wrote:

  >>> Didn't know the return was optional

  >> Perl doesn't require it - but the future maintainer(s) of your code
  >> (which includes yourself in six months) will thank you if you write
  >> it explicitly instead of accepting the default return value.

  GH> More a matter of style, isn't it? After all, this is Perl, not PHP...

yes, but it is a good style point. the rare time i use the last
expression evaluation as return is with very short subs and special
cases like an anon sub dispatch table.

not using return can be a subtle trap for future code. someone could add
more code after that statement and put in a return or similar
badness. it is much safer to always use return (with the above
exceptions).

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


------------------------------

Date: Mon, 07 May 2007 01:39:23 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: need a quick script
Message-Id: <5a77duF2nnqg8U1@mid.individual.net>

grocery_stocker wrote:
> On May 6, 2:36 pm, Sherm Pendley <spamt...@dot-app.org> wrote:
>>Gunnar Hjalmarsson <nore...@gunnar.cc> writes:
>>>What if $line contains non-ASCII characters?
>>
>>It shouldn't matter, should it? Assuming that the handle $line was read
>>from is using the correct encoding layer, and Perl 5.8 or newer, I'd
>>expect /\W/ to do the right thing with respect to non-ASCII characters.
>>
>>Am I expecting too much magic?
> 
> Here comes the magic.
> [cdalten@localhost perl]$ perl -v
> 
> This is perl, v5.8.8 built for i386-linux-thread-multi
> 
> Copyright 1987-2006, Larry Wall
> 
> When  I run my version...
> [cdalten@localhost perl]$ ./name.pl
> Chad ;;Altenburg
> C.
> 
> And when I modify Gunnar's program to
> #!/usr/bin/perl -w
> use strict;
> 
> sub nameconvert{
>     my ($first, $last) = split ' ', shift;
>     substr($first, 0, 1).$last;
> }
> 
> print nameconvert('Chad ;;Altenburg'), "\n";
> 
> I get
> [cdalten@localhost perl]$ ./name2.pl
> C;;Altenburg

Well, the semicolon _is_ ASCII, even if it's included in \W ...
I rather thought about a name like the Swedish name Åke Östling.

But my point is: If you want to split on whitespace, make life easy and 
split on whitespace. ;-)

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Sun, 6 May 2007 19:01:12 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: need a quick script
Message-Id: <slrnf3sr28.6sd.tadmc@tadmc30.august.net>

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> Sherm Pendley wrote:
>> "Lambik" <lambik@kieffer.nl> writes:
>>>"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
>>>news:5a6elcF2n85heU1@mid.individual.net...
>>>>
>>>>sub nameconvert {
>>>>my ($first, $last) = split ' ', shift;
>>>>substr($first, 0, 1) . $last
>>>>}
>>>>
>>>>print nameconvert('Chad Altenburg'), "\n";
>>>
>>>Such a hopeless question and i still learned something. I would have done:
>>>
>>>return substr($first, 0, 1) . $last
>>>
>>>Didn't know the return was optional
>> 
>> Perl doesn't require it - but the future maintainer(s) of your code (which
>> includes yourself in six months) will thank you if you write it explicitly
>> instead of accepting the default return value.
>
> More a matter of style, isn't it? 


It's a matter of good style versus a less good style.


> After all, this is Perl, not PHP...


You should program with the maintenance programmer in mind no
matter what programming language you are using.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Mon, 7 May 2007 03:04:01 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: need a quick script
Message-Id: <f1lv0q$2lt4$1@ns.felk.cvut.cz>

"Gunnar Hjalmarsson" <noreply@gunnar.cc> píse v diskusním príspevku 
news:5a6elcF2n85heU1@mid.individual.net...
> sub nameconvert {
> my ($first, $last) = split ' ', shift;
> substr($first, 0, 1) . $last
> }
>
> print nameconvert('Chad Altenburg'), "\n";
>
> -- 
> Gunnar Hjalmarsson
Hmm Gunnar, this is not programmer problem but national alphabet problem. 
Many nations have 'Ch' as simple character. For example Czech alphabet is
A
Á
B
C
C
D
D
E
É
E
F
G
H
CH
I
Í
J
 ...
Z
Z

As I know the similar problem is in Spanish and some other languages. The 
Spanish first name Chita sound as english wroted Khyta, then miss Chita 
Castro must be transformed to ChCastro, not to CCastro.
-- 

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail 
from another non-spammer site please.)




------------------------------

Date: Mon, 07 May 2007 16:14:51 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: need a quick script
Message-Id: <%fI%h.5252$83.4778@trndny08>

Petr Vileta wrote:
> Hmm Gunnar, this is not programmer problem but national alphabet
> problem. Many nations have 'Ch' as simple character. For example
> Czech alphabet is A
[...]
> C
[...]
> H
> CH
> As I know the similar problem is in Spanish and some other languages.
> The Spanish first name Chita sound as english wroted Khyta, then miss
> Chita Castro must be transformed to ChCastro, not to CCastro.

This alphabet has single 'C' and 'H' as individual characters, too. How do 
you -as a human(!)- know, if the first is supposed to be 'C' or 'Ch'?

jue 




------------------------------

Date: 07 May 2007 15:06:35 -0500
From: Lawrence Statton <yankeeinexile@gmail.com>
Subject: Re: need a quick script
Message-Id: <87lkg0csac.fsf@gmail.com>

--=-=-=
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

"Jürgen Exner" <jurgenex@hotmail.com> writes:
> Petr Vileta wrote:
> > Hmm Gunnar, this is not programmer problem but national alphabet
> > problem. Many nations have 'Ch' as simple character. For example
> > Czech alphabet is A
> [...]
> > C
> [...]
> > H
> > CH
> > As I know the similar problem is in Spanish and some other languages.
> > The Spanish first name Chita sound as english wroted Khyta, then miss
> > Chita Castro must be transformed to ChCastro, not to CCastro.
> 
> This alphabet has single 'C' and 'H' as individual characters, too. How do 
> you -as a human(!)- know, if the first is supposed to be 'C' or 'Ch'?
> 

Well, For Czech, my best guess is that it is contextual - fortunately,
we humans have evolved giant pattern matching brains.

As to Spanish, that changed a few years ago.

--=-=-=
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: 8bit


There is, for lack of a better term, a standards body that oversees
the Spanish Language :) Kinda like the Acadamie Française, but more
fun.  They decided in 1994 to eliminte CH LL and RR as distinct
letters, but N and Ñ still are.

I can't think of any words where the consonants C and H are adjacent
without them being a Ch, but I'm sure it's a trivia question
somewhere.

-- 
	Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g Computer
software consists of only two components: ones and zeros, in roughly
equal proportions.  All that is required is to place them into the
correct order.

--=-=-=--


------------------------------

Date: Mon, 7 May 2007 04:42:10 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon May  7 2007
Message-Id: <JHnMEA.1wxD@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Catalyst-Model-DBI-0.16
http://search.cpan.org/~alexp/Catalyst-Model-DBI-0.16/
DBI Model Class
----
Catalyst-Plugin-MobileUserID-0.01
http://search.cpan.org/~miyazaki/Catalyst-Plugin-MobileUserID-0.01/
mobile user id returned plugin for Catalyst
----
Class-Data-Accessor-0.04000
http://search.cpan.org/~claco/Class-Data-Accessor-0.04000/
Inheritable, overridable class and instance data accessor creation
----
Config-Hierarchical-0.03
http://search.cpan.org/~nkh/Config-Hierarchical-0.03/
Hierarchical configuration container
----
File-ExtAttr-1.04
http://search.cpan.org/~richdawe/File-ExtAttr-1.04/
Perl extension for accessing extended attributes of files
----
HTTP-MobileUserID-0.01
http://search.cpan.org/~miyazaki/HTTP-MobileUserID-0.01/
mobile user ID is returned
----
JSON-1.13
http://search.cpan.org/~makamaka/JSON-1.13/
parse and convert to JSON (JavaScript Object Notation).
----
Lemonldap-NG-Manager-0.65
http://search.cpan.org/~guimard/Lemonldap-NG-Manager-0.65/
Perl extension for managing Lemonldap::NG Web-SSO system.
----
Module-Packaged-Report-0.03
http://search.cpan.org/~szabgab/Module-Packaged-Report-0.03/
Generate report upon packages of CPAN distributions
----
Module-Packaged-Report-0.04
http://search.cpan.org/~szabgab/Module-Packaged-Report-0.04/
Generate report upon packages of CPAN distributions
----
Perl6-Say-0.09
http://search.cpan.org/~jkeenan/Perl6-Say-0.09/
print -- but no newline needed
----
RRDTool-Creator-0.3
http://search.cpan.org/~jacquelin/RRDTool-Creator-0.3/
Creators for round robin databases (RRD)
----
Statistics-Lite-3.1
http://search.cpan.org/~brianl/Statistics-Lite-3.1/
Small stats stuff.
----
Tie-Handle-CSV-0.06
http://search.cpan.org/~danboo/Tie-Handle-CSV-0.06/
easy access to CSV files
----
WWW-Scraper-ISBN-TWSanmin_Driver-0.02
http://search.cpan.org/~ijliao/WWW-Scraper-ISBN-TWSanmin_Driver-0.02/
Search driver for TWSanmin's online catalog.
----
Weather-Underground-StationHistory-v1.0.3
http://search.cpan.org/~elliotjs/Weather-Underground-StationHistory-v1.0.3/
Utility functions for dealing with weather station historical data from <http://wunderground.com>.
----
WordNet-QueryData-1.46
http://search.cpan.org/~jrennie/WordNet-QueryData-1.46/
direct perl interface to WordNet database
----
YAML2-0.01
http://search.cpan.org/~ingy/YAML2-0.01/
Next Generation YAML Tools For Perl
----
a2pdf-1.09
http://search.cpan.org/~jonallen/a2pdf-1.09/
converts ASCII text to PDF format, with optional line/page numbering and Perl syntax highlighting
----
a2pdf-1.12
http://search.cpan.org/~jonallen/a2pdf-1.12/
converts ASCII text to PDF format, with optional line/page numbering and Perl syntax highlighting
----
makepp-1.50-cvs-070506
http://search.cpan.org/~pfeiffer/makepp-1.50-cvs-070506/
Compatible but improved replacement for make


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
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: Mon, 07 May 2007 16:16:35 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Select from drop down menu multipel times in the same form
Message-Id: <DhI%h.1794$rk5.880@trndny06>

Michele Dondi wrote:
>> ps2. Asked in PM as well but didnt got an answer.
>
> WELL DONE! (Finally!)
>
> Since nobody here is guaranteed to know what "PM" is,

It's _P_ersonal _M_ail instead of Usenet posting, what else.

> you may want to write "PerlMonks",

ohhhhh

jue 




------------------------------

Date: 7 May 2007 10:48:51 -0700
From: Xicheng Jia <xicheng@gmail.com>
Subject: Re: selecting particular form with field
Message-Id: <1178560131.808727.63720@y5g2000hsa.googlegroups.com>

On May 4, 8:45 am, "Nospam" <nos...@home.com> wrote:
> "Xicheng Jia" <xich...@gmail.com> wrote in message
>
> news:1178227984.721178.270770@n59g2000hsh.googlegroups.com...
>
>
>
> > On May 3, 5:12 pm, "Nospam" <nos...@home.com> wrote:
> > > If I have several forms on a page, can someone confirm, if this would
> > > select/follow the first form with the field username, and set the
> username
> > > field to username:
>
> > > #!usr/bin/perl
> > > use strict;
> > > use warnings;
> > > use WWW::Mechanize;
>
> > > my $mech = WWW::Mechanize->new();
> > > my $url= 'http://www.example.com';
> > > $mech->get($url);
> > >  my @forms = grep {$_->$mech->field()=~ /username/i }$mech->forms();
> > > $mech->form($form[0]);
>
> > > $mech->field('username','username');
>
> > How about:
>
> >   my $theform = $mech->form_with_fields('username');
> >   theform->attr('username', 'username') if defined $theform;
>
> > (untested)
>
> > Regards,
> > Xicheng
>
> Unfortunately it doesn't work
>
> I can access the form if  I have a few conditionals:
>
>  $mech->form(0) || $mech->form(1);
>
> but I do not understand why I am unable to access the form if I amend it a
> little:
>
> my $theform = $mech->form_with_fields('username','password');
>  $mech->form($theform) || $mech->form(0) || $mech->form(1);
>
> or
>
>  $mech->form_with_fields('username','password') || $mech->form(0) ||
> $mech->form(1);
>
> Can't access the form at all with form_with_fields

I dont know (how|if) 'form_with_fields' works, probably you can try it
some other ways, there are many functions in WWW::Mechanize and
HTML::Form. the following code might find the first form with
'username' field and set the corresponding value to 'myname', and then
quit from searching similar forms.

foreach ( $mech->forms() ) {
    if (defined $_->find_input('username')) {
        $_->value('username', 'myname');
        last;
    }
}

Regards,
Xicheng



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 413
**************************************


home help back first fref pref prev next nref lref last post