[20025] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2220 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 27 18:05:40 2001

Date: Tue, 27 Nov 2001 15:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1006902311-v10-i2220@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 27 Nov 2001     Volume: 10 Number: 2220

Today's topics:
    Re: 2D Array from Text File <paul_wasilkoff@ucg.org>
    Re: 2D Array from Text File <5l259r001@sneakemail.com>
    Re: 2D Array from Text File (Logan Shaw)
    Re: [OT] deja-vu all over again (was Re: A Perl Bug?) <jake@chaogic.com>
    Re: About @INC contents - help, please <Graham.T.Wood@oracle.com>
    Re: Can I avoid 2 passes? <godzilla@stomp.stomp.tokyo>
    Re: Can I avoid 2 passes? <godzilla@stomp.stomp.tokyo>
    Re: Can I avoid 2 passes? <Tassilo.Parseval@post.rwth-aachen.de>
    Re: Can I call a Perl subroutine from inside an HTML do <paul_wasilkoff@ucg.org>
    Re: Can I call a Perl subroutine from inside an HTML do <meuzelaj@student.dontspam.gvsu.edu>
    Re: detecting if system call hangs on NT (John Menke)
    Re: Do some time calculations... (John J. Trammell)
        Extracting lines with duplicate first field  (Luc Giguere)
    Re: Extracting lines with duplicate first field <Laocoon@eudoramail.com>
    Re: Extracting lines with duplicate first field <darkon@one.net>
        fork, debugging and ptkdb <djberge@nopam.qwest.com>
    Re: make subset of the search result <fly_no_spam@china.org>
        my Variables... <nathan.randle@ntlworld.com>
    Re: my Variables... <tony_curtis32@yahoo.com>
    Re: New problem.. <jurgenex@hotmail.com>
    Re: New problem.. <mds@wam.umd.edu>
    Re: New problem.. <mds@wam.umd.edu>
        Newbie: Command Line Perl to CGI <hudsonclinta@johndeere.com>
    Re: no autovivication for subs (Charles DeRykus)
        PERL DBI ODBC... MS SQL  *argh* (Jay Man)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 27 Nov 2001 15:17:16 -0500
From: "Paul Wasilkoff" <paul_wasilkoff@ucg.org>
Subject: Re: 2D Array from Text File
Message-Id: <u07t6hf4e2dv33@corp.supernews.com>

Thanks for your posts!

In rethinking my set-up to this and wonder if it would be better to have a
text file with 'n' number of lines.  Each line would start with my code
followed by a comma and then the description:

AA,Alpha Description
BB,Beta Description

etc.

How would setting up the hash differ for this scenario?

PAW





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

Date: Tue, 27 Nov 2001 21:26:41 +0100
From: "Steffen Müller" <5l259r001@sneakemail.com>
Subject: Re: 2D Array from Text File
Message-Id: <9u0srl$bi2$06$1@news.t-online.com>

"Paul Wasilkoff" <paul_wasilkoff@ucg.org> schrieb im Newsbeitrag
news:u07t6hf4e2dv33@corp.supernews.com...
| Thanks for your posts!
|
| In rethinking my set-up to this and wonder if it would be better to have a
| text file with 'n' number of lines.  Each line would start with my code
| followed by a comma and then the description:
|
| AA,Alpha Description
| BB,Beta Description
|
| etc.
|
| How would setting up the hash differ for this scenario?


open FH... # do that yourself.

my %hash;
while (<FH>) {
   chomp;
   my ($key, $value) = split /,/ $_;
   $hash{$key} = $value;
}

Steffen
--
$_=q;0cb212c210b0bb010c0113bb0c410c0b516c0bb3d212c2b0b0b016b6cb2b2c21010c0
b41110b3bba0e0c0d2c4b2b6bc013d2c0d0b01012b0b0;;s/\n//g;s/(\d)/$1<2?$1:'0'x
$1/ge;s/([a-f])/'1'x(ord($1)-97)/ge;$o=$_;push@o,substr($o,$_*8,8) for(0..
24);for(@o){print"\0"x(26-$i).chr(oct('0b'.($_)))."\r";$i++};print"\n"#stm





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

Date: 27 Nov 2001 14:30:59 -0600
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: 2D Array from Text File
Message-Id: <9u0t63$5rr$1@starbuck.cs.utexas.edu>

In article <u07t6hf4e2dv33@corp.supernews.com>,
Paul Wasilkoff <paul_wasilkoff@ucg.org> wrote:
>Thanks for your posts!
>
>In rethinking my set-up to this and wonder if it would be better to have a
>text file with 'n' number of lines.  Each line would start with my code
>followed by a comma and then the description:
>
>AA,Alpha Description
>BB,Beta Description
>
>etc.
>
>How would setting up the hash differ for this scenario?

It'd look like this:

	my ($line, $key, $value); 
	while ($line = <THEFILE>)
	{
	    chomp $line;
	    ($key, $value) = split (/,/, $line);
	    $hash{$key} = $value;
	}

Or if you like to use implicit variables:

	while (<THEFILE>)
	{
	    chomp;
	    /(.*),(.*)/;
	    $hash{$1} = $2;
	}

Hope that helps.

  - Logan
-- 
"In order to be prepared to hope in what does not deceive,
 we must first lose hope in everything that deceives."

                                          Georges Bernanos


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

Date: Tue, 27 Nov 2001 15:26:51 -0600
From: "Jake Fan" <jake@chaogic.com>
Subject: Re: [OT] deja-vu all over again (was Re: A Perl Bug?)
Message-Id: <9u10fh$geh$1@Masala.CC.UH.EDU>

As far as the goal of my original post is concerned, I think I have already
got the answer I was looking for, plus a decent understanding of the subject
matter at hand.  I am sure if I dig deeper there is much more to this
autovivification issue, but for now, it is good enough for my current
application.  And I will definitely revisit the topic in a later date when I
have more insight at the inner workings of Perl.  I would also hope that the
behavior of various assignment operators would be slightly changed so that
they would act more consistently, but I wouldn't hold my breath.  By the
way, sincere thanks to those who provided answers and/or relevant
discussions to my original posts, including Bart Lateur, Gisle Aas, Joe
Schaefer, Mark, Mark Jason Dominus, Martien Verbruggen, and Uri Guttman.

And yes, the rest of my posts are merely silly dialogs aimed at
entertainment, which got kickstarted on a lazy Sunday afternoon.  You would
think that with the netiquette topic played to death in this group, this
thread would quickly die...  But no, it's been going on and on for 60+
posts.  Never thought my first post in this group would attract this much
attention.  But it is nice to have entertaining conversations with some of
the big names in the Perl world.  Well, entertaining to me, at least.

And yes, it's ridiculous that the off-topic netiquette posts in this group
have such a high rate.  But it's even more ridiculous to think it's ok to
maintain the status quo, and blame on the damn "inconsiderate" newbies every
single time.  You (regulars in this group) are fully aware that the audience
of this group is about as diverse as you can get -- as far as programming
language groups are concerned, especially with this group bearing the name
".misc".  One would hope that the group would adopt relaxed rules to cater
as many people as possible.  But no, you choose to be anal and tyrannical,
and not even aware of it.  Of course, nobody is obliged to be nice, as much
as everybody has the full right of being an asshole.  Granted, post authors
are generally expected to be considerate and conform to the "de facto"
standard of a given group.  But this is a highly subjective matter.  On one
hand, what exactly does this particular group consist of?  I suspect that
the collective and cumulative time and effort spent here by casual posters
and lurkers out-weights that of the regulars.  That's just my wild guess,
but the point remains -- diversity *is the de facto standard in this group.
On the other hand...  Probably most people will accept that if everyone in
an office wears ties and suits, jeans and t-shirts would appear
inappropriate.  But if a great number of people coming in and out of the
office wear jeans and t-shirts, dress code should probably be less strictly
enforced.  (Not to mention that this analogy is not entirely accurate since
an office environment is tyrannical in nature.)  But does it even matter?
The most important thing is to get work done without letting the clothing
issue standing in the way, and the least desired thing is to run around
accusing people of not wearing ties and suits.  Of course, that's only my
own opinion.

There are many forms of inconsiderateness.  One not-so-obvious form is
insisting there is only one "right" way to do things in a social context.
And when you start complaining about other people being inconsiderate, you
have already been inconsiderate yourself -- to the people you are
complaining about.   (See, I have been inconsiderate there myself.)  It's
only a matter of perspective and a matter of degree.

But again, I fully anticipate that people's responses to this post will
still be, "but it's netiquette, moron".  And I fully expect that this OT
post phenomena will continue to manifest itself down the road.  To hope
otherwise is like hoping tomorrow the Sun would rise from the west (a
Chinese catchphrase), i.e., it's hopeless.  But It really doesn't matter.  I
am writing this only for the fun of it but now the fun starts wearing out.
So please let me wrap up my own thread and go back to lurking mode, and not
let this silly "clothing issue" standing further in the way.

And sincere thanks to you all.  It's been a pleasure.


Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
> "Jake Fan" <jake@chaogic.com> writes:
>
> > You are missing the point.  Let me quote my former thesis advisor whom
> > you would consider God in his particular research area,
>
> Please stop hijacking your own thread.  You asked a very good
> question, and your lack of interest in seeing it discussed and/or
> resolved makes me wonder if you really didn't have some ulterior
> motive in mind to begin with.
>
> Over the past 5 years here, about 1 thread in every 2-300 posts to
> clp.misc was about "netiquette" (compare with say c.l.scheme, where
> it's only been discussed *once*, *ever*). Here's some rough figures
> (google search on the year, and on the word "netiquette"- not
> exactly scientific, but I wasn't aiming very high)
>
>   Year   Number   "netiquette"   ratio
>          Posts       thread       t/p
> --------------------------------------------------
>   96      4500         30        1 / 150
>   97      9960         15        1 / 640
>   98     12000         60        1 / 200
>   99     22800         85        1 / 268
>   00     25800         80        1 / 322
>   01     10300         40        1 / 257
>
>
> So if you think this silly dialog about freedom of expression
> and personal style hasn't been played out to death here, you
> are badly mistaken.  Stick to Perl and follow the groups'
> conventions; don't make yourself the flavor of the week.
>
> And if you meet Larry Wall on the road, ...
>
> --
> sub TIESCALAR {bless \$_[1]} sub STORE {${$_[0]}=$_[1]}$,="
";$\=$/;$#Just=1;
> tie $left,'main',-4; sub
FETCH{${$_[0]}<0?${$_[0]}:$#[${$_[0]}++%4]}$Just[0]=
> sub{$left,"\l$#[-++$_[0]]",$left&&$left.","}; @#=qw/Just Another Perl
hacker/
> ;print ++$left, @{++$left} [$left++] -> ($left++)        # some words on
play
>





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

Date: Thu, 22 Nov 2001 11:32:07 +0000
From: Graham Wood <Graham.T.Wood@oracle.com>
Subject: Re: About @INC contents - help, please
Message-Id: <3BFCE237.134D8934@oracle.com>

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>

<blockquote TYPE=CITE>I am trying to install DBD::Sybase, It wants @INC
points to DBI module and I
<br>cannot do this, because all this is in my home. How to change this
fucking
<br>variable?</blockquote>
use lib "/your/home/directory";
<p>tells perl to look in /your/home/directory and then at whatever else
is in @INC when looking for modules that are "used" later in the script.&nbsp;
Try putting this at the top of the script you are running that is failing
to find DBI in @INC.
<p>Hope this helps
<p>Graham Wood</html>



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

Date: Tue, 27 Nov 2001 11:39:33 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Can I avoid 2 passes?
Message-Id: <3C03EBF5.6D20E2ED@stomp.stomp.tokyo>

Tassilo v. Parseval wrote:
 
> Godzilla! wrote:
 
> > Here is code exemplifying use of a true associative array.
> > It is not as efficient as its equal in hash format. Still,
> > this might inspire some intelligent extrapolation regarding
> > efficiency of complex associative arrays and complex hashes.

> > #!perl

> > @Fruits = qw (apple plum grape orange);

> > $user_input = "Fruits";

> > print "@$user_input";
 
> ethan@ethan:~$ perl -Mstrict
> my @Fruits = qw (apple plum grape orange);
> my $user_input = "Fruits";
> print "@$user_input";
> __END__
> Can't use string ("Fruits") as an ARRAY ref while "strict refs" in use
> at - line 3.
 
> A true associative array, eh?
> Better come back with a true associative array working under strictures
> or return to your sandbox.
 
> Something that screws your symbol-table and hence is not allowed under
> strict.


Oh look, I smoked another Taliban Cleric Code Cop out of his
Perl 5 Cargo Cultist cave.

Clearly you invested a lot of time and effort into finding
a way to break my code, although you have to employ deceit
to do so. I am impressed with your intelligent dialog,
truly I am.

As I stated in another article, you boys are trolls, Frank.


Godzilla!  Queen Of Perl Heretics.


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

Date: Tue, 27 Nov 2001 12:50:17 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Can I avoid 2 passes?
Message-Id: <3C03FC89.148B15B0@stomp.stomp.tokyo>

Godzilla! wrote:
 
> Tassilo v. Parseval wrote:
> > Godzilla! wrote:

(snipped)

> > > Here is code exemplifying use of a true associative array.


> > Can't use string ("Fruits") as an ARRAY ref while "strict refs" in use
> > at - line 3.
 
> > Better come back with a true associative array working under strictures
> > or return to your sandbox.
 
> > Something that screws your symbol-table and hence is not allowed under
> > strict.
 
> Oh look, I smoked another Taliban Cleric Code Cop out of his
> Perl 5 Cargo Cultist cave.
 

With my having smoked you out of your Perl 5 Cargo Cultist cave...


* grabs the loose end of his Taliban Cleric Code Cop turban *

MUUUUHAHAHAHAHAAAA!  ALLAH IS GREAT!

* takes off running *


Boy Howdy! Will ya look at him spin like a top!


Here's something which will make you even more dizzy.

This code exemplifies a talent which differentiates
real programmers from Perl 5 Cargo Cultists such
as yourself. This is a talent to write imaginative
scripts which do what we, real programmers, want
rather than what Perl 5 Cargo Cult Dogma dictates
you will do with a script.

Obviously you don't know much about strict and its
features, which are incorporated for many reasons,
with those reasons being beyond simple comprehension
of stereotypical Perl 5 Cargo Cultists.

As a side effect, this code exposes your deceit
through concealment of truth and, how little you
know about Perl, Frank.


Godzilla! Queen Of Muuhaha.
--

TEST SCRIPT:
____________

#!perl

use strict;

our (@Fruits) = qw (apple plum grape orange);
our ($user_input) = "Fruits";

no strict "refs";

print "@$user_input\n\n";

use strict "refs";

print "@$user_input";

exit;



PRINTED RESULTS:
________________

apple plum grape orange

Can't use string ("Fruits") as an ARRAY ref while "strict refs"
in use at test.pl line 15.


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

Date: Tue, 27 Nov 2001 22:43:45 +0100
From: "Tassilo v. Parseval" <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Can I avoid 2 passes?
Message-Id: <9u11eh$c1p$01$1@news.t-online.com>

On Tue, 27 Nov 2001 12:50:17 -0800, Godzilla! wrote:
> #!perl
> 
> use strict;
> 
> our (@Fruits) = qw (apple plum grape orange);
> our ($user_input) = "Fruits";
> 
> no strict "refs";
> print "@$user_input\n\n";
> 
> use strict "refs";
> print "@$user_input";

Moronic.

Tassilo
-- 
The mother of the year should be a sterilized woman with two adopted children.
		-- Paul Ehrlich


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

Date: Tue, 27 Nov 2001 14:53:19 -0500
From: "Paul Wasilkoff" <paul_wasilkoff@ucg.org>
Subject: Re: Can I call a Perl subroutine from inside an HTML doc?
Message-Id: <u07rpmc3nlffe4@corp.supernews.com>

It might be crude, but you could try to query the script -
www.somepage.net/script.cgi?variable=command - for example could produce
what you are looking for when you define what happens when variable=command.
If you are looking at passing data from the form itself, then you would have
to try another method.

PAW

"Moitz" <meuzelaj@student.dontspam.gvsu.edu> wrote in message
news:u07l8f6g67fu54@corp.supernews.com...
> I have a Perl script that generates an HTML form right from the get-go.
Is
> it possible to set that form to pass the data directly to a subroutine in
my
> script, instead of calling the script again, and then looping through an
> if...elsif loop to decide what to do next?
>
> moitz
>
>




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

Date: Tue, 27 Nov 2001 15:10:19 -0500
From: "Moitz" <meuzelaj@student.dontspam.gvsu.edu>
Subject: Re: Can I call a Perl subroutine from inside an HTML doc?
Message-Id: <u07t49c9q3jb12@corp.supernews.com>

Pretty much that's what I'm doing right now.  All the submit buttons for the
various sections are named differently, and I'm doing an if
(defined($Form{'buttonname'})) { to determine what to do with it.  It gets a
bit bulky, so I was hoping there was an easier way...something equivalent to
a Javascript onclick.

moitz

"Paul Wasilkoff" <paul_wasilkoff@ucg.org> wrote in message
news:u07rpmc3nlffe4@corp.supernews.com...
> It might be crude, but you could try to query the script -
> www.somepage.net/script.cgi?variable=command - for example could produce
> what you are looking for when you define what happens when
variable=command.
> If you are looking at passing data from the form itself, then you would
have
> to try another method.
>
> PAW
>
> "Moitz" <meuzelaj@student.dontspam.gvsu.edu> wrote in message
> news:u07l8f6g67fu54@corp.supernews.com...
> > I have a Perl script that generates an HTML form right from the get-go.
> Is
> > it possible to set that form to pass the data directly to a subroutine
in
> my
> > script, instead of calling the script again, and then looping through an
> > if...elsif loop to decide what to do next?
> >
> > moitz
> >
> >
>
>




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

Date: 27 Nov 2001 11:10:46 -0800
From: jmenke@scsnet.csc.com (John Menke)
Subject: Re: detecting if system call hangs on NT
Message-Id: <3a2d73ac.0111271110.70e541a1@posting.google.com>

> 
> So, how *do* you time out an operation on Win32?
> 
> Paul

I have done some research and in Chapter 8 of the WIN32 programming
book Second Edition it seems to have the answer:


use Win32::Process;
 .
 .
 .
(create the process)
 .
 .
 .
$result = $Process->Wait($Timeout);

this will set a Timeout for a process and return 1 to $result if the
script did not time out and 0 if it did.

--john


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

Date: Tue, 27 Nov 2001 14:14:08 -0600
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: Do some time calculations...
Message-Id: <slrna07t60.jb6.trammell@haqq.el-swifto.com>

On Tue, 27 Nov 2001 17:08:11 -0000, Andrew Harton wrote:
> 
> "nobody" <nobody@nobody.com> wrote in message
> news:iJOM7.152944$QL2.4343163@amsnews03.chello.com...
> >
> > What I want to do now is use time() to get only the
> > date with time 00:00:00.
> 
> print scalar localtime(int(time()/86400)*86400);
> 
> produces;
> Tue Nov 27 00:00:00 2001
> 
> ..well it does today anyway :-)
> 

How about

  (my $lt = localtime) =~ s/\d+:\d+:\d+/00:00:00/;

or

  my $time = time;
  while (1)
  {
      last if localtime($time) =~ /00:00:00/;
      $time--;
  }

Just kidding.  :-)



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

Date: Tue, 27 Nov 2001 21:20:19 GMT
From: luc.giguere@umontreal.ca (Luc Giguere)
Subject: Extracting lines with duplicate first field 
Message-Id: <3c04003f.1561300381@news.umontreal.ca>

Hi,

I need some help with this problem I've search scripts sites and Perl
books to get an answer to this problem.

The file consist of lines with fields separated by "@@". What I'd like
to get is only the lines that have the same first field, I don't want
the lines where the first field is unique.


Many thanks,
Luc Giguere


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

Date: Tue, 27 Nov 2001 23:07:16 +0100
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: Extracting lines with duplicate first field
Message-Id: <Xns9166EB39390A5Laocooneudoramailcom@62.153.159.134>

my $field = 'abc123';
my @fields;
while(<INPUT>) {
    	$fields[$i++] = $_ if /$field@@/
}


Hope this helps u

Lao


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

Date: Tue, 27 Nov 2001 22:59:38 -0000
From: David Wall <darkon@one.net>
Subject: Re: Extracting lines with duplicate first field
Message-Id: <Xns9166B6F9F6601darkononenet@207.126.101.97>

luc.giguere@umontreal.ca (Luc Giguere) wrote on 27 Nov 2001:

> The file consist of lines with fields separated by "@@". What I'd like
> to get is only the lines that have the same first field, I don't want
> the lines where the first field is unique.

One way to do it is with split() and a hash of arrays.  You'd want the 
hash entries where the value is an array with more than one element.

Would this perhaps be homework?  I didn't post code because I wasn't sure.   
Still, deciding on how to represent the data is arguably the hardest part.    
Maybe the just the most creative part?  Once you have a data structure it 
seems the code falls into place.  I dunno -- what do people who actually 
code for a living say?

-- 
David Wall
darkon@one.net


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

Date: Tue, 27 Nov 2001 14:32:32 -0600
From: "Mr. Sunblade" <djberge@nopam.qwest.com>
Subject: fork, debugging and ptkdb
Message-Id: <QHSM7.147$HP2.137706@news.uswest.net>

Hi all,

Solaris 8 (sparc), Perl 5.6.1, ptkdb 1.1074, Perl/Tk 8.023 on a Sunblade
100.

I'm trying to debug a program that includes a fork() call using ptkdb.  I've
tried various tricks - setting $DB_fork_TTY, creating a sub for
DB::get_fork_TTY (see below), creating a .perldb file and tinkering with
options like TTY, noTTY, ReadLine, setting the TTY back to the original
terminal, etc.  Everything works ok using the command line debugger, but
ptkdb doesn't like to play nice.  I get an X error and the child's output
seems to disappear into the ether (although it gets through the parent
process ok).  Here's the X error:

X Error of failed request:  BadIDChoice (invalid resource ID chosen for this
connection)
Major opcode of failed request:  53 (X_CreatePixmap)
Resource id in failed request:  0x1000006d
Serial number of failed request:  2934
Current serial number in output stream:  2865

Here's the sample program I used:

#!/usr/local/bin/perl -w
use strict;

# Tried this also - pick your tty appropriately
#$DB::fork_TTY = '/dev/pts/16';

my $pid = fork();
die "Can't fork: $!\n" unless defined $pid;

if($pid == 0){
   print "In the child: $pid\n";
}
else{
   print "In the parent: $pid\n";
}

my $x = "Hello";
print "$x\n";

# Stolen from the perl5db.pl program (via google)
sub DB::get_fork_TTY{
  open XT, q[3>&1 xterm -title 'Forked Perl debugger' -e sh -c 'tty 1>&3;\
sleep 10000000' |];
  my $fork_TTY = <XT>;
  chomp $fork_TTY;
  $DB::fork_TTY = $fork_TTY;
}

Anyone have any ideas on the best way to approach this using ptkdb?  And
what do you do on Win32 sytems that don't support tty?

Thanks in advance for any help.

Regards,

Mr. Sunblade





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

Date: Tue, 27 Nov 2001 19:58:16 GMT
From: qiang <fly_no_spam@china.org>
Subject: Re: make subset of the search result
Message-Id: <sfSM7.38856$T67.12269750@news4.rdc1.on.home.com>

> You could store only the 20 or so most recently used results, using a
> LRU algorithm (as common in virtual memory / disk cache managers). That
> would most definitely keep some requirements under control.
> 

i am sure this way searching will be faster ..

> You could also expire the search and discard the search result if people
> didn't ask for it again within, say, 5 minutes. (time-out)
> 

I think LFU algorithm can be invited to do thing like that..

> As Logan said: starting to search again from scratch might well be
> faster than refining the search based upon stored results. 
> 

why ?  in general searching from old temp  is faster than searching from 
scratch, isn't it .



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

Date: Tue, 27 Nov 2001 19:46:46 +0000
From: "Nathan Randle" <nathan.randle@ntlworld.com>
Subject: my Variables...
Message-Id: <pan.2001.11.27.19.46.18.779.7654@ntlworld.com>

I am trying to write a CGI script with all variable being 'my' variables
so that the script is more secure. This is my first time trying anything
like this and strict keeps complaining about me not declaring variables.I
then declare all the variables in the snippet of script below only to
find out that I don't seem to be able to declare the $FORM variable as a
'my'

Can anybody help me out on how I can declare it as a 'my' variable and
also allow it to be accessible from anywhere in the script?

read(STDIN, my $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-f0-9][a-fA-f0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}

Thanks,
Nathan


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

Date: Tue, 27 Nov 2001 14:04:40 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: my Variables...
Message-Id: <871yikt1yf.fsf@limey.hpcc.uh.edu>

>> On Tue, 27 Nov 2001 19:46:46 +0000,
>> "Nathan Randle" <nathan.randle@ntlworld.com> said:

> I am trying to write a CGI script with all variable
> being 'my' variables so that the script is more
> ...

That won't help you much with security.  There's much more
to security than getting the code through "use strict".
There's semantic security too, which is much more
problematic to get right.  As the code below demonstrates:

> read(STDIN, my $buffer, $ENV{'CONTENT_LENGTH'});

Go no further.  Find out about CGI.pm.

    perldoc CGI
or
    http://stein.cshl.org/WWW/software/CGI/

Please don't try to hack up this code yourself.

hth
t
-- 
Oh!  I've said too much.  Smithers, use the amnesia ray.


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

Date: Tue, 27 Nov 2001 12:20:46 -0800
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: New problem..
Message-Id: <3c03f59f@news.microsoft.com>

"Mike Schmitt" <mds@wam.umd.edu> wrote in message
news:9tv77l$e6q$1@hecate.umd.edu...
> I've just written a rather large PERL program which I feel could be used
as
> a viable tool for anyone with Windows and AIM.  My only problem is, most
> non-powerusers don't have PERL on their systems, nor do they have any idea
> or concept of what PERL is.  Is there a way of "compiling", per se, my
perl
> script into a file which is standalone-enough to be run by just any user
of
> Windows?

Well, actually your subject line is misleading because this is not a new
problem at all.
Indeed it has been asked so many times that there is an entry in the FAQ for
it.

See PerlFAQ3: "How can I compile my Perl program into byte code or C?"

jue




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

Date: Tue, 27 Nov 2001 16:06:05 -0500
From: "Mike Schmitt" <mds@wam.umd.edu>
Subject: Re: New problem..
Message-Id: <9u0v94$ve5$1@hecate.umd.edu>

Jürgen Exner wrote in message <3c03f59f@news.microsoft.com>...

>Well, actually your subject line is misleading because this is not a new
>problem at all.
>Indeed it has been asked so many times that there is an entry in the FAQ
for
>it.



Indeed.  this error occurred to me after I posted, though "new" meant (as
subjects from newbies often do), relative to me.




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

Date: Tue, 27 Nov 2001 16:07:21 -0500
From: "Mike Schmitt" <mds@wam.umd.edu>
Subject: Re: New problem..
Message-Id: <9u0vbg$thq$1@hecate.umd.edu>

Jonas Nilsson wrote in message <9tveg8$nuj$1@news.island.liu.se>...
>www.perl2exe.com



Thanks.
Now, I've installed this and run it on my PERL program, but then when I went
to run said program, it quickly froze and locked my computer, to the point
where the mouse doesn't even move and I have no recourse but to power down.
Did I make a mistake by getting the "beta" version?




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

Date: Tue, 27 Nov 2001 13:16:03 -0600
From: "Clint Hudson" <hudsonclinta@johndeere.com>
Subject: Newbie: Command Line Perl to CGI
Message-Id: <3c03e781$1@news1.dpn.deere.com>

Sorry for the cross-post from comp.lang.perl, but as newbie I didn't find
out until today that the other is defunct...oops.

Newbie question:

I have a script (I reinvented the wheel to develop my own hit-counter) that
I wrote to help me learn Perl.  While debugging it, I was using command line
arguments to change the output.  It will either send the hits as text, as
individual image tags of the digits, or not output anything.  It will also
track hits for more than one web-page.  All these variables are currently
being sent as command line arguments.  For example:

test.pl t bob v

will return the hits for a page called "bob" as text.  Change the "v" to an
"i" and it won't return anything.  Change the "t" to a "g" and it will
return the text:

<img src="path to an image\3.gif">
<img src="path to an image\7.gif">

if the hits for "bob" is up to 37.  The program works perfectly from a
command line interface...but that doesn't help me with the web-pages...

I'm using SSI's to call the script.  I've tried altering the code to use the
QUERY_STRING, but am too much of a newbie to get decent results.  What do
the gurus suggest I do next?

Included below is the code I'm using to return information to the browser...




if ($output_as_graphics eq "true")
   {
   @digits = split(//,$target_count);
   foreach $digit (@digits)
      {
         print ("Content-type: text/html\n\n");
         print("<img src=", $path_to_img, $digit, ".gif>\n");
      }
   }
else
   {
   if ($visibility eq "true")
      {
      print ("Content-type: text/html\n\n");
      print $target_count;






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

Date: Tue, 27 Nov 2001 21:51:31 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: no autovivication for subs
Message-Id: <GnHBDv.1v1@news.boeing.com>

In article <slrna06q29.7ul.rgarciasuarez@rafael.kazibao.net>,
Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
>...
>} 
>}   % perl -wle ' sub f:lvalue {$_} print f() -> [0] '
>}   Can't use an undefined value as an ARRAY reference at -e line 1.
>
>Hm, this looks like a bug. As $_ is undefined, it should spring into
>existence, as documented in perlref. Can you report it via perlbug?

I thought autovivifying worked only for a hash or array element...
as in perlref's example:  

   $array[$x]->{"foo"}->[0] = "January";

That is, I don't see any doc instances in this context of an 
unsubscripted lvalue which could autovivify - unless there's
an actual array or hash ref. The base lvalue ref to the left
of the -> as in  $array->{foo}->{"foo"} will generate an error 
unless $array is a valid ref.  

Or have I missed something...

--
Charles DeRykus


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

Date: 27 Nov 2001 12:31:23 -0800
From: jayhaque@yahoo.com (Jay Man)
Subject: PERL DBI ODBC... MS SQL  *argh*
Message-Id: <f74f8159.0111271231.6fcedbe7@posting.google.com>

Hi Everyone,

I am new to this so please excuse my ignorance on this subject matter.

I am trying to write a perl script (running on solaris) thats connects
to an MS SQL server and gets some data. I downloaded and installed the
DBI and DBD::ODBC, since I don't have an ODBC Driver Manager I
installed iodbc.

I wrote a very stupid script just to see what would happen:

use DBI;

$dbase = "DBI:ODBC:TEST";
$username = "jdoe";
$password = "123456";
$dbh = DBI->connect($dbase, $username, $password);
print "hello";

This is the entry in the odbc.ini:

[TEST]
Driver          = /usr/local/lib/libiodbc.so.2
Description     = Sample OpenLink DSN
Host            = 149.123.1.14
UserName        = jhaque
Password        = 1curaqt2nv 
ServerType      = MS SQL 7
Database        = test
FetchBufferSize = 99
ReadOnly        = no
TraceFile       = /tmp/odbc.trace
Trace           = 1

Like I said.... it's stupid... i just wanted to see if everything
loads okay.
When I run it I get:

DBI->connect(TEST) failed: [iODBC][Driver Manager]Data source name not
found and no default driver specified. Driver could not be loaded
(SQL-IM002)
[iODBC][Driver Manager]Data source name not found and no default
driver specified. Driver could not be loaded (SQL-IM002)(DBD:
db_login/SQLConnect err=-1) at ./test.pl line 12

I read someplace that I needed to get the openlink software so I did
that and I
still get the same message.

Can someone please point me in the right direction.....

Thanks,

Jay


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

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


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