[25152] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7401 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Nov 13 14:05:18 2004

Date: Sat, 13 Nov 2004 11:05:05 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 13 Nov 2004     Volume: 10 Number: 7401

Today's topics:
        Any Perl that works offline from WinXP desktop? <me@privacy.net>
    Re: Any Perl that works offline from WinXP desktop? <1usa@llenroc.ude.invalid>
    Re: Any Perl that works offline from WinXP desktop? <jurgenex@hotmail.com>
    Re: Any Perl that works offline from WinXP desktop? <nobull@mail.com>
    Re: Any Perl that works offline from WinXP desktop? <matthew.garrish@sympatico.ca>
    Re: Any Perl that works offline from WinXP desktop? <segraves_f13@mindspring.com>
    Re: backreferneces in search pattern <nobull@mail.com>
    Re: backreferneces in search pattern <usenet@morrow.me.uk>
        creating and validating encrypted password <sam.wun@authtec.net>
    Re: creating and validating encrypted password <nobull@mail.com>
        FAQ 3.18: Is it safe to return a reference to local or  <comdog@panix.com>
        Lisp's "some" and "every" functions (J. Romano)
    Re: Lisp's "some" and "every" functions <perl&nntp@rhesa.com>
    Re: Lisp's "some" and "every" functions <perl&nntp@rhesa.com>
    Re: Lisp's "some" and "every" functions <tassilo.von.parseval@rwth-aachen.de>
    Re: Lisp's "some" and "every" functions <nobull@mail.com>
        Re:backreferneces in search pattern <mstep@t-online.de>
    Re: simple perl script for automatic form submission. <sam.wun@authtec.net>
    Re: Using DBI for Remote myql connection <gnari@simnet.is>
    Re: Using DBI for Remote myql connection <uri@stemsystems.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 13 Nov 2004 07:56:11 -0600
From: M.L. <me@privacy.net>
Subject: Any Perl that works offline from WinXP desktop?
Message-Id: <253cp01ups891n1b0lc8o64ngo95rn6s6s@4ax.com>

Hi. I haven't used Perl for a while and am just trying to get back
into the groove. I'm looking for a Perl program that will allow me to
execute Perl scripts offline on my WinXP desktop. I'd like to be able
to read and write to files on my desktop without installing a server
or being connected to the Internet.

I looked at the ActiveState Perl program and noticed an implementation
of Perlscript via HTML. Can that Perlscript write to and store files
on my desktop?  I remember a program called WinPerl that let me
execute Perl from my desktop but I can't find that app anymore. Any
help here will be appreciated. Thanks.




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

Date: 13 Nov 2004 14:40:20 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Any Perl that works offline from WinXP desktop?
Message-Id: <Xns95A06263E3ED1asu1cornelledu@132.236.56.8>

M.L. <me@privacy.net> wrote in 
news:253cp01ups891n1b0lc8o64ngo95rn6s6s@4ax.com:

> Hi. I haven't used Perl for a while and am just trying to get back
> into the groove. I'm looking for a Perl program that will allow me to
> execute Perl scripts offline on my WinXP desktop. I'd like to be able
> to read and write to files on my desktop without installing a server
> or being connected to the Internet.

You do not need a web server to be able to execute Perl scripts. If you 
installed ActiveState Perl, it will associate files with .pl extension with 
the perl binary and you will be able to execute them by double-clicking on 
the script's icon or name in Explorer. However, I do not recommend this 
unless your script actually use a GUI to interact with the user. Instead, 
open a command window and execute scripts from there.

You can test CGI scripts from the command line as well but for best 
results, I would recommend installing Apache on your machine. You can 
configure it to only respond to requsts from your machine on a non-standard 
port.

> I looked at the ActiveState Perl program and noticed an implementation
> of Perlscript via HTML.

http://aspn.activestate.com/ASPN/docs/ActivePerl/Components/Windows/PerlScr
ipt.html

> Can that Perlscript write to and store files on my desktop?  

That would _probably_ require you to lower security settings which I 
wouldn't recommend. But then, I don't really know.

> I remember a program called WinPerl that let me execute Perl 
> from my desktop but I can't find that app anymore. 

Maybe you are looking for a Perl IDE. It is not my cup of tea, but I have 
heard people mention Open PerlIDE:

http://open-perl-ide.sourceforge.net/

You might also want to look at:

http://faq.perl.org/perlfaq3.html#How_can_I_get_perl_t

http://faq.perl.org/perlfaq3.html#Can_I_write_useful_P

http://faq.perl.org/perlfaq9.html#My_CGI_script_runs_f

And maybe read the full FAQ if you are trying to become up to date.

Sinan


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

Date: Sat, 13 Nov 2004 14:48:59 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Any Perl that works offline from WinXP desktop?
Message-Id: <v9pld.510$N_5.15@trnddc03>

M.L. wrote:
> Hi. I haven't used Perl for a while and am just trying to get back
> into the groove. I'm looking for a Perl program that will allow me to
> execute Perl scripts offline on my WinXP desktop. I'd like to be able
> to read and write to files on my desktop without installing a server
> or being connected to the Internet.

The Perl interpreter doesn't need a "server" (what kind of server?) or an 
"Internet connection" to run. Why would you think it does? After all, Perl 
is not PHP.
Just install a standard Perl installation and run your programs. Or do you 
also require a 'server' to compile and run C programs?

> I looked at the ActiveState Perl program and noticed an implementation
> of Perlscript via HTML. Can that Perlscript write to and store files
> on my desktop?

Why do you want to complicate things? Using PerlScript adds a least two 
additional layers of complexity to your Perl development, not to mention 
that Perl and PerlScript are two different (although related) programming 
languages.

> I remember a program called WinPerl that let me
> execute Perl from my desktop but I can't find that app anymore. Any
> help here will be appreciated. Thanks.

Why don't you just use the standard simple straightforward perl interpreter?

jue 




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

Date: Sat, 13 Nov 2004 15:03:40 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Any Perl that works offline from WinXP desktop?
Message-Id: <cn57gg$oto$1@sun3.bham.ac.uk>



M.L. wrote:

> Hi. I haven't used Perl for a while and am just trying to get back
> into the groove. I'm looking for a Perl program that will allow me to
> execute Perl scripts offline on my WinXP desktop.

All that is required is the Perl interpreter.

However I'm guessing to me that you are confusing Perl and CGI.  If you 
are looking for a browser that can execute CGI scripts locally then 
that's anther matter (and lot related to Perl). But if you want to run 
GCI scripts you are probably better off installing a web server.

> I'd like to be able
> to read and write to files on my desktop without installing a server
> or being connected to the Internet.

The desktop is just a directory.  A program running on you local 
computer can open files in a directly.  And what do you have against 
installing a web server. You've got WinXP for cying out loud!  If you've 
got enough excess resource to run that sort of bloat-ware why shy away 
from adding a small web server program?

> I looked at the ActiveState Perl program and noticed an implementation
> of Perlscript via HTML. Can that Perlscript write to and store files
> on my desktop?

Perlscript is not very widely used.  It can be used to implement client 
side scripting in HTML.  However client side scripting in HTML pages is 
generally not allowed to interact with your local filesystem  - 
otherwise web sites could read all your files.

> I remember a program called WinPerl that let me
> execute Perl from my desktop but I can't find that app anymore. Any
> help here will be appreciated. Thanks.

If you put a Perl script (with a .pl suffix) on your desktop and have 
ActivePerl intalled then simply double clicking on it will execute it.

However I suspect that you mean something else when you say "execute 
Perl from my desktop".  Tell us what that is and we may be able to help you.



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

Date: Sat, 13 Nov 2004 09:53:01 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Any Perl that works offline from WinXP desktop?
Message-Id: <mcpld.47350$Z7.1412270@news20.bellglobal.com>


"M.L." <me@privacy.net> wrote in message 
news:253cp01ups891n1b0lc8o64ngo95rn6s6s@4ax.com...
> Hi. I haven't used Perl for a while and am just trying to get back
> into the groove. I'm looking for a Perl program that will allow me to
> execute Perl scripts offline on my WinXP desktop. I'd like to be able
> to read and write to files on my desktop without installing a server
> or being connected to the Internet.
>

You've never needed a server to run Perl scripts. What exactly is it you're 
trying to do? Run cgi scripts without a server? If so, and in particular if 
you're using the CGI module, you can test them from the command line. Please 
see the documentation:

http://stein.cshl.org/WWW/software/CGI/#debugging

Matt 




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

Date: Sat, 13 Nov 2004 18:43:36 GMT
From: "Bill Segraves" <segraves_f13@mindspring.com>
Subject: Re: Any Perl that works offline from WinXP desktop?
Message-Id: <sBsld.15279$Gm6.13154@newsread3.news.atl.earthlink.net>

"M.L." <me@privacy.net> wrote in message
news:253cp01ups891n1b0lc8o64ngo95rn6s6s@4ax.com...
> Hi. I haven't used Perl for a while and am just trying to get back
> into the groove. I'm looking for a Perl program that will allow me to
> execute Perl scripts offline on my WinXP desktop. I'd like to be able
> to read and write to files on my desktop without installing a server
> or being connected to the Internet.
>

IndigoPerl, available free from www.indigostar.com. After installation,
you'll have Perl and Apache preconfigured. If you don't wish to use the
server, simply don't start it.

Cheers.
--
Bill Segraves




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

Date: Sat, 13 Nov 2004 15:30:16 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: backreferneces in search pattern
Message-Id: <cn592c$pms$1@sun3.bham.ac.uk>



Marek Stepanek wrote:

> On 13/11/2004 01:58, in article btmap0pgsahio7ts0k4abs1pm41opve46v@4ax.com,
> "Eric Amick" <eric-amick@comcast.net> wrote:
> 
> 
>>On Fri, 12 Nov 2004 21:49:03 +0000 (UTC), Hue-Bond
>><responder_solo_en_el_grupo@yahoo.es> wrote:
>>
>>
>>>Marek Stepanek, Fri20041112@20:42:43(CET):
>>>
>>>>while (<>) {
>>>>    my @results =
>>>>m!onmouseover="[^']+'([^']+)'(?:(?:(?:;\s+[^']+)'([^']+)')+)?(?:(?:[^']+)'([
>>>>^']+)')?"!g;
>>>>    foreach $i (0..$#results) {
>>>>        print "'", $i, "',\n";
>>>>        }
>>>>}
>>>>
>>>>but this gives me a funny result :
>>>>
>>>>'0',
>>>>'1',
>>>>'2',
>>>
>>>I think you want to print $results[$i] instead.
>>
>>Better still
>>
>>foreach $i (@results) {
>>    print "'$i'\n";
>>}
>>
>>or even
>>
>>print "'$_'\n" for @results;
> 
> 
> 
> thanx a lot, I am blushing, this was a too silly question :-)
> 
> 
> May I ask one silly question more ? I would like to kill the duplicates of
> this search result and met it in an alphabetical order; is it possible to
> put two scripts in one, working on the result of the first ? I was
> experimenting with something like the following :

You are doing random things without understanding what you are doing. 
You can't just cut and paste fragments of code together and expect them 
to figure out how you want them to interact.  You need to step back and 
learn a few basics of computer programming.

The Perl <> operator reads from the process's input and print() sends 
stuff to the process's output.  If you have two Perl programs written to 
process from input stream to output stream and you want to combine them 
you either have to do some adavanced trickery to redirect input and 
output or you need to actually combine them so that you read from the 
imput, do two things, then write to the output.



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

Date: Fri, 12 Nov 2004 19:36:02 +0000
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: backreferneces in search pattern
Message-Id: <2uff62-mh5.ln1@osiris.mauzo.dyndns.org>


Quoth invalid-email@rochester.rr.com:
> 
> The uninitialized value might have come from a capturing parentheses 
> pair that matched an empty string because it was inside the scope of a 
> "?" metacharacter and the "no occurrences" branch was taken.  Prior to 
> the match, all the $1, $2 etc variables are set to undef, and are only 
> modified upon their corresponding set of parens actually being used in 
> the final match.

This is not true. The $n variables are only modified if the match
succeeded: if the match failed, they will still have the values from the
last *successful* match.

Ben

-- 
'Deserve [death]? I daresay he did. Many live that deserve death. And some die
that deserve life. Can you give it to them? Then do not be too eager to deal
out death in judgement. For even the very wise cannot see all ends.'
                                                               ben@morrow.me.uk


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

Date: Sat, 13 Nov 2004 21:41:46 +0800
From: sam <sam.wun@authtec.net>
Subject: creating and validating encrypted password
Message-Id: <cn54g2$2sp8$1@news.hgc.com.hk>

Hi,

I would like to create encrypted password and stored along with user 
names in a file for login validation.

The password file may be something like this:

bob:NWWH/IZLPwa.c:0::

Is there any example written in perl that I can follow?

Thanks
Sam


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

Date: Sat, 13 Nov 2004 14:44:29 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: creating and validating encrypted password
Message-Id: <cn56ch$oeg$1@sun3.bham.ac.uk>



sam wrote:

> I would like to create encrypted password and stored along with user 
> names in a file for login validation.
> 
> The password file may be something like this:
> 
> bob:NWWH/IZLPwa.c:0::

If the password file is to use the standard Unix crypt() function then 
you would use the Perl builitin function that provides an interface to
Unix crypt() function.  (Guessing the name is left as an exercise for 
the reader).

> Is there any example written in perl that I can follow?

Yes, in the documentation of the aforementioned function.




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

Date: Sat, 13 Nov 2004 17:03:01 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 3.18: Is it safe to return a reference to local or lexical data?
Message-Id: <cn5eo5$ak3$1@reader1.panix.com>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.

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

3.18: Is it safe to return a reference to local or lexical data?

    Yes. Perl's garbage collection system takes care of this so everything
    works out right.

        sub makeone {
            my @a = ( 1 .. 10 );
            return \@a;
        }

        for ( 1 .. 10 ) {
            push @many, makeone();
        }

        print $many[4][5], "\n";

        print "@many\n";



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

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-2002 Tom Christiansen and Nathan
    Torkington, and other contributors as noted. All rights 
    reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.


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

Date: 13 Nov 2004 06:54:29 -0800
From: jl_post@hotmail.com (J. Romano)
Subject: Lisp's "some" and "every" functions
Message-Id: <b893f5d4.0411130654.220f0127@posting.google.com>

Dear Perl community,

   Recently I've been learning some Lisp on my own, and I've come
across two Lisp functions that I wish Perl had:  "some" and "every".

   They work somewhat like "grep" and "map" in that they operate on a
list given a function, but they return only a boolean value.

   For example, in Lisp, to find out if at least one number in a list
is an odd number, you could write:

      (some #'oddp '(1 2 3 4 5))

or even:

      (some (lambda (x) (= 1 (mod x 2))) '(1 2 3 4 5))

   In Perl, you COULD write:

      if ( grep { $_ % 2 == 1 } (1, 2, 3, 4, 5) )
      {
         print "An odd number exists in the given list.\n";
      }

but according to 'perldoc -q "element is contained"', use of "grep" is
undesirable (especially on large lists) because "grep" checks every
element even if the first matches.

   As for the "every" function, you can use it to find out if every
element passes a certain test.  For example, in Lisp you could use it
like this to see if every element in a list is an even number:

      (every #'evenp '(2 4 5 6 8))

or even:

      (every (lambda (x) (= 0 (mod x 2))) '(2 4 5 6 8))

   In Perl, you COULD write:

      my @list = (2, 4, 5, 6, 8);

      if ( @list == grep { $_ % 2 == 0 } @list )
      {
         print "All number in given list are even.\n";
      }

but, of course, this suffers from the same inefficiency as the
previous Perl example.

   This inefficiency is not worth worrying about if the list to
examine has only a few elements, but if it has a large number of
elements (or the number of elements is arbitrary), there exist a few
work-arounds.

   One work-around is mentioned in 'perldoc -q "element is
contained"', so I won't discuss it here.  Another work-around is to
create a module that defines the "some" and "every" functions to be
used similarly to how Perl's "grep" and "map" functions are called. 
I've written the code, and here it is (more discussion follows):


use strict;
use warnings;

sub some (&@)
{
   my $sub = shift(@_);

   foreach (@_)
   {
      return 1  if &$sub;
   }

   return 0;
}

sub every (&@)
{
   my $sub = shift(@_);

   foreach (@_)
   {
      return 0  if not &$sub;
   }

   return 1;
}

1;

__END__


   Now, when this module is "use"d, you can now check for the
existence of an odd number with the "some" function like:

      my @list = (2, 4, 5, 6, 8);

      if ( some { $_ % 2 == 1 } @list )
      {
         print "An odd number exists in the given list.\n";
      }

You can also verify that all the numbers in a list are even numbers
with the "every" function like:

      my @list = (2, 4, 5, 6, 8);

      if ( every { $_ % 2 == 0 } @list )
      {
         print "All number in given list are even.\n";
      }

   These functions don't suffer then same inefficiency discussed in
the perldoc because they will stop examining the list once the "some"
function verifies the answer is true, or the "every" function verifies
that the answer is false.

   A few things to note:

   * The "some" function always returns false on an empty list.
     (because no element exists that passes the test).
   * The "every" function always returns true on an empty list
     (because no element exists that fails the test).
   * These functions always return a true or false (boolean) value.
     They DO NOT return a list, like "map" and "grep" do.
   * These functions must be specified with a block of code.
     In other words, where "grep" can be used like this:
         grep m/^a/i, @list
     or like this:
         grep { m/^a/i } @list
     the "some" and "every" functions can only be used like this:
         some { m/^a/i } @list
         every { m/^a/i } @list


   That's all I have to say on this subject, so Happy Perling!

   -- Jean-Luc Romano


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

Date: Sat, 13 Nov 2004 16:05:15 +0100
From: Rhesa Rozendaal <perl&nntp@rhesa.com>
Subject: Re: Lisp's "some" and "every" functions
Message-Id: <419622a8$0$78772$e4fe514c@news.xs4all.nl>

J. Romano wrote:
> Dear Perl community,
> 
>    Recently I've been learning some Lisp on my own, and I've come
> across two Lisp functions that I wish Perl had:  "some" and "every".
> 
>    They work somewhat like "grep" and "map" in that they operate on a
> list given a function, but they return only a boolean value.
 >
>    One work-around is mentioned in 'perldoc -q "element is
> contained"', so I won't discuss it here.  Another work-around is to
> create a module that defines the "some" and "every" functions to be
> used similarly to how Perl's "grep" and "map" functions are called. 
> I've written the code, and here it is (more discussion follows):
> 

The other work-around would be to use List::Any.
http://search.cpan.org/~vparseval/List-Any-0.03/lib/List/Any.pm

Rhesa


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

Date: Sat, 13 Nov 2004 16:15:47 +0100
From: Rhesa Rozendaal <perl&nntp@rhesa.com>
Subject: Re: Lisp's "some" and "every" functions
Message-Id: <41962520$0$78772$e4fe514c@news.xs4all.nl>

Rhesa Rozendaal wrote:
> J. Romano wrote:
> 
>> Dear Perl community,
>>
>>    Recently I've been learning some Lisp on my own, and I've come
>> across two Lisp functions that I wish Perl had:  "some" and "every".
>>
>>    They work somewhat like "grep" and "map" in that they operate on a
>> list given a function, but they return only a boolean value.
> 
>  >
> 
>>    One work-around is mentioned in 'perldoc -q "element is
>> contained"', so I won't discuss it here.  Another work-around is to
>> create a module that defines the "some" and "every" functions to be
>> used similarly to how Perl's "grep" and "map" functions are called. 
>> I've written the code, and here it is (more discussion follows):
>>
> 
> The other work-around would be to use List::Any.
> http://search.cpan.org/~vparseval/List-Any-0.03/lib/List/Any.pm
> 
> Rhesa

It seems Tassilo merged the code of List::Any into List::MoreUtils.


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

Date: Sat, 13 Nov 2004 16:25:44 +0100
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: Lisp's "some" and "every" functions
Message-Id: <slrncpc9ro.vu.tassilo.von.parseval@localhost.localdomain>

Also sprach Rhesa Rozendaal:

> Rhesa Rozendaal wrote:

>> The other work-around would be to use List::Any.
>> http://search.cpan.org/~vparseval/List-Any-0.03/lib/List/Any.pm
>> 
>> Rhesa
>
> It seems Tassilo merged the code of List::Any into List::MoreUtils.

Not so much merged into but renamed to. I was made aware that
List::MoreUtils would be a better namespace choice. So that means the
latest release is always at 

    http://search.cpan.org/~vparseval/List-MoreUtils/

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Sat, 13 Nov 2004 15:44:04 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Lisp's "some" and "every" functions
Message-Id: <cn59s8$q58$1@sun3.bham.ac.uk>



Tassilo v. Parseval wrote:

> Also sprach Rhesa Rozendaal:
> 
> 
>>Rhesa Rozendaal wrote:
> 
> 
>>>The other work-around would be to use List::Any.
>>>http://search.cpan.org/~vparseval/List-Any-0.03/lib/List/Any.pm
>>>
>>>Rhesa
>>
>>It seems Tassilo merged the code of List::Any into List::MoreUtils.
> 
> 
> Not so much merged into but renamed to. I was made aware that
> List::MoreUtils would be a better namespace choice. So that means the
> latest release is always at 
> 
>     http://search.cpan.org/~vparseval/List-MoreUtils/
> 
> Tassilo

Any chance the old apply() function could find a home there?


=item apply BLOCK LIST

Similar to C<map> in that it evaluates BLOCK setting C<$_> to each
element of LIST in turn.  C<apply> returns a list made up of the
values of C<$_> after BLOCK has been evaluated.  In a scalar context
the last element is returned.  Unlike C<map> and C<grep> the elements
of LIST are not altered.

     @foo = apply { s/\s+/ /g } @bar; # canonicalise whitespace

This function is nothing more than syntactic sugar for people who find
the following syntax unpalatable.

     for (@foo = @bar) { s/\s+/ /g }

=cut

sub apply (&@) {
     my $action = shift;
     &$action for my @values = @_;
     wantarray ? @values : $values[-1];
}



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

Date: Sat, 13 Nov 2004 15:50:31 +0100
From: Marek Stepanek <mstep@t-online.de>
Subject: Re:backreferneces in search pattern
Message-Id: <BDBBDDC7.BB48%mstep@t-online.de>

On 13/11/2004 01:58, in article btmap0pgsahio7ts0k4abs1pm41opve46v@4ax.com,
"Eric Amick" <eric-amick@comcast.net> wrote:

> On Fri, 12 Nov 2004 21:49:03 +0000 (UTC), Hue-Bond
> <responder_solo_en_el_grupo@yahoo.es> wrote:
> 
>> Marek Stepanek, Fri20041112@20:42:43(CET):
>>> 
>>> while (<>) {
>>>     my @results =
>>> m!onmouseover="[^']+'([^']+)'(?:(?:(?:;\s+[^']+)'([^']+)')+)?(?:(?:[^']+)'([
>>> ^']+)')?"!g;
>>>     foreach $i (0..$#results) {
>>>         print "'", $i, "',\n";
>>>         }
>>> }
>>> 
>>> but this gives me a funny result :
>>> 
>>> '0',
>>> '1',
>>> '2',
>> 
>> I think you want to print $results[$i] instead.
> 
> Better still
> 
> foreach $i (@results) {
>     print "'$i'\n";
> }
> 
> or even
> 
> print "'$_'\n" for @results;


thanx a lot, I am blushing, this was a too silly question :-)


May I ask one silly question more ? I would like to kill the duplicates of
this search result and met it in an alphabetical order; is it possible to
put two scripts in one, working on the result of the first ? I was
experimenting with something like the following :


#!/usr/bin/perl -w

use strict;
use warnings;


while (<>) {
    no warnings qw(uninitialized);
    my @results = 
m!onmouseover="[^']+'([^']+)'(?:(?:(?:;\s+[^']+)'([^']+)')+)?(?:(?:[^']+)'([
^']+)')?"!g;
    foreach my $i (0..$#results) {
        print "'$results[$i]',\n";
        my %seen;
            while (<>) {
                $seen{$_}++;
                }
            print sort keys %seen;
        }
}

Also this try is not working :


#!/usr/bin/perl -w

use strict;
use warnings;

while (<>) {
    no warnings qw(uninitialized);
    my @results = 
m!onmouseover="[^']+'([^']+)'(?:(?:(?:;\s+[^']+)'([^']+)')+)?(?:(?:[^']+)'([
^']+)')?"!g;
    foreach my $i (0..$#results) {
        print "'$results[$i]',\n";
        }
}


while (<>) {
        my %seen;
            while (<>) {
                $seen{$_}++;
                }
            print sort keys %seen;
}


Thank you for all your help



marek



-- 
______________________________________________________________________
___PODIUM_INTERNATIONAL_//_the_embassy_for_talented_young_musicians___
_______Marek_Stepanek__mstep_[at]_PodiumInternational_[dot]_org_______
__________________http://www.PodiumInternational.org__________________
______________________________________________________________________







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

Date: Sat, 13 Nov 2004 21:38:00 +0800
From: sam <sam.wun@authtec.net>
Subject: Re: simple perl script for automatic form submission.
Message-Id: <cn5491$2sht$1@news.hgc.com.hk>

Thanks everyone's input, I will play around with that.

Thanks
Sam


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

Date: Sat, 13 Nov 2004 12:22:58 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Using DBI for Remote myql connection
Message-Id: <cn4u6i$sum$1@news.simnet.is>


"Gregory Toomey" <nospam@bigpond.com> wrote in message
news:2vm058F2l8c2bU1@uni-berlin.de...
> Thelma Lubkin wrote:
>
> > I have only Perl on my home system. I would like to connect to a mysql
> > database at a system that doesn't have Perl. I thought I could do this
> > by installing the DBI module. But my attempt to connect apparently
> > failed because I didn't have DBD for mysql installed. When I tried to
> > install that I got error messages that seem to indicate that I need to
> > have mysql installed on my system before I can install that.
>
> [snipped good advice abour confirming connectivity]

> 3. now that we have established connectivity, the standard mysql dbi that
> comes with modern operating systems should be fine.

will still need a mysql DBD module.
the question seems to be how to install the DBD::mysql module without
installing mysql locally.

depending on what your system is, it might be easiest just to install
mysql, then the DBD module.

or, as someone suggested, use the PurePerl version of it.

gnari





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

Date: Sat, 13 Nov 2004 16:33:17 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Using DBI for Remote myql connection
Message-Id: <x7zn1l675f.fsf@mail.sysarch.com>

>>>>> "g" == gnari  <gnari@simnet.is> writes:

  g> "Gregory Toomey" <nospam@bigpond.com> wrote in message
  g> news:2vm058F2l8c2bU1@uni-berlin.de...
  >> Thelma Lubkin wrote:
  >> 
  >> > I have only Perl on my home system. I would like to connect to a mysql
  >> > database at a system that doesn't have Perl. I thought I could do this
  >> > by installing the DBI module. But my attempt to connect apparently
  >> > failed because I didn't have DBD for mysql installed. When I tried to
  >> > install that I got error messages that seem to indicate that I need to
  >> > have mysql installed on my system before I can install that.
  >> 
  >> [snipped good advice abour confirming connectivity]

  >> 3. now that we have established connectivity, the standard mysql dbi that
  >> comes with modern operating systems should be fine.

  g> will still need a mysql DBD module.
  g> the question seems to be how to install the DBD::mysql module without
  g> installing mysql locally.

  g> depending on what your system is, it might be easiest just to install
  g> mysql, then the DBD module.

AFAIK, you can install the mysql client libs without installing all of
mysql. most/all of the db's support that since clients and servers are
often different boxes. so search the mysql site for the client lib
package that suits your needs. then install the mysql DBD. you might
need to download all of mysql but even then you only need to install the
client libs. 

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: 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 V10 Issue 7401
***************************************


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