[22601] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4822 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 6 18:05:37 2003

Date: Sun, 6 Apr 2003 15:05:08 -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           Sun, 6 Apr 2003     Volume: 10 Number: 4822

Today's topics:
    Re: <script language=PerlScript> for Mozilla initiative <jurgenex@hotmail.com>
    Re: <script language=PerlScript> for Mozilla initiative <founder@pege.org>
    Re: <script language=PerlScript> for Mozilla initiative <jurgenex@hotmail.com>
    Re: <script language=PerlScript> for Mozilla initiative <tony_curtis32@yahoo.com>
    Re: <script language=PerlScript> for Mozilla initiative <flavell@mail.cern.ch>
    Re: <script language=PerlScript> for Mozilla initiative (Tad McClellan)
    Re: <script language=PerlScript> for Mozilla initiative <dorward@yahoo.com>
    Re: <script language=PerlScript> for Mozilla initiative <founder@pege.org>
    Re: <script language=PerlScript> for Mozilla initiative <founder@pege.org>
    Re: <script language=PerlScript> for Mozilla initiative <founder@pege.org>
    Re: <script language=PerlScript> for Mozilla initiative <No_4@dsl.pipex.com>
    Re: CGI syntax error?  What syntax error? (Caie)
        CGI::ContactForm 1.11 released <noreply@gunnar.cc>
        CGI::ContactForm 1.11 <noreply@gunnar.cc>
    Re: Checkbox  Values Into a DB <wsegrave@mindspring.com>
    Re: Checkbox  Values Into a DB <wsegrave@mindspring.com>
    Re: CHMOD problems <abigail@abigail.nl>
        Expect.pm: interact() only returns after a timeout & te <hugo@larve.net>
    Re: Fusebox like framework <troc@netrus.net>
    Re: LWP post problem <mbudash@sonic.net>
        maps and regexs <acm2@ukc.ac.uk>
    Re: maps and regexs <grazz@nyc.rr.com>
    Re: maps and regexs (Tad McClellan)
    Re: perl's expat.so <No_4@dsl.pipex.com>
        Sporadic failures of Google API from Perl CGI (Caie)
    Re: Substitution won't match for me (Tad McClellan)
    Re: transfera file server to server <jurgenex@hotmail.com>
    Re: transfera file server to server <me@privacy.net>
        trying to do date parsing <ericosman@rcn.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 06 Apr 2003 15:19:20 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: <script language=PerlScript> for Mozilla initiative
Message-Id: <YzXja.12322$7w2.8395@nwrddc01.gnilink.net>

Roland Mösl wrote:
> Reusing browser technology
>
> Why invent an own GUI,
> when HTML and a common browser has
> everything necessary for a GUI?
>
> Why to learn 2 different GUI concepts like
> TK and HTML, when one would do the same job?

Except that HTML is a text markup language and has nothing whatsoever to do
with the User Interface for an application.

jue




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

Date: Sun, 6 Apr 2003 17:24:47 +0200
From: =?iso-8859-1?Q?Roland_M=F6sl?= <founder@pege.org>
Subject: Re: <script language=PerlScript> for Mozilla initiative
Message-Id: <3e90467e$0$37566$91cee783@newsreader02.highway.telekom.at>

"Jürgen Exner" <jurgenex@hotmail.com> wrote in message
news:YzXja.12322$7w2.8395@nwrddc01.gnilink.net...
> Roland Mösl wrote:
> > Reusing browser technology
> >
> > Why invent an own GUI,
> > when HTML and a common browser has
> > everything necessary for a GUI?
> >
> > Why to learn 2 different GUI concepts like
> > TK and HTML, when one would do the same job?
>
> Except that HTML is a text markup language and has nothing whatsoever to
do
> with the User Interface for an application.

Can You make menus in HTML?
Can You make forms in HTML?

I think You better learn the possibilities of HTML before posting here


--
Roland Mösl
http://www.pege.org Clear targets for a confused civilization
http://web-design-suite.com Web Design starts at the search engine



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

Date: Sun, 06 Apr 2003 15:50:45 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: <script language=PerlScript> for Mozilla initiative
Message-Id: <p1Yja.12391$7w2.9678@nwrddc01.gnilink.net>

Roland Mösl wrote:
> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
> news:YzXja.12322$7w2.8395@nwrddc01.gnilink.net...
>> Roland Mösl wrote:
>>> Reusing browser technology
>>>
>>> Why invent an own GUI,
>>> when HTML and a common browser has
>>> everything necessary for a GUI?
>>>
>>> Why to learn 2 different GUI concepts like
>>> TK and HTML, when one would do the same job?
>>
>> Except that HTML is a text markup language and has nothing
>> whatsoever to do with the User Interface for an application.
>
> Can You make menus in HTML?

No, you can not. That requires DHTML.

> Can You make forms in HTML?

No, you cannot. That requires DHMTL

> I think You better learn the possibilities of HTML before posting here

Why would you need to know HTML to post to a Perl NG?

jue




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

Date: Sun, 06 Apr 2003 10:52:59 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: <script language=PerlScript> for Mozilla initiative
Message-Id: <87brzjzkpw.fsf@limey.hpcc.uh.edu>

>> On Sun, 6 Apr 2003 17:24:47 +0200,
>> Roland Mösl <founder@pege.org> said:

> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
>> 
>> Except that HTML is a text markup language and has
>> nothing whatsoever to
> do
>> with the User Interface for an application.

> Can You make menus in HTML?  Can You make forms in HTML?

You can construct HTML markup that allows a user-agent to
render the information contained in the markup.  I can
make a screenshot of a database client.  Therefore a JPG
image is a database client?

> I think You better learn the possibilities of HTML
> before posting here

I'm afraid you don't know what you're talking about, nor
to whom you are talking.


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

Date: Sun, 6 Apr 2003 17:54:11 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: <script language=PerlScript> for Mozilla initiative
Message-Id: <Pine.LNX.4.53.0304061743430.11812@lxplus094.cern.ch>

On Sun, Apr 6, Roland Mösl boldly addressed "Jürgen Exner"
<jurgenex@hotmail.com>:

> Can You make menus in HTML?
> Can You make forms in HTML?

Can you make a government by printing a ballot paper?

You can _make_ them with HTML; but they don't _do_ anything without a
shedload more than mere HTML markup.  Such as server-side scripts...

> I think You better learn the possibilities of HTML before posting here

I think it would be advisable not to harangue those who understand
the naming of parts better than you seem to.

If you wanted to make the point that it's possible to use a web
browser as a user interface, then feel free to make it; but don't
confuse that with HTML markup alone.


-- 

           There already is a perfectly straightforward way to
           inflict internationally ambiguous dates on your readers
                                  -    Stewart Gordon on c.i.w.a.h


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

Date: Sun, 6 Apr 2003 15:36:47 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: <script language=PerlScript> for Mozilla initiative
Message-Id: <slrnb913uv.f17.tadmc@magna.augustmail.com>

Roland Mösl <founder@pege.org> wrote:
> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
> news:YzXja.12322$7w2.8395@nwrddc01.gnilink.net...
>> Roland Mösl wrote:
>> > Reusing browser technology
>> >
>> > Why invent an own GUI,
>> > when HTML and a common browser has
>> > everything necessary for a GUI?
>> >
>> > Why to learn 2 different GUI concepts like
>> > TK and HTML, when one would do the same job?
>>
>> Except that HTML is a text markup language and has nothing whatsoever to
> do
>> with the User Interface for an application.
> 
> Can You make menus in HTML?
> Can You make forms in HTML?
> 
> I think You better learn the possibilities of HTML before posting here


I think you better learn what you are talking about before
attempting to talk about it.


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


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

Date: Sun, 06 Apr 2003 21:38:42 +0100
From: David Dorward <dorward@yahoo.com>
Subject: Re: <script language=PerlScript> for Mozilla initiative
Message-Id: <b6q39i$l04$1$8300dec7@news.demon.co.uk>

Jürgen Exner wrote:

>> Can You make menus in HTML?
> 
> No, you can not. That requires DHTML.

DHTML. What a useful buzzword

<ul>
<li><a href="1.html">1</a></li>
<li><a href="2.html">2</a></li>
<li><a href="3.html">3</a></li>
</ul>

Looks like a menu when I open it in a browser.

>> Can You make forms in HTML?
> 
> No, you cannot. That requires DHMTL

<form method="get" action="http://localhost/">
<div>
<label>Search Terms: <input type="text" name="q"></label>
<input type="submit">
</div>
</form>

Looks like a form when I open it in a browser (not that it will do anything
without a form handler, but that hardly needs the tools commonly referred
to by the buzzword 'DHTML').

>> I think You better learn the possibilities of HTML before posting here
> 
> Why would you need to know HTML to post to a Perl NG?

He could have been referring to netscape.public.mozilla.layout, it was a
cross posted message without followups set.

-- 
David Dorward                                   http://david.us-lot.org/
"You cannot rewrite history, not one line."
                                      - The Doctor (Dr. Who: The Aztecs)


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

Date: Sun, 6 Apr 2003 22:45:26 +0200
From: =?iso-8859-1?Q?Roland_M=F6sl?= <founder@pege.org>
Subject: Re: <script language=PerlScript> for Mozilla initiative
Message-Id: <3e9091df$0$41844$91cee783@newsreader02.highway.telekom.at>

> > I think You better learn the possibilities of HTML
> > before posting here
>
> I'm afraid you don't know what you're talking about, nor
> to whom you are talking.

I am talking with somebody complete uninformed about PerlScript

And I make my living with an application programed in PerlScript.

But I thought it would be nice to use Linux.
So I thought to start an initiative to implement this possibility in
Mozilla.

But seems Mozilla people are to arrogant for a nice proposal


--
Roland Mösl
http://www.pege.org Clear targets for a confused civilization
http://web-design-suite.com Web Design starts at the search engine



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

Date: Sun, 6 Apr 2003 22:42:55 +0200
From: =?iso-8859-1?Q?Roland_M=F6sl?= <founder@pege.org>
Subject: Re: <script language=PerlScript> for Mozilla initiative
Message-Id: <3e9091de$0$41844$91cee783@newsreader02.highway.telekom.at>

"Alan J. Flavell" <flavell@mail.cern.ch> wrote in message
news:Pine.LNX.4.53.0304061743430.11812@lxplus094.cern.ch...
> On Sun, Apr 6, Roland Mösl boldly addressed "Jürgen Exner"
> <jurgenex@hotmail.com>:
>
> > Can You make menus in HTML?
> > Can You make forms in HTML?
>
> Can you make a government by printing a ballot paper?
>
> You can _make_ them with HTML; but they don't _do_ anything without a
> shedload more than mere HTML markup.  Such as server-side scripts...

Seems You do not know what PerlScript means

<script language=PerlScript>

# You do not need server side scripts
# You can put all the scripts here

</script>

But that's only possible in Microsoft Internet Explorer.
Any it seems You do not want to change, that MSIE
is the only browser with this advantage


--
Roland Mösl
http://www.pege.org Clear targets for a confused civilization
http://web-design-suite.com Web Design starts at the search engine



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

Date: Sun, 6 Apr 2003 22:46:21 +0200
From: =?iso-8859-1?Q?Roland_M=F6sl?= <founder@pege.org>
Subject: Re: <script language=PerlScript> for Mozilla initiative
Message-Id: <3e9091e1$0$41844$91cee783@newsreader02.highway.telekom.at>

> > I think You better learn the possibilities of HTML before posting here
>
> Why would you need to know HTML to post to a Perl NG?

Because it's a better was to make with Perl a GUI


--
Roland Mösl
http://www.pege.org Clear targets for a confused civilization
http://web-design-suite.com Web Design starts at the search engine



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

Date: Sun, 06 Apr 2003 22:27:22 +0100
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: <script language=PerlScript> for Mozilla initiative
Message-Id: <3e909bbb$0$4851$cc9e4d1f@news.dial.pipex.com>

Roland Mösl wrote:
 >
> I am talking with somebody complete uninformed about PerlScript
> 
> And I make my living with an application programed in PerlScript.
> 
> But I thought it would be nice to use Linux.
> So I thought to start an initiative to implement this possibility in
> Mozilla.
> 
> But seems Mozilla people are to arrogant for a nice proposal

    Or perhaps you are too arrogant to change your ways to using 
"standard" Web languages (HTML + JavaScript) rather than using 
vendor-specific tie-ins?

    Sending Perl code for a Web browser to run sounds like a potential 
security problem (you are right - I know nothing about it).  Mind you, 
security has never been a consideration for Microsoft when working out 
how client software should behave - much of it is still in the state of 
"if I've received it from a server the it must be OK".

-- 
      -*-    Just because I've written it here doesn't    -*-
      -*-    mean that you should, or I do, believe it.   -*-



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

Date: 6 Apr 2003 11:40:32 -0700
From: the_caie@hotmail.com (Caie)
Subject: Re: CGI syntax error?  What syntax error?
Message-Id: <87d7d0df.0304061040.684e4a78@posting.google.com>

Thanks all for your suggestions, works fine and dandy - caught out by
a rookie error.  Curses!

Caie


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

Date: Sun, 06 Apr 2003 17:30:57 GMT
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: CGI::ContactForm 1.11 released
Message-Id: <bd0c008d39178aebb735fe2793a92da0@news.teranews.com>

CGI::ContactForm is a module for generating web contact forms. It lets
you create an unlimited number of forms with a minimum of effort, and
makes it possible for e.g. web hosting providers to offer their
customers an easy way to set up a contact form.

After valuable feedback at comp.lang.perl.misc, the HTML markup is now
fully customizable via templates.

Why publish your email address everywhere, and expose yourself to
spam, when you well can be available via links to a contact form?

      http://search.cpan.org/author/GUNNAR/

Enjoy!

/ Gunnar

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




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

Date: Sun, 06 Apr 2003 21:28:13 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: CGI::ContactForm 1.11
Message-Id: <b6pvdr$7ujko$1@ID-184292.news.dfncis.de>

CGI::ContactForm is a module for generating web contact forms. It lets
you create an unlimited number of forms with a minimum of effort, and
makes it possible for e.g. web hosting providers to offer their
customers an easy way to set up a contact form.

      http://search.cpan.org/author/GUNNAR/

After valuable feedback at comp.lang.perl.misc, the HTML markup is now
fully customizable via templates. Special thanks to Tore Aursand and
Bill Segraves for their suggestions and advise.

/ Gunnar

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


-- 
PLEASE NOTE: comp.infosystems.www.authoring.cgi is a
SELF-MODERATED newsgroup. aa.net and boutell.com are
NOT the originators of the articles and are NOT responsible
for their content.

HOW TO POST to comp.infosystems.www.authoring.cgi:
http://www.thinkspot.net/ciwac/howtopost.html


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

Date: Sun, 6 Apr 2003 13:21:39 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: Checkbox  Values Into a DB
Message-Id: <b6pro5$bsn$1@slb0.atl.mindspring.net>

"Jessica" <jessicak@nac.net> wrote in message
news:3e8f582e$1_1@nntp2.nac.net...
> Hi,
>
> I'm using Perl to input results of a form into a MySQL database.
>
> I'm using the CGI module
>
> The problem is with the checkbox's (Box1 name="interests"
> value="hiking", Box2 name="interests" value="skiing", Box3
> name="interests" value="swiming" etc...
>
> Everything else on the form is working but with the checkbox values I'm
> only getting the first checked value put into the DB. I know that this
> probably has something to do with arrays but I'm clueless as what to do
> about looping through it to get a string to put into a variable (with a
> space between each value) that I can put into the db.
>
> Any one have a snippet of code and could you give a brief description of
> what it's doing??

Jessica, you haven't shown us your code; but ...

In CGI.htm, search for "A Simple Example" to see how CGI.pm treats multiple
values, e.g., from a Checkbox.

 print join(", ",param('words'));

returns comma (and space) - separated value(s) of 'words'. If you want
space-separated, just delete the comma (in quotes in the join statement).

Good luck.

Bill Segraves





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

Date: Sun, 6 Apr 2003 13:29:43 -0500
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: Checkbox  Values Into a DB
Message-Id: <b6pro6$bsn$2@slb0.atl.mindspring.net>

"Michael Budash" <mbudash@sonic.net> wrote in message
news:mbudash-F870A9.20143205042003@typhoon.sonic.net...
<snip>
> > Pass the param() method a single argument to fetch the value of the
named
> > parameter. If the parameter is multivalued (e.g. from multiple
selections in
> > a scrolling list), you can ask to receive an array. Otherwise the method
will
> > return a single value.

While this is a direct quote from CGI.htm and is indeed true, it can be
misleading, as param() returns multiple values when they exist, as with a
Checkbox, provided the returned value(s) are treated correctly.

In the Abstract of the same documentation, the example, "A Simple Search",
shows the correct way to handle value(s) returned by param(), e.g.,

     "The keywords are: ",em(join(", ",param('words'))),

Cheers.

Bill Segraves









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

Date: 06 Apr 2003 20:44:04 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: CHMOD problems
Message-Id: <slrnb914ck.ias.abigail@alexandra.abigail.nl>

Joe Smith (inwap@inwap.com) wrote on MMMDV September MCMXCIII in
<URL:news:hATja.7328$io.274968@iad-read.news.verio.net>:
()  In article <u9llz8372y.fsf@wcl-l.bham.ac.uk>,
()  Brian McCauley  <nobull@mail.com> wrote:
() >"David S." <southtownoutkast777@hotmail.com> writes:
() >> for ($k=0; $k<@files; $k++) {
() >>     chmod 0755, $files[$k];
() >> }
() >
() >  You used a 'for' for no reason.  chmod() takes a list of filenames.
()  
()    chmod 0755,@files or warn "chmod() failed a file, guess which one";


If chmod returns 0, chmod failed on *all* files. You mean:

    @files == chmod 0755 => @files or warn "chmod() failed at least a file";


Abigail
-- 
$_ = "\112\165\163\1648\141\156\157\164\150\145\1628\120\145"
   . "\162\1548\110\141\143\153\145\162\0128\177"  and &japh;
sub japh {print "@_" and return if pop; split /\d/ and &japh}


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

Date: Sun, 6 Apr 2003 19:47:18 +0200
From: Hugo Haas <hugo@larve.net>
Subject: Expect.pm: interact() only returns after a timeout & terminal size and resizing are broken
Message-Id: <3e906826$0$26877$626a54ce@news.free.fr>

Hi.

I am trying to do something rather simple:

  use Expect;
  my @command = ('slrn', '-h', 'foobar');
  my $eslrn = Expect->spawn(@command);
  $eslrn->expect(10, 'Password:') || die $eslrn->exp_error()."\n";
  print $eslrn "barfoo\r";
  $eslrn->interact();
  exit;

I have 2 problems:

1. Once I quit slrn, it seems that interact() waits about 30 seconds
   for something something to time out and I haven't figured out what
   it is nor how to force it to return.
   Calling soft_close() or hard_close() doesn't do anything, since I
   think that "$eslrn->interact();" hasn't returned.

2. It seems that the terminal size is always set to 80x24, whatever the
   actual size is, and resizing is broken.

Any idea?

Regards,

Hugo

-- 
Hugo Haas - http://larve.net/people/hugo/


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

Date: Sun, 06 Apr 2003 20:54:14 -0000
From: Rocco Caputo <troc@netrus.net>
Subject: Re: Fusebox like framework
Message-Id: <slrnb914vf.g9.troc@eyrie.homenet>

On Sun, 06 Apr 2003 02:24:58 GMT, Bob X wrote:
> Is there a fusebox (www.fusebox.org) type framework for Perl out there
> somewhere?

There's POE, but it's not specifically for web applications, and it
doesn't enforce a particular programming methodology.  Rather, it
follow's Perl's philosophy of "There's More Than One Way to Do It".

POE's often used as a toolkit for frameworks with more specific
application domains and design philosophies.  Search for
POE::Component at http://search.cpan.org/

-- Rocco Caputo - troc@pobox.com - http://poe.perl.org/


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

Date: Sun, 06 Apr 2003 17:25:51 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: LWP post problem
Message-Id: <mbudash-0B897C.10255206042003@typhoon.sonic.net>

In article <bfe227db.0304060401.42de237e@posting.google.com>,
 chacrint@hotmail.com (Chacrint Charinthorn) wrote:

> Michael Budash <mbudash@sonic.net> wrote in message 
> news:<mbudash-1854CA.11224705042003@typhoon.sonic.net>...
> > In article <bfe227db.0304050253.559dd87b@posting.google.com>,
> >  chacrint@hotmail.com (Chacrint Charinthorn) wrote:
> > 
> > > I tried to post using LWP but I got the following error:
> > > 
> > > 500 (Internal Server Error) Can't read entity body: Connection reset by 
> > > peer
> > > 
> > > is it the problem with the problem I tried to post to?
> > 
> > what happens when you try to post to the url using a standard web form 
> > in a browser? what do you see?
> > 
> > hth-
> 
> I see the actual content as follow
> 
> Status=0

maybe we'd better see a _small_ exceprt of the pertinent part of your 
code...

-- 
Michael Budash


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

Date: Sun, 06 Apr 2003 18:52:41 +0100
From: Tony McNulty <acm2@ukc.ac.uk>
Subject: maps and regexs
Message-Id: <oprm7yl31i2czp9w@news.ukc.ac.uk>

Hi,

I have a string as such: "thisismystring" and want to analyse the letters 
in sets of threes. I'm also learning more about maps and regexs too at the 
moment, and wanted to do this using either of the two.

I want to analyse the first three characters, then shift one char forward, 
and repeat, so that i process "thi", "his", "ism", "smy", etc.,

The question I am asking essentially is: when using a map to process an 
array, is there a way of accessing other elements other than the current 
one? I'd like to convert my string into an array, and calculate my new 
element based upon the sets of three chars (as shown above)

Alternatively, if I was to use a regex in a substitution like:

$string =~ s/(\w)(\w)(\w)/... some calculation to modify $2/ge

 ..but with the sets of three previously shown, instead of the groups "thi", 
"sis", "mys", etc., (which I can do ok)

Sorry if this doesn't make sense, I'm just looking for a pointer really as 
to how I can go about this using either a map, or a regex. I know how to 
write code to do this without them, it's more of a learning experience in 
using maps, or regexs.

Cheers,

Tony

--------------------------------------
web:   http://mercutio.digitalrice.com
email: mercutio at digitalrice dot com
--------------------------------------


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

Date: Sun, 06 Apr 2003 18:24:39 GMT
From: Steve Grazzini <grazz@nyc.rr.com>
Subject: Re: maps and regexs
Message-Id: <Hh_ja.3146$Tu4.1490512@twister.nyc.rr.com>

Tony McNulty <acm2@ukc.ac.uk> wrote:
> 
> I have a string as such: "thisismystring" [...]  I want to analyse
> the first three characters, then shift one char forward, and repeat,
> so that i process "thi", "his", "ism", "smy", etc.,
> 
> [...] when using a map to process an array, is there a way of
> accessing other elements other than the current one? I'd like to
> convert my string into an array, and calculate my new element based
> upon the sets of three chars (as shown above)

The map() function processes a *list* not an array.  And there's no 
way to look at the previous or next element of that list -- but you 
can use map() on a list of array indexes, e.g.

    $ perl -l
    my @a = split //, "thisismystring";
    my @b = map "@a[$_-2 .. $_]", 2..$#a;
    print for @b
    ^D
    t h i
    h i s
    s i m
    s m y
    ...

> 
> Alternatively, if I was to use a regex in a substitution like:
> 
> $string =~ s/(\w)(\w)(\w)/... some calculation to modify $2/ge
> 
> ..but with the sets of three previously shown, instead of the 
> groups "thi", "sis", "mys", etc., (which I can do ok)

You can do something like that with pos() and m//g

    $ perl -l
    $_ = "thisismystring";
    pos() -= 2, print $1 while m/(\w{3})/g
    ^D
    thi
    his
    sim
    smy
    ...

There are several reasons why this approach won't work with s///g,
though.  What are you actually trying to do?

-- 
Steve


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

Date: Sun, 6 Apr 2003 15:32:38 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: maps and regexs
Message-Id: <slrnb913n6.f17.tadmc@magna.augustmail.com>

Tony McNulty <acm2@ukc.ac.uk> wrote:

> I have a string as such: "thisismystring" and want to analyse the letters 
> in sets of threes. I'm also learning more about maps and regexs too at the 
> moment, and wanted to do this using either of the two.


> I'm just looking for a pointer really as 
> to how I can go about this using either a map, or a regex.


   foreach my $str3 ( map substr($string, $_, 3), 0..length($string)-3 ) {


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


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

Date: Sun, 06 Apr 2003 21:49:43 +0100
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: perl's expat.so
Message-Id: <3e9092e8$0$4844$cc9e4d1f@news.dial.pipex.com>

Steven N. Hirsch wrote:

>>> libexpat.so.0: open failed: No such file or directory at 
>>> ...perl-5.6.0/SunOS5.6/lib/5.6.0/sun4-solaris-thread-multi/DynaLoader.pm 
>>> line 200, <F> line 5.
>>...
> Actually, the semantics vary by platform.  On AIX, for example, changes 
> to LIBPATH do affect the current process.

    Perhaps, but you'll notice that LIBPATH is not LD_LIBRARY_PATH (but 
then again, AIX ain't Unix) and the OP was quoting a Solaris system.

    All the more reason to the the Right Thing and get the location 
added in to the shared lib at link time.

-- 
      -*-    Just because I've written it here doesn't    -*-
      -*-    mean that you should, or I do, believe it.   -*-



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

Date: 6 Apr 2003 12:01:16 -0700
From: the_caie@hotmail.com (Caie)
Subject: Sporadic failures of Google API from Perl CGI
Message-Id: <87d7d0df.0304061101.4e9fdf7@posting.google.com>

G'day,

I've been having a little trouble of late with the GoogleAPI (using
SOAP::Lite).  The code below is a subroutine within the script.

<kerchunk>

# Grab our search term	
my $search_sentence = $_[0];
# HARD CODED KEY
my $key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
my $query = $search_sentence;
my $google_start_results = '0';			# Start Results
my $google_max_results   = '10';		# Max Results
my $google_filter        = 'false';		# Filter
my $google_restrict      = '';			# Restrict
my $google_safe_search   = 'false';		# Safe Search
my $google_lr            = '';			# lr
my $google_ie            = 'latin1';	# ie
my $google_oe            = 'latin1';	# oe

my $googleSearch = SOAP::Lite -> service
(http://api.google.com/GoogleSearch.wsdl") or die "SOAP problem\n";

my $result = $googleSearch ->doGoogleSearch($key, $query,
google_start_results, $google_max_results, $google_filter,
$google_restrict, $google_safe_search, $google_lr, $google_ie,
$google_oe) or die "Unable to search Google";
	
# Make a return variable
my @return_url = ();
my $counter = 0;
foreach my $hit (@{$result->{'resultElements'}}) {
     $return_url[$counter] = $hit->{'URL'};
     $counter++;
}

# If there are less than 10 URLs then add in 
enough null values to make up to 10
while($counter < 10) {
     $counter++;
     $return_url[$counter] = 0;
}

# Return the URLs and null values found
return(@return_url);

</kerchunk>

This works brilliant off the command line, no problems whatsoever.  I
then made the script into a Perl module and starting developing a cgi
script which would be able to use this method of searching and
returning 10 URLs.  The script works great if this subroutine is only
called 40 times in the program.  When it hits around 50-150 searches
it will fail - never at the same point and I get a "500 Error",
leaving me to check the LOG file that is being generated to see where
it failed.

Does anyone have any idea why this might be happening?  
Anyone experienced something similar?

Cheers for any insights you have brainiacs,

Caie


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

Date: Sun, 6 Apr 2003 15:26:53 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Substitution won't match for me
Message-Id: <slrnb913cd.f17.tadmc@magna.augustmail.com>

Hiro Asari <hiro@asari.net> wrote:
> "Tad McClellan" <tadmc@augustmail.com> wrote in message
> news:slrnb8umve.6ca.tadmc@magna.augustmail.com...
>> Hiro Asari <hiro@asari.net> wrote:
>> > "Steve Ferson" <daNOSPAM_beano@hotmail.com> wrote in message
>> > news:m1Aja.173$Kc3.26@newsfep3-gui.server.ntli.net...
>>
>>
>> >> $input =~ s/(<message>.*)\n(.*<\/message>)/$1<br\/>$2/gsx;
>>
>> > I'm
>> > guessing that you want the /m modifier instead of /s.
>>
>> That cannot possibly be the problem.
>>
>> the /m modifier changes the meaning of the ^ and $ anchors, and
>> the OP's pattern does not use those anchors, so /m would be a
> no-op.


> Tad, you seem to be confusing the problem and the solution.  


No I'm not.

I did not say anything about the problem nor the solution,
I only commented on the non-solution.


> I'd
> identified the problem earilier in my post.  


Yes, and you had it right, which is why I snipped it and said
nothing further about it.


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


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

Date: Sun, 06 Apr 2003 15:16:02 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: transfera file server to server
Message-Id: <SwXja.12314$7w2.6520@nwrddc01.gnilink.net>

primo wrote:
> There are the faculty in CGI/Perl to transfer a file from a remote
> server to a new remote server?
>
> for exemple:
>
> I have "file.htm" in a serverA (url: http://www.old.com )
> location (/user/www/)

See "perldoc LWP" or "perldoc -q HTML": "How do I fetch an HTML file?"

> I want transfer it in a serverB (url: http://www.new.com)
> location (/utent/www/)

The HyperText Transfer Protocol does not support this functionality. You
will have to use other means, e.g. FTP.

jue




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

Date: Mon, 7 Apr 2003 07:44:11 +1000
From: "Tintin" <me@privacy.net>
Subject: Re: transfera file server to server
Message-Id: <b6q73c$7ktqr$1@ID-172104.news.dfncis.de>


"primo" <primo.lgz@tiscali.it> wrote in message
news:YMUja.85616$i26.2599061@news2.tin.it...
> There are the faculty in CGI/Perl to transfer a file from a remote server
to
> a new remote server?
>
> for exemple:
>
> I have "file.htm" in a serverA (url: http://www.old.com )
> location (/user/www/)
> I want transfer it in a serverB (url: http://www.new.com)
> location (/utent/www/)

What protocol?  ssh, ftp, rsync, rdist, kermit, http, https, rcp etc,
etc....




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

Date: Sun, 06 Apr 2003 14:11:44 -0400
From: Eric Osman <ericosman@rcn.com>
Subject: trying to do date parsing
Message-Id: <3E906DE0.8080306@rcn.com>


Hi,

I'm trying to scan a large digest of emails with perl and parse the
dates, and I'm hoping one of you readers can help me out here.

The digest is a bunch of concatenated emails with headers looking
sort of like this:

Date: Sun, 30 Mar 2003 10:30:34 -0800 (PST)
From: someone@somewhere.com
To: someoneelse@somewhereelse.com
Subject: some sort of subject


The part I'm focussing on is the date line.

Because the headers like the above SOMETIMES indicate a new email
message and sometimes are actually a message forwarded within
another message, I wanted to parse the dates.

Then, if I detect a date that isn't monotonically increasing with the
others, I can assume that that header is a forwarded message within
another message.

So far I've found DATE::PARSE which contains

                 strptime(DATE [, ZONE])

to which I can feed

                 Sun, 30 Mar 2003 10:30:34 -0800 (PST)

and it will return and array of

                ($ss,$mm,$hh,$day,$month,$year,$zone)

I've also found TIME::LOCAL which contains

                 timelocal($sec,$min,$hour,$mday,$mon,$year)

to convert into a local arithmetic time value.

But notice that there's not time zone on this last list.

What would be a good thing to use instead of timelocal to convert the
first of the two lists into a local arithmetic time value (so I can
compare two of them easily) .

Or is there a better way of you can think of that I can do this whole
thing of comparing dates in the headers ?

Thanks.  /Eric



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

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.  

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 4822
***************************************


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