[16587] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3999 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 13 00:05:49 2000

Date: Sat, 12 Aug 2000 21:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <966139508-v9-i3999@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 12 Aug 2000     Volume: 9 Number: 3999

Today's topics:
        ANNOUNCE: AI::NeuralNet::BackProp version 0.77 <jdb@wcoil.com>
    Re: Auto running a script via email or by a specific ti (David Efflandt)
        convert a variable from 8/12/00 to 8-12-00 <vrillusions@mail.com>
    Re: convert a variable from 8/12/00 to 8-12-00 (Mark-Jason Dominus)
        Hash Reference Won't Print <grichards@flashcom.net>
        Help: libs with Latin-1 or Unicode? <occitan@esperanto.org>
    Re: Help: libs with Latin-1 or Unicode? <flavell@mail.cern.ch>
    Re: How to submit a form from the browsers' address bar (David Efflandt)
    Re: IO::Socket problem (David Efflandt)
        map | grep johnvert@my-deja.com
    Re: Negativity in Newsgroup <joehecht@code4sale.com>
    Re: Negativity in Newsgroup <joehecht@code4sale.com>
    Re: Negativity in Newsgroup <joehecht@code4sale.com>
    Re: newb Q, Our perl guy left!! <michaelsmanley@yahoo.com>
        PerlScript (Active Perl) and COM interfaces <coredog2@hotmail.com>
    Re: Sharing a cookie between two domains..? <elephant@squirrelgroup.com>
    Re: Sort data from text file stu265@my-deja.com
    Re: Sort data from text file <abe@ztreet.demon.nl>
        timing out evals <ptrainor@title14.com>
    Re: Trouble with example (goshawk)
    Re: User-defined hash... <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 13 Aug 2000 00:38:09 GMT
From: "Josiah Bryan" <jdb@wcoil.com>
Subject: ANNOUNCE: AI::NeuralNet::BackProp version 0.77
Message-Id: <8n4qlh$70c$0@206.230.71.53>

Greetings Perlfolk,

Announcing the release of the new AI::NeuralNet::BackProp, version 0.77.

This is also the upgrade release of version 0.42 of the module by the same
name.

Download URL **recomended**:
http://www.josiah.countystart.com/modules/AI/cgi-bin/rec.pl

Or, you can download it from your favorite CPAN mirror under:

$CPAN/authors/id/J/JB/JBRYAN/AI-NeuralNet-BackProp-0.77.zip

File size totals 95764  bytes.


Synopsis:
    use AI::NeuralNet::BackProp;
    my $net = new
AI::NeuralNet::BackProp($layers,$neurons_per_layer,$number_outputs);
    $net->learn(\@input_pattern, \@desired_output_pattern);
    my $array_ref_to_net_output = $net->run(\@test_input_pattern);

Description:
    AI::NeuralNet::BackProp implements a neural network in perl similar to a
feed-foward, back-propagtion network; learning via a mix of a generalization
of the Delta rule and a disection of Hebbs rule. The actual neruons of the
network are implemented via the AI::NeuralNet::BackProp::neuron package.

>From the POD:

This is version 0.77, a complete internal upgrade from version 0.42. A new
feature is the introduction of a randomness factor in the network, optional
to disable. The  restriction on 0s are removed, so you can run any network
you like. Included is an improved learn() function, and a much more accurate
internal fixed-point  system for learning. Also included is automated
learning
of input sets. See learn_set() and learn_rand_set() methods.

>From me now:
Thanks to suggestions from Pat Trainor, I have reworked parts of the
crunch() and uncrunch() methods. uncrunch() now returns a string, and
crunch() now takes a string, instead of a qw()ed word set. Also available is
the ability to handle 0s (Thanx again, Pat). You can also specify an
optional "maximum error" to allow in the learning. If the difference between
the desired result map and actual result map fall below a max error level,
then the learn loop will consider itself done, instead of waiting for an
absolute match. See the included POD docs for usage, look at the options for
learn().

Please give feedbacks on any idea you have for this module. Also, if you can
patch any bugs you think you find, or just tell me about any bugs you find
that I didn't mention in README, I would be grateful!

Always open for new suggestions.

Cheers!


--
Josiah Bryan
VP of Product Development
TDCJ, Inc.
"Anything is possible."

vp@tdcj.com
http://www.josiah.countystart.com/

Tel: 937.316.6256









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

Date: Sat, 12 Aug 2000 20:01:13 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Auto running a script via email or by a specific time??
Message-Id: <slrn8pbb7v.drn.efflandt@efflandt.xnet.com>

On Sat, 12 Aug 2000 03:29:52 GMT, Ryan <ryanmh_99@yahoo.com> wrote:
>Is it possible to run a PERL script in response to an email to a specific 
>email address??  Is it possible to have a script run on a specific time 
>every day??  Thanks for the help
>  Ryan

What OS?  Not that this has anything to do with Perl.

Unix systems typically run 'procmail' (a mail filter) when mail is
received, although, I seem to remember something about it not running
Perl scripts unless you do something special.  Cron can run anything at
specified intervals (see 'man 5 crontab').  But specify required PATH or
use full paths since env may be minimal.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Sun, 13 Aug 2000 02:47:20 GMT
From: Todd Eddy <vrillusions@mail.com>
Subject: convert a variable from 8/12/00 to 8-12-00
Message-Id: <39960C46.4772A900@mail.com>

I want to create a filename that is based on the date, the person I am
making this for insists that the date when displayed uses /s  And I
currently use a simple SSI page to insert the date everywhere, so it has
to go to the cgi script as 8/12/00.  The only way I can think of doing
it is splitting it into 3 different variables, and then reinserting it
as $mo."-".$day."-".$yr.  But there has to be some sort of
search-and-replace like function in cgi.

--
Todd Eddy
vrillusions@mail.com
http://www.vrillusions.com/




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

Date: Sun, 13 Aug 2000 03:17:18 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: convert a variable from 8/12/00 to 8-12-00
Message-Id: <3996133d.55e5$1d@news.op.net>

$filename = '8/12/00';
$filename =~ tr[/][-];   # replace /es with -es
print $filename;



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

Date: Sat, 12 Aug 2000 19:20:21 -0700
From: "Gabe" <grichards@flashcom.net>
Subject: Hash Reference Won't Print
Message-Id: <spc1b63on4t62@corp.supernews.com>

Code follows:

  my $getmsgs = $dbh->prepare(qq{SELECT mid, pid, subject, name FROM
messages});
  $getmsgs->execute;

  my (%msgs, %children);

  while (my @row = $getmsgs->fetchrow_array) {
      my ($id, $pid, $subject, $name) = @row;
      $msgs{$id}{parent} = $pid;
      $msgs{$id}{subject}   = $subject;
      $msgs{$id}{name}   = $name;

      push(@{$children{$pid}}, $id);
  }

  foreach (@{$children{0}}) {
      Thread($_, 0);
  }

  sub Thread {
      my $id    = shift;

     $content{'main'} .= qq{<li><a
href="http://www.myurl.com/cgi-bin/user.cgi?go=MyBoard&type=Get&mid=$id">$ms
gs{$id}{subject}</a> -- Posted By: $msgs{$id}{name}};

# Right there. $id prints as expected, but $msgs{$id}{subject} and
$msgs{$id}{name} do not.
# But @row above contains the values I expect!

      if (exists $children{$id}) {
    $content{'main'} .= '<ul>';
          foreach (@{$children{$id}}) {
              Thread($_);
          }
      }
   else {$content{'main'} .= '</ul>';}
  }

Please help!

Gabe




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

Date: Sat, 12 Aug 2000 20:31:04 GMT
From: Daniel Pfeiffer <occitan@esperanto.org>
Subject: Help: libs with Latin-1 or Unicode?
Message-Id: <8n4c68$tjd$1@nnrp1.deja.com>

I've read the perlunicode and related doc, but I did not understand it.
Or rather I've seemed to understand that I have no control over how some
data is treated and hope this is not so!

Text::iPerl is a library that searches a bit of text for some markup
that sets off bits of Perl from the rest of the text and executes them
while printing the rest.  The data to be scanned can get passed in via
include statements from three sources: a filename, a filehandle or a
string.  Now one bit of data might be in Latin-1 and another in the same
programme in Unicode.

Where and how does this get handled?  As far as I understand this, the
makers of Unicode did not invent a (Latin-1 NOP) magic number to
differeniate this, so the document gives no clues unless someone invents
a heuristic to determine byte sequences impossible in UTF-8 -- maybe not
very promising.

So the provider of the data would have to give this information, but
then how does the library differentiate?  To my mind filehandles and
strings should be byte/utf8 markable (similar to tainting) and only an
explicit tr/// should change this attribute.  But (not that this
concerns me right now) what happens when concatenating?  Probably as
soon as concatenating to unicode every byte string should be translated
to wide characters.


--
Bring text-docs to life!              Erwecke Textdokumente zum Leben!
                   http://beam.to/iPerl/
Vivigu tekstodokumentojn!


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 12 Aug 2000 23:46:39 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Help: libs with Latin-1 or Unicode?
Message-Id: <Pine.GHP.4.21.0008122305120.11596-100000@hpplus03.cern.ch>

On Sat, 12 Aug 2000, Daniel Pfeiffer wrote:

> I've read the perlunicode and related doc, but I did not understand it.

Disclaimer: I interpreted what I read about 5.6, to mean that unicode
support wasn't really ready yet, so I didn't pay much attention to it.  
However, I do have some familiarity with unicode from HTML/WWW work,
so I'm doing my best to comment.  Pinches of salt to be taken ;-)

> that sets off bits of Perl from the rest of the text and executes them
> while printing the rest.  The data to be scanned can get passed in via
> include statements from three sources: a filename, a filehandle or a
> string.  Now one bit of data might be in Latin-1 and another in the same
> programme in Unicode.

Once upon a time, I worked with a computer whose internal coding was
as good as totally incompatible with all other computers on the planet
(I wonder whether I could finally get a nod from MJTG on this point
;-) and which therefore took it for granted that all input and output
streams had to be associated with a character-code translation
procedure.  It was quite a discipline.

First of all, let's get one thing clear (but I think from your posting
that you already know this, hmmm?).  Unicode defines an abstract
representation of characters.  A mapping, if you will, between
characters on the one hand, and integers withing a certain range.

In order to actually _use_ unicode, you have to represent these
characters in some concrete fashion.  At the lowest level, you could
represent them by a character coding (utf-8, ucs-2, utf-16 etc.).

At a somewhat higher level, you could represent them in some kind of
application-dependent notation, like &#937; in HTML or chr(937) in
some language that provided a chr() function.

If you're dealing with coded character data, then a given file is
meant to be in one and only one character coding.  If it's utf-8 then
it can't also be iso-8859-1 and vice versa.  The idea of having a data
stream that suddenly switches from say utf-8 to say iso-8859-7 just
isn't considered.

> Where and how does this get handled?  As far as I understand this, the
> makers of Unicode did not invent a (Latin-1 NOP) magic number to
> differeniate this, 

Well, iso-2022 procedures do in theory supply a way for character
codings to identify themselves by means of appropriate
control-sequences, but this is rarely used in practice IME.

> so the document gives no clues 

AFAIK all unicode codings are self-identifying, or at least can be
made so by starting the datastream in a specific way (the coded
representation of a zero-width non joiner, IIRC?).

But this won't help you to disambiguate iso-8859-1 from iso-8859-15
("Latin-zeuro" - joke), or windows-1252 from windows-1251 for example.  
Whether you can disambiguate between ascii-based codings and
ebcdic-based codings is yet another question (remember, Perl _is_
implemented on some ebcdic-based plaforms).

> unless someone invents
> a heuristic to determine byte sequences impossible in UTF-8 -- maybe not
> very promising.

utf-8 has a built-in consistency check, in as much as each multibyte
sequence defines its own length.  The probability of an arbitrary
iso-8859-* file of any size passing this test is miniscule.

> So the provider of the data would have to give this information, but
> then how does the library differentiate? 

That's a very good question.  Arbitrary streams of bytes are
meaningless by themselves, they need to be accompanied by a
specification of their coding.  This hasn't been well-handled
historically, and the mess shows - AND HOW - in HTML's dealings with
external data (see also security alert CA-2000-02).

> To my mind filehandles and
> strings should be byte/utf8 markable (similar to tainting) and only an
> explicit tr/// should change this attribute. 

Interesting analogy; I must admit I thought more in terms of the
distinction between text mode and binary mode.  Except that there
would then be (many) different text modes according to what character
coding they were using.

> But (not that this
> concerns me right now) what happens when concatenating? 

Has to result in a correct value relative to the character coding
defined for the output stream.  But that's self-evident.

> Probably as
> soon as concatenating to unicode every byte string should be translated
> to wide characters.

Excuse me for rabbitting on about HTML, but I feel there's a key issue
here.  Internally, the HTML specifications lay down that (irrespective
of what really happens inside) conforming software has to behave like
a black box that is indistinguishable from an abstract implementation
which internally uses unicode as its internal character
representation.  Of course, it needs to perform conversions in order
to communicate with the rest of the world.  As such, every input and
output needs to be associated with a character coding (that
most-unfortunately-named MIME parameter "charset") and an appropriate
mapping procedure.

I think I'll shut up now and listen to some answers.

gruesse.




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

Date: Sat, 12 Aug 2000 20:15:20 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: How to submit a form from the browsers' address bar?
Message-Id: <slrn8pbc2d.drn.efflandt@efflandt.xnet.com>

On Sat, 12 Aug 2000, Oktay <eliste@demokratik.net> wrote:
>I have a below form.
>I would like to submit the information on this form using a single line
>like this
>http://dmoz.org/cgi-bin/add2.cgi?submit=1&index=67a9698c86ae0e789c8b85407fb3d8d6&where=Recreation/Humor&lk=&url=http://test.com&description=this+is+description&email=test@test.com

That is called a query string.  If you enter it by hand into your address
bar, you have to make sure that any special characters are url-encoded.
But this has nothing to do with Perl.

>I was unseccesful so far.
>
>Can anybody help me to achieve this?

Use the Perl CGI module.  Then you do not have to worry if the data was a
query string or a form submitted using GET or POST method.

>Thank you all in advance
>
><form method="post" action="http://dmoz.org/cgi-bin/add2.cgi">
><input type="hidden" name="index"
>value="67a9698c86ae0e789c8b85407fb3d8d6">
><input type="hidden" name="where" value="Recreation/Humor">
><input type="hidden" name="lk" value="">
><input type="text" size="40" name="url" value="http://">
><input type="text" size="40" name="title" maxlength="100">
><textarea maxlength="300" rows="8" cols="40" wrap="virtual"
>name="description"></textarea>
><input type="text" size="40" name="email">
><input type="submit" value="Submit">
></form>

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Sat, 12 Aug 2000 20:49:41 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: IO::Socket problem
Message-Id: <slrn8pbe2r.drn.efflandt@efflandt.xnet.com>

On Fri, 11 Aug 2000 18:14:34 -0700, Baris <sumengen@hotelspectra.com> wrote:
>Thanks for the reply.
>Sorry about my mistake. I don't want to access the urls, but the domain
>name. In this case the domain name is "www.yahoo.com", which I specify when
>creating the socket. But there is no way to access this info in a later
>point of the program.
>Basically I am creating several sockets and I am looping through all the
>sockets in another part of my program. I want to be able to understand which
>socket is associated with which domain name.
>Hope this is more clear.
>Thanks,
>Baris.

OK, so use a different variable for each socket.  This is a hash example:

foreach $host (@hosts) {
    $socket{$host} = IO::Socket::INET->new(PeerAddr => $host,
          PeerPort => 80,
          Proto => "tcp",
          Type => SOCK_STREAM,
    ) || warn "can't open $host\n";
}

Then later just skip any that don't have a socket:

foreach $host (@hosts) {
    next unless $socket{$host};
    # do something with each open socket
}

>"Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com> wrote in message
>news:8n0r3h$67i6@intranews.dresdnerbank.de...
>>     Hi,
>>
>> Baris schrieb in Nachricht <3993d832$1_3@goliath2.newsfeeds.com>...
>> >I am creating a socket connection using IO::Socket
>> >
>> >  $socket = IO::Socket::INET->new(PeerAddr => "www.yahoo.com",
>> >          PeerPort => 80,
>> >          Proto => "tcp",
>> >          Type => SOCK_STREAM,
>> >  )
>> >
>> >Now I want to access the url information at another place of my program.
>>
>>     until now you have not requested any URL. I have not seen any
>>     HTTP request asking for a document from www.yahoo.com in
>>     the above code.
>>
>> >Following the documentation, I only was able to access the remote ip
>> address
>> >using:
>> >$socket->peerhost
>> >method. But ip addresses are not unique identifiers for a web site... Is
>it
>> >possible to access the web url somehow?
>>
>>     So you do not have an IO::Socket problem as stated in the title
>>     of your posting but you seem to need some kind of unique
>>     identifiers. Maybe we can help you if you can give us some
>>     further details.
>>
>>         Peter Dintelmann
>>
>>
>>
>
>
>
>
>-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
>http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
>-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Sun, 13 Aug 2000 03:26:19 GMT
From: johnvert@my-deja.com
Subject: map | grep
Message-Id: <8n54gp$dc1$1@nnrp1.deja.com>

Hi,

 I'm wondering what is the difference between:

 1. my @list=qw(1 2 3 4);
    my %t=grep { $_ => "foo" } @list;
    for (keys %t) { print "$_ : $t{$_}\n"; }

 and

 2. my @list=qw(1 2 3 4);
    my %t=grep { $_ => "foo" } @list;
    for (keys %t) { print "$_ : $t{$_}\n"; }

 also, I heard map / grep should not be used instead of a plain loop,
so  what are very simple examples where they might be used?

 thanks,
   -- john


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 12 Aug 2000 21:07:35 GMT
From: "Joe C. Hecht" <joehecht@code4sale.com>
Subject: Re: Negativity in Newsgroup
Message-Id: <r0jl5.912$2q.171565@paloalto-snr1.gtei.net>

> *shrugs*

*hugs*...

Keep up the posts. They are an interesting diversion
in this swamp I call the "UselessNet"...

Joe





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

Date: Sat, 12 Aug 2000 21:03:13 GMT
From: "Joe C. Hecht" <joehecht@code4sale.com>
Subject: Re: Negativity in Newsgroup
Message-Id: <lYil5.909$2q.170355@paloalto-snr1.gtei.net>

[Godzilla! tempts me out of lurk mode]

> Easy to speak as a victim. Very difficult to
> speak up when you are a perpetrator, yes?

I am unsure. Having miserbly failed english and
spelling, I find it difficult to speak properly at all
though a keyboard.

> This is not a reflection upon you Mr. Hecht.
> I am simply using your article to add some
> of my own thoughts. This has nothing to do
> with you personally. Don't be offended.

I see no reason to be offended, although, I
must admit, I am swooned by your use of
the English language.

> Only note I would add to your comments, Mr. Hecht,
> is newbies here best be prepared to be subjected
> to the worst, ranging from vile hatred to crime.

This might be true for newbies and gurus alike.

> Godzilla!

Question...

Is that Miss. Godzilla!, Mrs. Godzilla!, Ms. Godzilla!,
or is there another, more approprate title I should use?

Please take no offense to my humble question,
afterall, you used "Mr." when addressing me.
I must admit, you are far too kind, as I do
not exactly deserve the title, however, I surely
enjoied the respect it implied. Thank you!

[running back to lurk mode, then off to answer]
[many graphics related questions elsewhere,  by]
[always posting the same correct answer "to]
[fix your problem, simply purchase my product(s)].

Joe




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

Date: Sat, 12 Aug 2000 21:10:19 GMT
From: "Joe C. Hecht" <joehecht@code4sale.com>
Subject: Re: Negativity in Newsgroup
Message-Id: <%2jl5.914$2q.172335@paloalto-snr1.gtei.net>

>> `' Why are there so many negative remarks in this newsgroup?
>
> To compensate for what's happening in alt.cuddle.

Ok, now I understand :)

> # Perl 5.6.0 broke this.
>
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)(
(.)
> (.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of
Hanoi

Then recode it in C <g>

Joe





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

Date: Sat, 12 Aug 2000 17:56:43 -0500
From: "Michael S. Manley" <michaelsmanley@yahoo.com>
Subject: Re: newb Q, Our perl guy left!!
Message-Id: <8n4kn1$c0g$1@news.enteract.com>


Abigail <abigail@foad.org> wrote in message
news:slrn8o1c9l.vcg.abigail@alexandra.foad.org...
> jtoy (jtoy@tcgfinancial.com) wrote on MMDXXII September MCMXCIII in
<URL:news:3980B000.D8446A70@tcgfinancial.com>:
> @@ BTW, sorry for talking like this, but what do you expect from a python
user?
>
> I'd expect a Python user to take his whining to comp.lang.python.

I'd expect a Python user to throw out the Perl program and rewrite it in
Python if "the Perl guy" on site was no longer around or hire a new "Perl
guy" if that wasn't an option.




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

Date: Sat, 12 Aug 2000 18:34:54 -0700
From: "Corey Cole" <coredog2@hotmail.com>
Subject: PerlScript (Active Perl) and COM interfaces
Message-Id: <IYml5.468481$MB.7088902@news6.giganews.com>

How's this for a poser?

I'm trying to create a Perl email handler for the Win2K SMTP server.  If you
create a
component that implements an interface or two, you can handle incoming email
before it
gets to the file system (think procmail...)

Anyways, there are VB, C++, and VBScript samples, but sadly no PerlScript
samples ;(
So how the heck to I implement an interface in PerlScript?  VBScript has a
standard syntax
(<InterfaceName>_<MethodName>) for doing so.  I would assume that there's
also something
like this for Perl.  I've looked through the ActiveState documentation, and
I can't find
anything that seems germane.

Of course, if I can't do it this way, I can always write an ATL COM
component that
calls a Perl script.  But I'd rather know how to do it with straight
PerlScript...




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

Date: Sun, 13 Aug 2000 01:01:59 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Sharing a cookie between two domains..?
Message-Id: <MPG.140090f439162bf19896ac@localhost>

u2orange wrote ..

>On Fri, 11 Aug 2000 11:36:49 GMT, jason <elephant@squirrelgroup.com>
>wrote:
>
>>Mat wrote ..
>>>	I am having a few problems trying to share a cookie between
>>>two domains using Matt Wrights cookie.lib.  As far as I can
>>>understand, this is possible by using the function
>>>&SetCookieDomain('.host.xxx').
>>>
>>>	Any ideas where I am going wrong..?
>>
>>if there's one thing that this newsgroup certainly is NOT it's a support 
>>forum for Matt Wright's attempts at programming .. ask Matt Wright if 
>>you have a problem with something that he supplied
>
>Blimey mate, you ate a large one didnt you..?
>
>Is it or is it not Perl related..?

no it has nothing to do with Perl .. it's a question regarding cookies 
 .. at the very least it should have been asked in a CGI/Cookie related 
newsgroup

but you're really asking a specific question about a function in one of 
Matt Wright's scripts .. why would you think that someone in a Perl 
newsgroup would know the possible uses of SetCookieDomain better than 
Matt Wright himself ?

>Relax, you will live longer.

I might live longer - but the fewer off topic posts that appear in 
c.l.p.misc the more time I'll have to do other things during my shorter 
lifespan

  [ jeopardectomy and sig chopping performed ]

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Sat, 12 Aug 2000 18:13:18 GMT
From: stu265@my-deja.com
Subject: Re: Sort data from text file
Message-Id: <8n443s$o27$1@nnrp1.deja.com>

Thank you Jim, I from England now I'm living in the US, so I used to
write the date the 'correct' way to.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 12 Aug 2000 20:53:11 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Sort data from text file
Message-Id: <rs4bpsk0p9lfpmmqllo2vb9bpf1ljnlvl0@4ax.com>

On Sat, 12 Aug 2000 17:25:35 +0300, "Ivo Zdravkov" <ivoz@starmail.com>
wrote:

> 
> <stu265@my-deja.com> wrote in message news:8n2ldt$q75$1@nnrp1.deja.com...
> > I am new to Perl and am trying to find a solution to a problem.
> > I have a text file that contains dates with a description and I need to
> > sort the lines in date order. The follwing is an example of a line of
> > date, 8/11/2000 - Description. I know I need to split off the date and
> > create a sort function but I'm not sure the best way to do it. Any
> > ideas?
> 
> declare function named date_from_line($line),
>  that returns date from line in this format: YYYYMMDD
> 
> then this code must sort the file:
> 
> @lines=<file_name>;
> 
> @sorted=sort {
>     date_from_line($a) <=> date_from_line($b)
> } @lines;
> 

Please (re)read perlfaq4: "How do I sort an array by (anything)?"
and understand why this is not really the way to do it.

	perldoc -q sort

You could use that date_from_line() sub in the Schwartz Transform:

	my @sorted = map $_->[-1] => sort { $a->[0] cmp $b->[0] }
		map [ date_from_line($_), $_ ] => @lines;

-- 
Good luck,
Abe


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

Date: Sat, 12 Aug 2000 17:21:48 -0400
From: Pat Trainorh <ptrainor@title14.com>
Subject: timing out evals
Message-Id: <Pine.LNX.4.21.0008121714230.14937-100000@aura.title14.com>


goal:
to timeout functions by a sub call

per the cookbook (p.595) "Timing out an operation", I am attempting:

(I'll use the real example, although I am aware that the NOAA site is down
right now. This is why I need a timeout check..)

use Geo::WeatherNOAA; $a = timed("print_forecast('NEW YORK','NY')"); 
print "result is: $a\n"; 
# 
sub timed { my $command = shift; 
my $result;
$SIG{ALRM} = sub {die "timeout" }; eval {
        alarm(5); # I know 5 is unreasonable, just a test...
        $result = eval $command;
        alarm(0);
};
if ($@){
        if ($@ =~ /timeout/){
                print "OOPS! TIMED OUT!\n";
                # timeout action
                } else {
                # should never get here
        }
}
return $result;
}
#
######

trouble is, the timeout doesn't work. The command takes its sweet time,
and eventually errors out (because of a real problem with NOAA), but not
due to the setting of alarm().

as an aside, if the action is a system executable, I can do this with:

$a = timedx("/usr/bin/lynx -head -dump 
http://iwin.nws.noaa.gov/iwin/ny/hourly.html"); # (probably wrappped)
print "\$a is: $a\n";

sub timedx {
my $command = shift;
my $result;
$SIG{ALRM} = sub {die "timeout" };
eval {
        alarm($time_out);
        print "doing: [$command]\n";
        $result = qx/$command/;
        alarm(0);
};
if ($@){
        if ($@ =~ /timeout/){
                print "OOPS! TIMED OUT!\n";
                # timeout action
                } else {
                # should never get here
        }
}
return $result;
}

Any ideas how to get timed() to work?
TIA!

pat
:)

Rates: I do it: $20 You watch: $40 You help: $80 You tried already: $500



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

Date: Sat, 12 Aug 2000 18:30:01 GMT
From: goshawk@gnat.net (goshawk)
Subject: Re: Trouble with example
Message-Id: <399594a3.10970455@news.gnat.net>

I just  happend ot have the 2nd addition of  the learning perl book

the sample you gave was actually a subroutine:


sub init_words {
   open (WORDSLIST,  "wordslist");
   while ($name = <WORDSLIST>)  {
    chomp ($name);
     $word = <WORDSLIST>;
     chomp ($word);
     $words{$name} = $word;
    }
}

The file should be in the form:(first line in line pair is id, second
line in line pair is password per sample)

fred
camel
barney
llama
betty
alpaca
wilma
alpaca


The book did not use strict  or -w 

the original code was: 
#!/usr/bin/perl
%words = qw (
     fred            camel
     barney      llama
     betty          alpaca
     wilma        alpaca 
);

 to (new code)

#!/usr/bin/perl
init_words();


I did not have any problems running from the command line, but when I
used perl-d: ptkdb   program.pl
I had some some -w errors, but didn't spent much time on it as it was
working fine from the command line. 

Pat
http://www.gnat.net/~goshawk
http://www.gypysfarm.com
 


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

Date: Sat, 12 Aug 2000 22:17:33 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: User-defined hash...
Message-Id: <3995CD91.73908F49@rochester.rr.com>

Colin Keith wrote:
 ...
> If that still doesn't cut the mustard (okay, someone tell me where that
> phrase comes from, plz?:) as far as the data structures, then have a look at

http://www.wsu.edu:8080/~brians/errors/mustard.html

> Colin Keith
> Systems Administrator
> Network Operations Team
> ClaraNET (UK) Ltd. NOC


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

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


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