[12121] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5721 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 19 06:07:29 1999

Date: Wed, 19 May 99 03:00:21 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 19 May 1999     Volume: 8 Number: 5721

Today's topics:
    Re: about:  use strict; (Larry Rosler)
    Re: about:  use strict; <ebohlman@netcom.com>
    Re: Accents Sensitivity <gellyfish@gellyfish.com>
    Re: DBD::ODBC compilation problems - Help! <awalrant@softhome.net>
        DBD:DB2 compile problem Andreas.Vierengel@gmx.net
    Re: E-Mail from NT Via Net::SMTP (Lee)
    Re: FAQ 4.63: How can I store a multidimensional array  <ebohlman@netcom.com>
    Re: Help w/ /tr func (Bart Lateur)
    Re: Hiding OLE Object in Perl <c4jgurney@my-dejanews.com>
    Re: How to catch the return value in Perl? (Dave Cross)
        In dire need of help! System() call on NT... webmaster@man.amis.com
        interaktiv perl, list perl variables <daniel.heiserer@bmw.de>
    Re: Perl "constructors" (Bart Lateur)
    Re: Perl "constructors" (Bart Lateur)
    Re: Perl "constructors" armchair@my-dejanews.com
    Re: Please Help: My script runs on win32, it won't run  <t.mallee@atnet.de>
    Re: Please Help: My script runs on win32, it won't run  <t.mallee@atnet.de>
    Re: Protecting perl source code (Michel Dalle)
        Rand Question <bie@connect.ab.ca>
    Re: Rand Question (Bart Lateur)
    Re: Setting script to activite on a timer james_p9827@my-dejanews.com
    Re: Setting script to activite on a timer <gellyfish@gellyfish.com>
    Re: sort non-alpha characters <hvermeulen@correctnl.com>
    Re: Sorting problem (Bart Lateur)
    Re: Tie Fighter (Fuzzy Warm Moogles)
        Waiting for input on multiple Filehandles <jpburton@netspace.net.au>
    Re: Y2K. localtime(time) <gellyfish@gellyfish.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 18 May 1999 22:59:42 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: about:  use strict;
Message-Id: <MPG.11abf32862ac36a0989a9c@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <7htgdq$1ui$2@justice.csc.cuhk.edu.hk> on 19 May 1999 
04:58:34 GMT, Austin Ming <austin95002887@yahoo.com> says...
> Why it is a good recomendation to use "use strict;" after "#!/usr/bin/perl" ?

That should be 'after "#!/usr/bin/perl -w"'.  :-)

When you have read `perldoc strict`, ask again if you still have any 
questions.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 19 May 1999 06:01:08 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: about:  use strict;
Message-Id: <ebohlmanFByu1w.FF@netcom.com>

Austin Ming <austin95002887@yahoo.com> wrote:

: Why it is a good recomendation to use "use strict;" after "#!/usr/bin/perl" ?

[you meant to write 'after "#!/usr/bin/perl -w"', of course...]

Because it cuts back on the amount of rope Perl gives you to hang 
yourself with.  'perldoc strict' will tell you what kinds of rope (there 
are three of them) and how much rope get held back.



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

Date: 19 May 1999 09:27:09 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Accents Sensitivity
Message-Id: <374275dd@newsread3.dircon.co.uk>

David Cassell <cassell@mail.cor.epa.gov> wrote:
> Yogish Baliga wrote:
>> 
>> You can use Phoenetic searching using the soundex function.
>> 
>> -- Baliga
>> 
>> amenrique@my-dejanews.com wrote:
>> 
>> > I have developed a search engine in Spanish. It works fine. The problem
>> > is that users are trying to find words without writing the accents used
>> > in spanish, i.e. they search for Maria with no results, as the right
>> > spelling is Marma (with an accent on the i)
> 
> That may help.  But soundex() hashes everything into a teeny
> space, leading to unfortunate collisions.  Try checking
> the soundex values of 'Ellery' and 'Euler'.  They're the
> same.  Probably not what the poster wanted.
> 

Also the Text::Soundex module will be optimized for English speakers or
as the manpage puts it:

   The algorithm is intended to hash words (in particular surnames) into a 
   small space using a simple model which approximates the sound of the word 
   when spoken by an English speaker

Of course there is no reason that it cant be modified to work with Spanish
names (actually I'd be surprised if there isnt a similar algorithm out
there already)

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Wed, 19 May 1999 11:49:52 +0200
From: Alain Walrant <awalrant@softhome.net>
Subject: Re: DBD::ODBC compilation problems - Help!
Message-Id: <37428940.B4486B51@softhome.net>

Brian Findley wrote:

> I'm trying to install all the 'right' packages so that I can connect to
> a MS Sql Server database from my Unix box running HP-UX 10.20 (see the
> perl -V output at the bottom).  So far, I have the latest version of
> Perl (5.005.03), the latest version of DBI (1.06), the latest version of
> iODBC (2.50), and DBD::ODBC (0.20).  Everything has installed correctly
> except that I'm having trouble just getting the DBD::ODBC to compile.
> This may be information overload - better to have more than enough, I
> guess.  Below is the output from *trying* to install the DBD::ODBC
> package.  What have I done wrong and how might I fix it??  Any
> help/suggestions on this matter will be appreciated.
>
> Thanks in advance,
> Brian

Hi,
Maybe I'm wrong, but as far as I know, ODBC is typically a MS Windows
technology.
You should have the DB on your unix server and the perl script running on a
client that is OBDC compliant (a Windows client). When I look to your
output, it seems you try to install the DBD:ODBC driver in your Unix system.
It does not make sence to me. Try to install it on your client side.
Another possibiliy shouls be to use the right and appropriate DBD module for
MS sql server.

Regards.
Alain.






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

Date: Wed, 19 May 1999 09:11:58 GMT
From: Andreas.Vierengel@gmx.net
Subject: DBD:DB2 compile problem
Message-Id: <7htv8u$mju$1@nnrp1.deja.com>

I am using RedHat 5.2 with updates and Kernel 2.2.7 and UDB 5.2 for
Linux.
After I had upgraded to Perl5.00503, I was unable to compile the DBD:DB2
driver.
I have installed the SDK, so here is not the problem.
I installed DBI-1.08 before with no problems (all tests passed).
I'm a bit familiar with compilers, so I tried to track down the problem
alone.
The error occurs on calling following functions: DBIc_ACTIVE_on
and DBIc_ACTIVE_off (according to the line where the compiler breaks).
I don't know from where he get the message: 'thr' undeclared ...
There is no string 'thr' in the whole file or in the #includes !
Any help is apreciated.

--Andy


Here is the output:

Configuring DBD::DB2...
Remember to actually read the README and CAVEATS files!

Using DB2 in /usr/IBMdb2/V5.0
DB2 sysliblist: -L/usr/IBMdb2/V5.0/lib -ldb2
System: perl5.00503 linux myhost.mydomain.org 2.2.7 #1 thu may 6
17:51:29 cest 1999 i686 unknown  i686-linux-thread dl_dlopen.xs
Compiler: cc -O2 -D_REENTRANT -Dbool=char -DHAS_BOOL
-I/usr/local/include

Writing Makefile for DBD::DB2::Constants
Writing Makefile for DBD::DB2
[root@raumflotte DBD-DB2-0.71]# make
make[1]: Entering directory `/usr/local/src/DBD-DB2-0.71/Constants'
cc -c -I/usr/IBMdb2/V5.0/include -D_REENTRANT -Dbool=char -DHAS_BOOL
-I/usr/local/include -O2    -DVERSION=\"0.20\" -DXS_VERSION=\"0.20\"
-fpic -I/usr/lib/perl5/5.00503/i686-linux-thread/CORE  Constants.c
Running Mkbootstrap for DBD::DB2::Constants ()
chmod 644 Constants.bs
LD_RUN_PATH="" cc -o ../blib/arch/auto/DBD/DB2/Constants/Constants.so
-shared -L/usr/local/lib Constants.o
chmod 755 ../blib/arch/auto/DBD/DB2/Constants/Constants.so
cp Constants.bs ../blib/arch/auto/DBD/DB2/Constants/Constants.bs
chmod 644 ../blib/arch/auto/DBD/DB2/Constants/Constants.bs
make[1]: Leaving directory `/usr/local/src/DBD-DB2-0.71/Constants'
cc -c -I/usr/IBMdb2/V5.0/include
-I/usr/lib/perl5/site_perl/5.005/i686-linux-thread/auto/DBI -D_REENTRANT
-Dbool=char -DHAS_BOOL -I/usr/local/include -O2    -DVERSION=\"0.71\"
-DXS_VERSION=\"0.71\" -fpic
-I/usr/lib/perl5/5.00503/i686-linux-thread/CORE  DB2.c
cc -c -I/usr/IBMdb2/V5.0/include
-I/usr/lib/perl5/site_perl/5.005/i686-linux-thread/auto/DBI -D_REENTRANT
-Dbool=char -DHAS_BOOL -I/usr/local/include -O2    -DVERSION=\"0.71\"
-DXS_VERSION=\"0.71\" -fpic
-I/usr/lib/perl5/5.00503/i686-linux-thread/CORE  dbdimp.c
dbdimp.c: In function `db2_db_login':
dbdimp.c:250: `thr' undeclared (first use this function)
dbdimp.c:250: (Each undeclared identifier is reported only once
dbdimp.c:250: for each function it appears in.)
dbdimp.c: In function `db2_db_disconnect':
dbdimp.c:343: `thr' undeclared (first use this function)
dbdimp.c: In function `db2_st_execute':
dbdimp.c:822: `thr' undeclared (first use this function)
dbdimp.c: In function `db2_st_finish':
dbdimp.c:959: `thr' undeclared (first use this function)
make: *** [dbdimp.o] Error 1


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Wed, 19 May 1999 06:11:45 GMT
From: lee.kimber@bignofoot.com (Lee)
Subject: Re: E-Mail from NT Via Net::SMTP
Message-Id: <374254c6.4349788@news.dircon.co.uk>

You should check return codes at each part of it where you try to do
something, eg: 

   $smtp->to('kstephan\@xxxx.xxx.com');        # recipient's address

        $smtp->data();                      # Start the mail

should read:

   $smtp->to('kstephan\@xxxx.xxx.com') || die "Couldn't
smtp->to:$!\n";        # recipient's address

        $smtp->data() || die "Couldn't smtp->data: $!\n";
# Start the mail


The $!\n bit makes the script display the error message it got from
the system when it tried to do that line of code.

In this script's case, it dies at  $smtp->to('kstephan\@xxxx.xxx.com')

I think this line may need double quotes around the email name but I'm
not sure (it worked with mine).

Hope this helps.

On Thu, 13 May 1999 11:49:11 -0400, "Georg Buehler"
<gbuehler@ralgi.com> wrote:

>What other return codes should one check, though?
>For instance, how should I check to make sure that the complete message was
>sent?
>Or whether the server refused the message because the address was bad?
>
>--Georg

The Home Repossession Page
http://www.users.dircon.co.uk/~lee-k/

(Remove antispam device to reply by email)


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

Date: Wed, 19 May 1999 05:57:45 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: FAQ 4.63: How can I store a multidimensional array in a DBM file?
Message-Id: <ebohlmanFBytw9.6o@netcom.com>

Tom Christiansen <perlfaq-suggestions@perl.com> wrote:
:     Either stringify the structure yourself (no fun), or else get the
:     MLDBM (which uses Data::Dumper) module from CPAN and layer it on
:     top of either DB_File or GDBM_File.

s/(Data::Dumper)/$1, FreezeThaw, or Storable/;



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

Date: Wed, 19 May 1999 07:34:29 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Help w/ /tr func
Message-Id: <37476887.2058643@news.skynet.be>

Steve Short wrote:

>I would like to use either the tr/ or s/ function to remove all
>occurances of carriage returns from a text variable. What searchtext
>character should I try??
>
>I tried \n & \r but neither worked. Sometimes people will add these CR's

You didn't forget the //d modifier, did you?

	tr/\n\r//d;

That will delete all LF's and CR's.

	Bart.


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

Date: Wed, 19 May 1999 09:21:07 GMT
From: Jeremy Gurney <c4jgurney@my-dejanews.com>
Subject: Re: Hiding OLE Object in Perl
Message-Id: <7htvq3$muh$1@nnrp1.deja.com>

In article <7hsuft$g1$1@nnrp1.deja.com>,
  kgentes@gentek.net wrote:
> Hi there..
>
< #1 snipped >
>
>   #2 When I do get the object running, I try to
>      close it down after saving the file.  The problem
>      is that Excel is so "concerned" about me saving the
>      file in the non-excel native format, that it
>      dumps the confirmation dialog to the screen
>      for me to verify my explicitly demanded request
>      to close the current document instance in the MDI.
>      I can do this fine in VB, but some wackyness
>      with my implementation in Perl seems to
>      have me missing something..
>

I'm not sure about the perl syntax but in vb you'd set
activeworkbook.saved=true
(would that be $excel->ActiveWorkbook->Saved=>true ?)
which makes excel think that the file has been saved without actually
saving it.

One problem to watch out for is the data in the csv file might not have
the same formats for dates etc. as your original.

HTH

Jeremy Gurney
SAS Programmer  |  Proteus Molecular Design Ltd.


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Wed, 19 May 1999 07:41:34 GMT
From: dave@dave.org.uk (Dave Cross)
Subject: Re: How to catch the return value in Perl?
Message-Id: <37426ad2.3782365@news.demon.co.uk>

On Wed, 19 May 1999 10:07:37 +0800, "peary" <peary@ms1.url.com.tw>
wrote:

>Hi, all,
>I have asked the following problem for a few days, and someone ever
>answered me. But the problem still not solved.
>Does anyone know how to solve the problem?
>
>And I found the web seems can't find the path of C execution file,
>and don't execute it. But I have put the pl and C in the same path, WHY?
>Could anyone tell me ?
>
>Thanks!!
>Peary
>
>
>Here is my problem,
>
>I use the Linux system with informix & perl,
>We know we can use the perl statement  " qx (ls -al) "
>to capture the output of "ls -al" , and it really works.
>Then I tried to write a C program and compiled to execution file as
>"add".
>the code is as following....
>
>/*--add.c--*/
>#include <stdio.h>
>main(int argc, char *argv[]){
>       printf("%s",argv[1]);
>       return;
>}
>
>and my perl example code :
>
>#!/usr/bin/perl
>#--tt.pl
>use CGI;
>use CGI::Carp;
>
>$|=1;
>print "Content-type:text/html\n\n";
>$p="123abc";
>
>#--this is where i call the C  program and want to capture the output value
>$val=qx(./add $p);
>print "<h1>return value--$val</h1>";
>
>When I execute the perl program under the linux command mode,
>"perl  tt.pl", it really print out the result as
>"<h1>return value--123abc</h1>".
>But when i run it on BROWSER and submit to call the tt.pl ,
>the result(123abc) won't print out on browser(the result is "return
>value--"), why?
>Is somewhere wrong? or
>Is there anyother  method to catch the output or the return value
>of the C program ?

A few ideas you might look at.

What user id is yiur web server running under? Does it have permission
to run your add program?

Which directory is '.' when your browser is running?

hth,

Dave...
Dave Cross <dave@dave.org.uk>
<http://www.dave.org.uk>


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

Date: Wed, 19 May 1999 08:44:02 GMT
From: webmaster@man.amis.com
Subject: In dire need of help! System() call on NT...
Message-Id: <7httkj$lhl$1@nnrp1.deja.com>

I am working on NT platform. I want to run an expect script by passing
to it two paramaters. These are from the username/password form fields
filled in by the user. The expect script will do something with it. My
problem is it is not doing anything. I have already tried all means I
have found in dejanews (including the one below) but nothing seems to
work. It's suppose to authenticate the username & password against a VAX
account. Please help me. The expext script, below the Perl code,
already works.  Any ideas will be greatly appreciated. Thanks!!

if ($args{vax_password}) {
	$args = "sheila.exp $args{username} $args{vax_password}";
	$rc = 0xffff & system($args);
	($rc == 0) || die "Can't run $args (rc $rc): $!\n";
	if ($? >> 8) {
		$status = $? >>8;
		if ($status == 6) {
			print "Timeout\n";
		}
		elsif ($status == 5) {
			print "Unexpected exit mode\n";
		}
		elsif ($status == 3) {
			print "Authorization Failure\n";
		}
		elsif ($status == 2) {
			print "Expired password\n";
		}
		return 0;
	}
	return 1;
}
*****************************************************
set timeout 20
spawn telnet 172.16.101.2
match_max 100000
expect -exact "Username: "
send -- "[lindex $argv 0]/nocommand\r"
expect -exact "Password: "
send -- "[lindex $argv 1]\r"
expect {
	exp_continue;
	"zation failure" {exit 3}
	"expired"	 {exit 2}
	"ora-mfg:"	 {send -- "logout:==logout\rlogout/brief\r";
exit 0}
	timeout {exit 6}
}
expect eof
exit 5


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Wed, 19 May 1999 08:47:24 +0200
From: Daniel Heiserer <daniel.heiserer@bmw.de>
Subject: interaktiv perl, list perl variables
Message-Id: <37425E7C.47BD0FF9@bmw.de>

Hi,
I would like to have an interaktiv perl-shell. :-))

does something like this already exist? 
Probably yes, but where?

The following loop somewhere in my script works quite fine:
------------------------------------------------------------------------
printf "$prompt>>";
while(<STDIN>){
        chop;
        eval($_);
        printf "$prompt>>";
}
-------------------------------------------------------------------------
A signal handling for <control-z> should exit the loop and return to the
script.


There are now two important things I would need, and I don't know how to
realize:

1) if eval fails I would like to have a message like:
"error in parsing $_"
currently he says nothing
2) How can I list my variables and their representation:
I can use "print" if I know that this variable exists, but if
I don't know that it exists?

something like a "ls" in the shell or matlab's "whos"
----------- what I would like-------------------------
>> whos

$a		scalar
$B		scalar
@myfield	4x4 array
%hasi		hash array
----------- end what I would like-------------------------

 
Bye daniel
please also mailto:daniel.heiserer@bmw.de

--------------------------------------------------------------
Dipl.-Phys. Daniel Heiserer, BMW AG, Knorrstrasse 147, 80788 Muenchen
Abteilung EK-20
Tel.: 089-382-21187, Fax.: 089-382-42820
mailto:daniel.heiserer@bmw.de


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

Date: Wed, 19 May 1999 07:34:23 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl "constructors"
Message-Id: <37446522.1189840@news.skynet.be>

armchair@my-dejanews.com wrote:

>But the "exception handling" of Perl is not covered in
>introductory books and is not easily picked up from what is referred to
>as "the manual". 

Check out "eval BLOCK" and "die".

	defined eval {
		my ($x,$y) = (10,0);
		print $x/$y;
	} or warn "Got an exception: $@";
		
	Bart.


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

Date: Wed, 19 May 1999 07:34:25 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl "constructors"
Message-Id: <37456624.1447548@news.skynet.be>

Randal L. Schwartz wrote:

>And your point? I don't get the analogy.  And I'm nun (:-) of the
>above, and I can criticize Catholicism all day (since I can spell it
>right), but I'd be deluding myself if I thought it would change
>anything, so I'm wasting my breath.

That WAS just his point: unless your on the inside, you cannot begin to
change anything.

	Bart.


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

Date: Wed, 19 May 1999 09:35:21 GMT
From: armchair@my-dejanews.com
Subject: Re: Perl "constructors"
Message-Id: <7hu0kp$nbm$1@nnrp1.deja.com>

In article <m1so8uhrrc.fsf@halfdome.holdit.com>,
  merlyn@stonehenge.com (Randal L. Schwartz) wrote:
> >>>>> "armchair" == armchair  <armchair@my-dejanews.com> writes:
>
> armchair> The only people that can "criticize" Catholocism are the
> armchair> Pope, bishops, priests, and nuns.
>
> And your point? I don't get the analogy.  And I'm nun (:-) of the
> above, and I can criticize Catholicism all day (since I can spell it
> right), but I'd be deluding myself if I thought it would change
> anything, so I'm wasting my breath.
>
> I didn't see any Perl in that post.

Even when you cannot see Perl, Perl is nearby. Often, it takes a change
of habit in order for Perl to come into view.



--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: 19 May 1999 09:21:04 GMT
From: "Thomas Mallee" <t.mallee@atnet.de>
Subject: Re: Please Help: My script runs on win32, it won't run on Unix
Message-Id: <7htvq0$al5$1@surz18.HRZ.Uni-Marburg.DE>

What is the error message?

Does the script start with something like #!/usr/local/bin/perl -w ?

<lazersa@my-dejanews.com> schrieb in im Newsbeitrag:
7hkrfg$l8n$1@nnrp1.deja.com...
> Hi,
> I have written a perl script based on a tutorial
> which I downloaded, in this tutorial, the author
> suggested i use win32 (Activeperl) to debug my
> perl scripts. The script runs without any glitches
> on a windows-based system. When I try it on a unix
> server, it just returns an error message - I do
> not have access to the log files, so i can't get
> any more information than that.
>
> Does anyone have any ideas as to why it won't run,
> or is there any Url where i can see the
> differences(or how to modify a script for unix)?
>
> Thanx
>
> Warren
>
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---




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

Date: 19 May 1999 09:21:05 GMT
From: "Thomas Mallee" <t.mallee@atnet.de>
Subject: Re: Please Help: My script runs on win32, it won't run on Unix
Message-Id: <7htvq1$al5$2@surz18.HRZ.Uni-Marburg.DE>

What is the error message?

Does the script start with something like #!/usr/local/bin/perl -w ?

<lazersa@my-dejanews.com> schrieb in im Newsbeitrag:
7hkrfg$l8n$1@nnrp1.deja.com...
> Hi,
> I have written a perl script based on a tutorial
> which I downloaded, in this tutorial, the author
> suggested i use win32 (Activeperl) to debug my
> perl scripts. The script runs without any glitches
> on a windows-based system. When I try it on a unix
> server, it just returns an error message - I do
> not have access to the log files, so i can't get
> any more information than that.
>
> Does anyone have any ideas as to why it won't run,
> or is there any Url where i can see the
> differences(or how to modify a script for unix)?
>
> Thanx
>
> Warren
>
>
> --== Sent via Deja.com http://www.deja.com/ ==--
> ---Share what you know. Learn what you don't.---




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

Date: Wed, 19 May 1999 09:05:07 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Protecting perl source code
Message-Id: <7hturi$qln$1@news.mch.sbs.de>

In article <3741b3f8$0$213@nntp1.ba.best.com>, John Callender <jbc@shell2.la.best.com> wrote:
>It occurs to me that if someone just wrote an obfuscator that ROT13'd
>all the user-defined variable and subroutine names, deleted all the
>comments, and squashed all the whitespace outside of quoted strings,
>you could just point these people to it and stop waging the eternal
>battle of trying to convince people that they shouldn't hide their
>code.
>
>This would do very little to thwart a determined person, but it would
>be sufficiently annoying, I would think, to satisfy many of these
>folks.

Have you ever looked at the code for LinkScan ? It does something
like this : no spaces, no newlines, random variable names, lots of
nested variables and subroutines  etc.
(You'll find it at http://www.elsop.com/linkscan/)

And if you do have errors in your script, you get an warning like :
Global variable "zSHImT" requires explicit package name at linkscan.pl line 64
(sic)

Making (a little) sense of scrambled code takes time, but it can be
done. But then, as you said, it may not be worth the effort :-)

Michel.


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

Date: Sun, 16 May 1999 22:22:44 -0600
From: Tim <bie@connect.ab.ca>
Subject: Rand Question
Message-Id: <373F9994.774B@connect.ab.ca>

If I had 5 scalars & I wanted to pick which one to print randomly , How
would I do that (And if they pushed a button, it may or may not pick the
same scalar again) (button would re run the script)


Tim


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

Date: Wed, 19 May 1999 09:36:25 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Rand Question
Message-Id: <374283d6.2016186@news.skynet.be>

gTim wrote:

>If I had 5 scalars & I wanted to pick which one to print randomly , How
>would I do that (And if they pushed a button, it may or may not pick the
>same scalar again) (button would re run the script)

Use an array instead.

	@ary = qw(A B C D E);
	print $ary[rand @ary];

And if you need to avoid duplicate picks, delete the picked item from (a
copy of) the array, using splice().

	@ary = qw(A B C D E);
	for (1 .. 3) {
		print splice @ary, rand @ary, 1;
	}

There's also a FAQ on how to shuffle an array, so all you have to do is
pick the next item from the shuffled array. The docs (including FAQ's)
ought to be on your system as .POD files (text with some formatting
code), or maybe as HTML if on the Activestate Win32 port. 

perldoc -q shuffle
->
Found in lib/perl5/pod/perlfaq4.pod
  How do I shuffle an array randomly?

	Bart.


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

Date: Wed, 19 May 1999 06:43:17 GMT
From: james_p9827@my-dejanews.com
Subject: Re: Setting script to activite on a timer
Message-Id: <7htmi5$g3a$1@nnrp1.deja.com>

Hello,

I have a script that I would like to run every 4-6 hours.  Right now I
telnet to my hosting service and run the script.  It does it's thing
then sleeps for a few hours then the cycle continues.  This works fine,
until I end my telnet connection, then the script stops running.  Is
there a way I can keep the script running even after I log off?  Thanks
for you help.

Regards,

James


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: 19 May 1999 10:38:18 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Setting script to activite on a timer
Message-Id: <3742868a@newsread3.dircon.co.uk>

james_p9827@my-dejanews.com wrote:
> Hello,
> 
> I have a script that I would like to run every 4-6 hours.  Right now I
> telnet to my hosting service and run the script.  It does it's thing
> then sleeps for a few hours then the cycle continues.  This works fine,
> until I end my telnet connection, then the script stops running.  Is
> there a way I can keep the script running even after I log off?  Thanks
> for you help.
> 

This not really to do with Perl at all as the question could be asked of
any program written in any language and the answer would most probably
be the same.

Assuming you are on a Unix system:

nohup myprog &

should do the trick. 

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: Wed, 19 May 1999 11:03:40 +0200
From: Henry Vermeulen <hvermeulen@correctnl.com>
Subject: Re: sort non-alpha characters
Message-Id: <37427E6C.36686F54@correctnl.com>

I worked whit this example but didn't succeed.
Didn't no how to change it.
I don,t no what the d+ means.
Your regexp is quite easy too understand for me.
I wasn't sure if i was on the correct way with this example.

($item) = /\d+\s*(\S+)/;

Thanx
Henry Vermeulen




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

Date: Wed, 19 May 1999 07:34:27 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Sorting problem
Message-Id: <37466734.1719756@news.skynet.be>

Arjun Ray wrote:

>     print
>       map { ('<tr>', 
>             map { ('<td>', /^$/ ? '-' : $_, '</td>') } @$_,
>             "</tr>\n") }
>       sort { $b->[2] <=> $a->[2] }
>       grep { $_->[1] =~ m/$FORM{'TNSET'}/i }
>       map { chomp; [ split /;/, $_, 9 ] }
>       @techlines;
> 
>At which point, we'd have a canonical ST were it not for that pesky
>grep (surely the nested map is allowed?.) Should we petition Mr.
>Christiansen to allow the canonical form to have an optional grep?  

But you CAN replace grep with map!

	grep { COND } 

is equivalent to

	map { COND ? $_ : () }

(1 item or none, depending on COND)

So I expect this might work (but untested; one may hope!):

     print
       map { ('<tr>', 
             map { ('<td>', /^$/ ? '-' : $_, '</td>') } @$_,
             "</tr>\n") }
       sort { $b->[2] <=> $a->[2] }
       map { chomp; my @ary = split /;/, $_, 9 ; 
		$ary[1] =~ m/$FORM{'TNSET'}/i ? \@ary : () }
       @techlines;

	Bart.


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

Date: Wed, 19 May 1999 06:16:57 GMT
From: tgy@chocobo.org (Fuzzy Warm Moogles)
Subject: Re: Tie Fighter
Message-Id: <37435353.107522791@news.oz.net>

On Wed, 19 May 1999 02:45:33 GMT, pudge@pobox.com (Chris Nandor) wrote:

>In article <3744083a.88294931@news.oz.net>, tgy@chocobo.org wrote:
>
># Instead of returning the tied scalar, return a reference to it.  Then assign
># the reference to a typeglob.
>
>A solution requiring the use of global variables is no solution at all.

I disagree.  And I didn't use any. :)

-- 
Fuzzy | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=


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

Date: Wed, 19 May 1999 17:29:29 +1000
From: Jeremy Burton <jpburton@netspace.net.au>
Subject: Waiting for input on multiple Filehandles
Message-Id: <37426859.B04E3FC4@netspace.net.au>

Hi There,
    I am attempting to write some perl code which will read from both a
named pipe, and also from a com port. I am trying to work out how to
write the perl code such that whilst in a loop, it will wait for input
either on the com port OR on the named pipe, and then continue through
the loop whenever one of these is acheived. Does
anyone know of a way in which I can do this? I have tried using select
with 4 arguments, however I was only able to get this to wait for the
second input device
(whichever order i put them in didn't matter) to have data waiting.

Any help/pointers/etc would be most helpful,

Thanks,

Jeremy

--

Jeremy Burton
Database Administrator, Netspace Online Systems
jpburton@netspace.net.au
jpburton@thedonkeys.org, jpburt@students.cs.mu.oz.au





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

Date: 19 May 1999 09:17:49 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Y2K. localtime(time)
Message-Id: <374273ad@newsread3.dircon.co.uk>

Norman Gaywood <norm@turing.une.edu.au> wrote:
> fl_aggie@thepentagon.com (I R A Aggie) writes:
> 
>>Perl's localtime gets its information from the underlying system. If
>>you really do have a Y2K problem in a perl script, the odds are very
>>good that you have a Y2K problem in your OS...
> 
> Not quite. It's not hard for idiots to introduce Y2K bugs. Look at
> these lines from the popular(!?) perl message board program, wwwboard.pl:
> 
>  ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
> 
> OK so far, but after some truly horrible lines of code we get to this
> shocker:
> 
>  $long_date = "$months[$mon] $mday, 19$year at $hour\:$min\:$sec";
> 
> So the year 2000 will look like "19100". Smart stuff!
> 

Yes but it is an emisssion of Matts Script Archive so we dont really
expect that much of it ;-{

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5721
**************************************

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