[15948] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3361 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 14 18:36:26 2000

Date: Wed, 14 Jun 2000 15:36:11 -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: <961022171-v9-i3361@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 14 Jun 2000     Volume: 9 Number: 3361

Today's topics:
        Server error with very simple perl script <shaimelz@dds.nl>
    Re: Server error with very simple perl script <care227@attglobal.net>
    Re: Server error with very simple perl script <rootbeer@redcat.com>
    Re: Server error with very simple perl script <dwilgaREMOVE@mtholyoke.edu>
    Re: Server error with very simple perl script <bg@skypoint.com>
    Re: Server error with very simple perl script (Steven Smolinski)
        simple pattern matching question kevchuey@my-deja.com
        simple pattern matching question ktc@duke.edu
    Re: simple pattern matching question <lauren_smith13@hotmail.com>
    Re: simple pattern matching question <lr@hpl.hp.com>
    Re: sorting an array <lr@hpl.hp.com>
    Re: sorting an array newsposter@cthulhu.demon.nl
    Re: sorting an array <sariq@texas.net>
    Re: sorting an array <abe@ztreet.demon.nl>
    Re: sorting an array <russ_jones@rac.ray.com>
        Splitting a script into multiple files <trevor@trevorsky.com>
    Re: Splitting a script into multiple files <trevor@trevorsky.com>
    Re: Threads vs Forks <dan@tuatha.sidhe.org>
    Re: trouble installing manpages (Steve Harvey)
    Re: trouble installing manpages <nnickee@nnickee.com>
    Re: Ugh (Tad McClellan)
    Re: Ugh <brent.schenk@home.com>
    Re: Ugh (Bart Lateur)
    Re: Ugh (John Stanley)
    Re: Ugh (Craig Berry)
    Re: Up-to-date Perl for OS/2? <rootbeer@redcat.com>
        use of require <nospam@nospam.com>
    Re: use of require <dan@tuatha.sidhe.org>
    Re: uses for PERL (Craig Berry)
    Re: uses for PERL <uri@sysarch.com>
        Using a hash with popup_menu <ewald@electronicfrontiers.com>
        Very strange DBI:mysql-problem! joakim@varia.nu
    Re: works without strict but not with why ???? (Philip 'Yes, that's my address' Newton)
    Re: works without strict but not with why ???? <abe@ztreet.demon.nl>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 14 Jun 2000 19:01:35 +0200
From: shaimelz <shaimelz@dds.nl>
Subject: Server error with very simple perl script
Message-Id: <3947BA6F.82329F83@dds.nl>

Hi all,

I'm trying to run the underneath script on a unix machine with
apache....

- Permissions are set to 775
- Uploaded in ASCI format
- extension is .pl
- /usr/bin/perl is the executable for perl as said by my provider

What else do I need to do, to loose the server error's

#!/usr/bin/perl

  # test.pl -- simpel test scriptje

  print "Content-type: text/html\n\n";

  print <<"EOF";
  <HTML>

  <HEAD>
  <TITLE>Hello, world!</TITLE>
  </HEAD>

  <BODY>
  <H1>Hello, world!</H1>
  </BODY>

  </HTML>
  EOF



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

Date: Wed, 14 Jun 2000 13:49:23 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Server error with very simple perl script
Message-Id: <3947C5A3.6621FCD0@attglobal.net>

shaimelz wrote:
> 
> Hi all,
> 
> I'm trying to run the underneath script on a unix machine with
> apache....
> 
> - Permissions are set to 775
> - Uploaded in ASCI format
> - extension is .pl
> - /usr/bin/perl is the executable for perl as said by my provider
> 
> What else do I need to do, to loose the server error's


And that error is????


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

Date: Wed, 14 Jun 2000 10:58:00 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Server error with very simple perl script
Message-Id: <Pine.GSO.4.10.10006141057310.5301-100000@user2.teleport.com>

On Wed, 14 Jun 2000, shaimelz wrote:

> Subject: Server error with very simple perl script

When you're having trouble with a CGI program in Perl, here's a handy
troubleshooting guide to get you back on track. 

   http://www.smithrenaud.com/public/troubleshooting_CGI.html

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 14 Jun 2000 18:00:54 GMT
From: Dan Wilga <dwilgaREMOVE@mtholyoke.edu>
Subject: Re: Server error with very simple perl script
Message-Id: <dwilgaREMOVE-655928.14010014062000@news.mtholyoke.edu>

In article <3947BA6F.82329F83@dds.nl>, shaimelz@dds.nl wrote:

> Hi all,
> 
> I'm trying to run the underneath script on a unix machine with
> apache....
> 
> - Permissions are set to 775
> - Uploaded in ASCI format
> - extension is .pl
> - /usr/bin/perl is the executable for perl as said by my provider

You neglected to say what the error message you get back from the server is. 
It's possible that you are not allowed to run scripts, based on the 
permissions the site's administrator has given you.

If you run it from the commandline, does it work? If not, then perhaps the 
problem is the style of end-of-line sequences. This is very likely to be the 
case if you originally wrote the file on a Mac.

Dan Wilga          dwilgaREMOVE@mtholyoke.edu
** Remove the REMOVE in my address address to reply reply  **


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

Date: Wed, 14 Jun 2000 14:16:05 -0500
From: "Barry Grupe" <bg@skypoint.com>
Subject: Re: Server error with very simple perl script
Message-Id: <8i8lk0$rbo$1@shadow.skypoint.net>


>
> What else do I need to do, to loose the server error's
>
use CGI::Carp 'fatalsToBrowser';
Shows the error in your web browser

> #!/usr/bin/perl
>
>   # test.pl -- simpel test scriptje
>
>   print "Content-type: text/html\n\n";
>
>   print <<"EOF";

print <<EOF;

>   <HTML>
>
>   <HEAD>
>   <TITLE>Hello, world!</TITLE>
>   </HEAD>
>
>   <BODY>
>   <H1>Hello, world!</H1>
>   </BODY>
>
>   </HTML>
>   EOF
>

Better, try c.i.w.a.c newsgroup.




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

Date: Wed, 14 Jun 2000 19:57:01 GMT
From: sjs@yorku.ca (Steven Smolinski)
Subject: Re: Server error with very simple perl script
Message-Id: <slrn8kforg.11n.sjs@john.sympatico.ca>

shaimelz <shaimelz@dds.nl> wrote:
>I'm trying to run the underneath script on a unix machine with
>apache....

[...]
>  print <<"EOF";
[...]
>  EOF

You realize that the token EOF must start in the first column to 
work properly, right?

So run it from the commandline, and tell us what the error is.

Steve


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

Date: Wed, 14 Jun 2000 19:42:19 GMT
From: kevchuey@my-deja.com
Subject: simple pattern matching question
Message-Id: <8i8n6m$cmn$1@nnrp1.deja.com>

hi, I have a simple question:

I'm trying to see if a string (this contains \n also) contains two
strings "<" and ">".

So, the string could be:
--------------------------------------------
This is <my> sentence
--------------------------------------------

because it contains a "<" and a ">" in that order, it should return
true.

This should also work with newline characters inbetween the "<" and ">"
like this sentence (should return true):
--------------------------------------------
This is <my
split> sentence
--------------------------------------------

I've NEVER used regular expressions before.  I even have a book
explaining some of it, but its taking me way too long to decipher it...




-kevin


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


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

Date: Wed, 14 Jun 2000 19:48:59 GMT
From: ktc@duke.edu
Subject: simple pattern matching question
Message-Id: <8i8nj3$d34$1@nnrp1.deja.com>

hi, I have a simple question:

I'm trying to see if a string (this contains \n also) contains two
strings "<" and ">".

So, the string could be:
--------------------------------------------
This is <my> sentence
--------------------------------------------

because it contains a "<" and a ">" in that order, it should return
true.

This should also work with newline characters inbetween the "<" and ">"
like this sentence (should return true):
--------------------------------------------
This is <my
split> sentence
--------------------------------------------

I've NEVER used regular expressions before.  I even have a book
explaining some of it, but its taking me way too long to decipher it...




-kevin


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


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

Date: Wed, 14 Jun 2000 13:12:06 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: simple pattern matching question
Message-Id: <8i8otg$lml$1@brokaw.wa.com>


<kevchuey@my-deja.com> wrote in message news:8i8n6m$cmn$1@nnrp1.deja.com...
>
> I'm trying to see if a string (this contains \n also) contains two
> strings "<" and ">".
>
> So, the string could be:
> --------------------------------------------
> This is <my> sentence
> --------------------------------------------
>
> because it contains a "<" and a ">" in that order, it should return
> true.
>
> This should also work with newline characters inbetween the "<" and ">"
> like this sentence (should return true):
> --------------------------------------------
> This is <my
> split> sentence
> --------------------------------------------

If you have the string in a variable, then it's fairly simple.

print "true" if ($string =~ /<.*>/s); # or you can return true, or whatever

The 's' modifier 's'pans lines, thus making it possible to find matches that
may occur over a single line.

A few people were complaining about the Regular Expression documentation
being a little thick for newbies, but in lieu of any better RE-tutorial in
the standard documentation, have a look at perlre.

perldoc perlre

Lauren





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

Date: Wed, 14 Jun 2000 13:35:33 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: simple pattern matching question
Message-Id: <MPG.13b18c6b3036709298ab7e@nntp.hpl.hp.com>

In article <8i8nj3$d34$1@nnrp1.deja.com> on Wed, 14 Jun 2000 19:48:59 
GMT, ktc@duke.edu <ktc@duke.edu> says...
> I'm trying to see if a string (this contains \n also) contains two
> strings "<" and ">".
> 
> So, the string could be:
> --------------------------------------------
> This is <my> sentence
> --------------------------------------------
> 
> because it contains a "<" and a ">" in that order, it should return
> true.
> 
> This should also work with newline characters inbetween the "<" and ">"
> like this sentence (should return true):
> --------------------------------------------
> This is <my
> split> sentence
> --------------------------------------------
> 
> I've NEVER used regular expressions before.  I even have a book
> explaining some of it, but its taking me way too long to decipher it...

Look at the /s regex modifier (in perlop and perlre).  It causes the 
metacharacter '.' to match anything, including newlines.

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


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

Date: Wed, 14 Jun 2000 11:21:31 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: sorting an array
Message-Id: <MPG.13b16d06f6c2144298ab75@nntp.hpl.hp.com>

In article <lgkeksskc1bdiq81rq6rula6em7plep3nk@4ax.com> on Wed, 14 Jun 
2000 11:42:37 +0200, Abe Timmerman <abe@ztreet.demon.nl> says...
> On 13 Jun 2000 14:19:00 GMT, "D.W." <dpalmeNOSPAM@unitedtraffic.com>
> wrote:
> 
> > I have a problem in which I'm at a complete loss, so any help would be
> > appreciated.
> > 
> > I am taking some information from a mysql table (longitude and latitude
> > coordinates) and computing some distances on the fly.  I'm writing this
> > information including this computed distance to an array, but I need to be
> > able to sort this array on this mileage from lowest to highest.....
> 
> You could think of a different approach. If possible, you could let
> mysql calculate those distances and have them returned as an extra
> column in your result set. That way you won't have to bother storing and
> sorting yourself, but let mysql do it for you.

Instead of using the SQL 'ORDER BY' capability -- which imposes the 
computational burden on the database daemon (which may be on a separate 
machine, and may be handling several requests simultaneously) -- I 
prefer to sort in the application that requests the data.  I know how to 
do sorting in Perl efficiently (-:) and more flexibly than SQL can.

I would be interested in other experiences with this kind of tradeoff 
between the Perl program and the database server.

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


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

Date: 14 Jun 2000 19:21:00 GMT
From: newsposter@cthulhu.demon.nl
Subject: Re: sorting an array
Message-Id: <8i8lus$8bo$1@internal-news.uu.net>

Larry Rosler <lr@hpl.hp.com> wrote:

[SQL 'ORDER BY' vs Perl sort]

> I would be interested in other experiences with this kind of tradeoff 
> between the Perl program and the database server.

  I've been working on Perl/database code for 4 years now, which
might make me somewhat 'experienced' (or perhaps not ;)

  Getting the data sorted from the database lets me write cleaner
code. Especially if you process one row at a time and rows are
independant, you don't want to read all rows before processing
starts, but you want to be able to show the user work is being
done. Even if it would take a bit longer that way.

  Ordered data is also easier for testing/debugging. Always get
data in same order, makes errors easier to reproduce. ``Error
in chunk 3535'' makes a lot more sense if you can figure out
exactly what chunk 3535 was (or at least you can figure out
the range of rows in which your code had a problem).

  I even used 'order by' for database dumps that had to be
loaded in another database. The order of the data didn't
matter for the database, but it made error checking/fixing a
lot easier.

  Sometimes 'order by' is not powerful enough, but I've had few
of those situations. I can remember only one, and for that project
I'm using JDBC (and the JDK we started with didn't even have a
sort function ...)

Erik



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

Date: Wed, 14 Jun 2000 14:31:20 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: sorting an array
Message-Id: <3947DD88.3AEA8326@texas.net>

Larry Rosler wrote:
> 
> Instead of using the SQL 'ORDER BY' capability -- which imposes the
> computational burden on the database daemon (which may be on a separate
> machine, and may be handling several requests simultaneously) -- I
> prefer to sort in the application that requests the data.  I know how to
> do sorting in Perl efficiently (-:) and more flexibly than SQL can.
> 
> I would be interested in other experiences with this kind of tradeoff
> between the Perl program and the database server.

I don't think that it's quantifiable in a general way.

The ORDER BY clause handling has too many dependencies.

- Tom


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

Date: Wed, 14 Jun 2000 23:31:51 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: sorting an array
Message-Id: <fgrfksscp7e851itds9nks5vup4hn1s6a7@4ax.com>

On Wed, 14 Jun 2000 11:21:31 -0700, Larry Rosler <lr@hpl.hp.com> wrote:

 ...
> Instead of using the SQL 'ORDER BY' capability -- which imposes the 
> computational burden on the database daemon (which may be on a separate 
> machine, and may be handling several requests simultaneously) -- I 
> prefer to sort in the application that requests the data.  I know how to 
> do sorting in Perl efficiently (-:) and more flexibly than SQL can.

I do believe that the order in which data is returned by the RDBMS is
part of it's (information) value, so ORDER BY has become sort of a
second nature :-)

> I would be interested in other experiences with this kind of tradeoff 
> between the Perl program and the database server.

Development time is a major factor in this for me. Dealing with some
project that uses 30 odd queries with completely different result sets
each with its own order, it's much faster to have the RDMS sort it for
me than to write a good sorting routine that deals with the different
situations.

I sometimes do the sorting in the Perl program when testing on small
result sets and do not notice any difference when I move to an
ordered-query (although I never Benchmarked it). I even did something
similar to what OP is doing (calculating a bunch of stuff within the
query) and decided to stick with it, as I couldn't notice a drop in
performance.

In general I would think that your 'argument' could stick for data sets
that would fit into memory whilst sorting.

I suppose it all depends on the size of the result set, the way your
database is structured, complexity of the queries and the RDBMS you use.

My work requires me to be able to port projects to different
environments (CGI or ASP; Linux or NT; mysql or Access; any valid
combination thereof) quickly, and known result sets for one, make life
easy.

Oh well, as I said, it was just a thought...

-- 
Good luck,
Abe


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

Date: Wed, 14 Jun 2000 16:47:38 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: sorting an array
Message-Id: <3947FD7A.FE2A8266@rac.ray.com>

Tom Briles wrote:
> 
> Larry Rosler wrote:
> >
> > Instead of using the SQL 'ORDER BY' capability -- which imposes the
> > computational burden on the database daemon (which may be on a separate
> > machine, and may be handling several requests simultaneously) -- I
> > prefer to sort in the application that requests the data.  I know how to
> > do sorting in Perl efficiently (-:) and more flexibly than SQL can.
> >
> > I would be interested in other experiences with this kind of tradeoff
> > between the Perl program and the database server.
> 
> I don't think that it's quantifiable in a general way.
> 

I did a bunch of benchmarking of various sort methods, including
Perl's sort, the HP-UX and Sequent command line sort, SQL 'ORDER BY'
and SyncSort for Unix. We tried to take into account such factors as
number of records to sort, record length, sort key, collating sequence
(numeric, alpha, etc.), original "sortedness" of the data, network
traffic when the data was on another server from the sort program,
caches and buffers, etc. to make it a fair comparison of apples and
oranges as was possible.

Except for the most trivial sorts (under 100 eighty-byte records, if I
recall) SQL never was the fastest. On sorts of more than a gig of
records, Perl took maybe 95% of the time the system sort took, 30% of
SQL 'ORDER BY' (dammit Larry, you typed it in all caps so that must be
right and now *I* have to type it in all caps). The real speed demon
was SyncSort. It was typically twice as fast as any other sorting
method.

I did this testing at another company and I don't have a copy of the
results, but they were eye-opening. Oh yeah, the REAL real speed demon
was SyncSort/MVS running on a very well tuned IBM 3090. A sort that
took SyncSort/Unix three minutes took under a second on the mainframe.

-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

When cryptography is outlawed, only outlaws will
A2bgg c4dc8 aji0i knS4E 7eFj8 22Rl1
ZdGg3 gu8i6 lu12N s6NoG gn3g3 q835n


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

Date: Wed, 14 Jun 2000 13:52:01 -0700
From: "Trevor Sky Garside" <trevor@trevorsky.com>
Subject: Splitting a script into multiple files
Message-Id: <geS15.680$ee.18478@nntp2.onemain.com>

What is the best method for splitting a script into multiple files, such
that some variables can be made available to all of the subs from all of the
files?  I asked this awhile ago (my news server has since lost the thread),
and was told to "require" the external files.  This works except for the
variables.

Any ideas?




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

Date: Wed, 14 Jun 2000 14:14:34 -0700
From: "Trevor Sky Garside" <trevor@trevorsky.com>
Subject: Re: Splitting a script into multiple files
Message-Id: <gzS15.1210$UT.25218@nntp1.onemain.com>

"Trevor Sky Garside" <trevor@trevorsky.com> wrote in message
news:geS15.680$ee.18478@nntp2.onemain.com...
> What is the best method for splitting a script into multiple files, such
> that some variables can be made available to all of the subs from all of
the
> files?  I asked this awhile ago (my news server has since lost the
thread),
> and was told to "require" the external files.  This works except for the
> variables.
>
> Any ideas?
>


I should have included some example code with that:

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

#!/usr/bin/perl -w

use strict;

my %global;   # this is a hash I want ALL subs to be able to read and change

require "./include.pl";   # this file has some subs in it

$global{'thing'} = "value";

# at this point, I'd like to run a sub declared in the include.pl file
# that will do something based on the value of $global{'thing'}

do_something();  # sub defined in include.pl

# I understand that I could pass values, and for this simple example
# that makes sense.  But, given the complexity of my script that would
# require a considerable amount of work, not to mention much less
# readable code

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

Thanks for any help you guys can give.




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

Date: Wed, 14 Jun 2000 15:13:32 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Threads vs Forks
Message-Id: <wiN15.477$Zg4.3056@news1.rdc1.ct.home.com>

Rich Robinson <rich@claripoint.com> wrote:
> Hello,

> Assuming threading in Perl is stable, what would be the advantages of
> spawning numerous forks to do little jobs (database access/updates), over
> spawning numerous threads to do the same?  Would there be any advantage?

Using fork saves you from programming errors that would nuke your process
when running threaded. This is generally a good thing. On the other hand,
sharing data between forked processes is significantly more expensive than
sharing it between threads, and there are things (such as database
connections) that you can't always share between processes.

Thread switches are also cheaper than process switches, though that's not
a big deal with perl since other factors swamp the (relatively small) task
switch penalty.

					Dan


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

Date: 14 Jun 2000 15:13:10 GMT
From: steveharvey@geocities.com (Steve Harvey)
Subject: Re: trouble installing manpages
Message-Id: <slrn8kf886.bg6.steveharvey@itc001472.usitc.gov>

In article <394797F1.AB7B2822@umich.edu>, Lance E Sloan wrote:
>I'm using a Sun Ultra 10 with Solaris 2.6 and it's an AFS client.
>I built Perl 5.6.0 with little problem and most of the install worked,
>too.  However, when it came to installing the manpages, all
>heck broke loose.  That is, when make ran "./perl installman",
>that script apparently started a find, beginning with /.  The
>find went into /afs, naturally, which went extremely slow and
>I got lots of errors about "afs: Lost contact
>with volume location server ##.##.##.## in cell some.domain".
>
>Why is the installman script doing a find anyway?  The install
>finally finished a few hours later, but that's ridiculous!  I can't
>easily turn off AFS, because that's where my home directory
>is.
>
>Any suggestions?
>
>I'd appreciate it if responses could be emailed to me as well as
>posted to this newsgroup.
>
>Thanks!

Two gentle, civilized suggestions:

1. This question is probably better asked on one of the Sun/Solaris
   newsgroups.  Even though the install script may be written in Perl,
   it still sounds like a pretty OS-specific question.

2. As a general point of netiquette, some folks consider it rude when
   people request answers to their questions to be emailed directly.
   Sort of like that if people are going to take the time to answer
   your question, you can at least take the time to check back on the
   newsgroup for responses.  Plus, somebody else might benefit from
   the same info.


Good luck!
Steve


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

Date: Wed, 14 Jun 2000 15:55:37 -0500
From: Nnickee <nnickee@nnickee.com>
Subject: Re: trouble installing manpages
Message-Id: <E8C44503425232EC.95BDD6194737D465.040450C5CB37EC06@lp.airnews.net>

On 14 Jun 2000 15:13:10 GMT, someone claiming to be
steveharvey@geocities.com (Steve Harvey) said:

>In article <394797F1.AB7B2822@umich.edu>, Lance E Sloan wrote:
>>I'd appreciate it if responses could be emailed to me as well as
>>posted to this newsgroup.

>Two gentle, civilized suggestions:

>2. As a general point of netiquette, some folks consider it rude when
>   people request answers to their questions to be emailed directly.
>   Sort of like that if people are going to take the time to answer
>   your question, you can at least take the time to check back on the
>   newsgroup for responses.  Plus, somebody else might benefit from
>   the same info.

Steve, that was indeed very gentle, and I agree with you, but... Lance
asked for email *as well as* posted to the group... I used to do that
too when I had a yucky newsserver that didn't get all the posts.
Maybe that's why Lance asked...
Just a thought :)
Nnickee



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

Date: Wed, 14 Jun 2000 10:29:38 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Ugh
Message-Id: <slrn8kf5mi.48e.tadmc@magna.metronet.com>

On Wed, 14 Jun 2000 10:26:31 GMT, Dan <drshickell@bsu.edu> wrote:

> Subject: Ugh


The subject of your post is not ugh.

Lying to people and then asking them for help is ineffective.

Please put the subject of your posts in the Subject header of your posts.


>Anyone know any good ways to transport a perl script to a Unix Machine?


The File Transfer Protocol (FTP) is a protocol for transferring files.


>My main Dev machine is Windows.  So I write my PERL stuff in notepad etc.  I
>need a way to strip newline characters after transfer or a way to easily
>edit PERL on a windows box.  Any ideas?


FTP will handle that for you (be sure to use "text" or "ASCII" mode,
not "binary" mode).

Find an FTP client for transferring your files.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 14 Jun 2000 11:08:00 -0500
From: "Brent Schenk" <brent.schenk@home.com>
Subject: Re: Ugh
Message-Id: <3947ad6d.0@news>

Don't you ahve to FTP a perl script using ASCII or else it won't work.  I
found that out after writing good scripts and then they wouldn't work.
Dan <drshickell@bsu.edu> wrote in message
news:r5J15.1197$dF.61087@news1.rdc1.il.home.com...
> Anyone know any good ways to transport a perl script to a Unix Machine?
>
> My main Dev machine is Windows.  So I write my PERL stuff in notepad etc.
I
> need a way to strip newline characters after transfer or a way to easily
> edit PERL on a windows box.  Any ideas?
>
>




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

Date: Wed, 14 Jun 2000 17:04:42 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Ugh
Message-Id: <394cb9a8.1486654@news.skynet.be>

Dan wrote:

>Anyone know any good ways to transport a perl script to a Unix Machine?

With an FTP client, for example WS_FTP. Transfer in ASCII mode, and it
will take care of it.

And get a better editor. GWEdit (<www.gwdsoft.com>) is pretty nice.

-- 
	Bart.


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

Date: 14 Jun 2000 17:27:06 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Ugh
Message-Id: <8i8f9a$cib$1@news.NERO.NET>

In article <r5J15.1197$dF.61087@news1.rdc1.il.home.com>,
Dan <drshickell@bsu.edu> wrote:
>Anyone know any good ways to transport a perl script to a Unix Machine?

Floppy? Network? Removable disk? 

>My main Dev machine is Windows.  So I write my PERL stuff in notepad etc.  I
>need a way to strip newline characters after transfer or a way to easily
>edit PERL on a windows box.  Any ideas?

FTP ascii mode should do this.



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

Date: Wed, 14 Jun 2000 18:15:13 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Ugh
Message-Id: <skfithmjis438@corp.supernews.com>

Dan (drshickell@bsu.edu) wrote:
: Anyone know any good ways to transport a perl script to a Unix Machine?

FTP...

: My main Dev machine is Windows.  So I write my PERL stuff in notepad etc.  I
: need a way to strip newline characters after transfer or a way to easily
: edit PERL on a windows box.  Any ideas?

 ...being sure to transfer in ASCII mode, which will automagically
transform newlines appropriately in either direction.

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Beauty and strength, leaping laughter and delicious
   |   languor, force and fire, are of us." - Liber AL II:20


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

Date: Wed, 14 Jun 2000 10:26:50 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Up-to-date Perl for OS/2?
Message-Id: <Pine.GSO.4.10.10006141025430.5301-100000@user2.teleport.com>

On Wed, 14 Jun 2000, Paul D.Smith wrote:

> Subject: Up-to-date Perl for OS/2?
> 
> Anyone know of a source for such a thing?  Only binaries required.

Go to CPAN...

    http://www.cpan.org/

Select 'binary distributions ("ports")', then 'OS/2'. Does that lead you
to what you want? Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 14 Jun 2000 17:58:38 GMT
From: The WebDragon <nospam@nospam.com>
Subject: use of require
Message-Id: <8i8h4e$92u$0@216.155.33.144>

is it possible to have a use of require that specifies the version numbr 
of a module? 

rather than writing a version if/then, can i do something along the 
lines of :

use CGI::Carp qw(fatalsToBrowser);
use CGI qw( :standard :html3 );
require $CGI::VERSION = '2.66'; #not sure about the syntax here :)

instead of something like: 

use CGI::Carp qw(fatalsToBrowser);
use CGI qw( :standard :html3 );
    if ($CGI::VERSION < 2.66) {
        confess ("Your Website's System Administrator needs to install 
CGI.pm version 2.66 or later to run this script.\n", 
                 'The most recent version information and revision 
history is at http://stein.cshl.org/WWW/software/CGI/index.html#new') 
    };

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Wed, 14 Jun 2000 18:19:38 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: use of require
Message-Id: <_0Q15.728$Zg4.3473@news1.rdc1.ct.home.com>

The WebDragon <nospam@nospam.com> wrote:
> is it possible to have a use of require that specifies the version numbr 
                               ^^
 is this a typo of "or" by any chance?
 
> of a module? 

> rather than writing a version if/then, can i do something along the 
> lines of :

> use CGI::Carp qw(fatalsToBrowser);
> use CGI qw( :standard :html3 );
> require $CGI::VERSION = '2.66'; #not sure about the syntax here :)

Something like:

  use CGI 2.66 qw(:standard :html3) ;

will work if that was a typo above. Otherwise you're kinda stuck with the
use/$VERSION check, I think. You can always go wrap the use in a BEGIN and
string eval and check the return error:

  BEGIN {
	  eval "use CGI 2.66 qw(:standard :html3);";
	  if ($@) {
 	    # do something
	  }
	}

Inside the error check you can do a regex on $@ to catch module
non-existance versus bad version numbers, if you want to be that specific
with your error message.

					Dn


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

Date: Wed, 14 Jun 2000 17:02:27 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: uses for PERL
Message-Id: <skfel3t1is470@corp.supernews.com>

Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote:
: Craig Berry <cberry@cinenet.net> wrote in comp.lang.perl.misc:
: >Turing-complete*, too, yet you don't see a lot of it getting used on the
: >Web.  In fact, you'd have to go to some fairly narrow-purpose languages
: >(sed, for example) to find a non-TC language.
: 
: Hmmm... Sed can write symbols from an alphabet to a tape (a conceptually
: infinite string).  It can use another string to represent internal states,
: and it can inspect these to decide where to write what next.  I tentatively
: propose that sed *is* Turing-complete.

The sticking point here in my analysis of this question is whether sed can
read back the results of its writes; I don't believe it can do so.  This
disqualifies it as a Turing machine.  If I'm wrong about this, please
enlighten me.

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Beauty and strength, leaping laughter and delicious
   |   languor, force and fire, are of us." - Liber AL II:20


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

Date: Wed, 14 Jun 2000 20:27:49 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: uses for PERL
Message-Id: <x7snug6m9n.fsf@home.sysarch.com>

>>>>> "CB" == Craig Berry <cberry@cinenet.net> writes:

  CB> Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote:

  CB> : Hmmm... Sed can write symbols from an alphabet to a tape (a
  CB> conceptually : infinite string).  It can use another string to
  CB> represent internal states, : and it can inspect these to decide
  CB> where to write what next.  I tentatively : propose that sed *is*
  CB> Turing-complete.

  CB> The sticking point here in my analysis of this question is whether
  CB> sed can read back the results of its writes; I don't believe it
  CB> can do so.  This disqualifies it as a Turing machine.  If I'm
  CB> wrong about this, please enlighten me.

sed has a test and a branch command and the ability to read/write/modify
its pattern space. that space is limited i would guess but the solaris
docs say this:

	The pattern and hold spaces will each be able to hold at least
	8192 bytes.

i don't think it can read back what it has written to the file so it
can't use that for the tape memory.

so i doubt it is turing complete but who knows what some evil genius
could do with it

what does our resident moronzilla have to say about this?

:-)

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Wed, 14 Jun 2000 17:07:32 -0400
From: "Edward Waldspurger" <ewald@electronicfrontiers.com>
Subject: Using a hash with popup_menu
Message-Id: <8i8sau$m8m$1@triox.mtcibs.com>

I am trying to create a popup_menu using CGI.pm.  I am having trouble
getting the labels created from a hash.

Here is the code:
----------------------------------------------------------------------
#!/usr/bin/perl5 -w

use CGI ':standard';

my %hash = ('value 1','label 1','value 2','label 2','value 3','label 3');
my @array = ('value 1','value 2','value 3');


print "Content-type: text/html\n\n";

my $menu = new CGI;
print $menu->popup_menu(-name=>'selection_name',
                 -values=>\@array,
                 -lables=>\%hash);

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

Here is the output:

<SELECT NAME="selection_name" LABLES="HASH(0x80a5b9c)">
<OPTION  VALUE="value 1">value 1
<OPTION  VALUE="value 2">value 2
<OPTION  VALUE="value 3">value 3
</SELECT>

Where am I going wrong?
--
Edward Waldspurger
Electronic Frontiers Consulting, Inc.




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

Date: Wed, 14 Jun 2000 17:15:17 GMT
From: joakim@varia.nu
Subject: Very strange DBI:mysql-problem!
Message-Id: <8i8eij$5h6$1@nnrp1.deja.com>

I have a very peculiar problem regarding a DBI:mysql database
connection. I have built a database for recipes and made a Perl script
to feed information to the database. I use a connection-table
(Recipeingredient) in my MySQL database to connect the IDs for my
ingredients with the IDs for my recipes, thus making the recipe
database searchable and reducing redundancy. I have submitted a
simplified version of my script in this posting which, instead of using
a form and the CGI module, has the ingredients and recipeID already
coded into the script (@ingredients and $recipeid). My script executes
a SELECT-statement in the Ingredient table to get the names and IDs for
existing ingredients and then compares them to the list of ingredients
the user typed (here coded in @ingredients). This comparison is made
with a REGEXP and creates a hash (€ingredienthash) with the ingredients
that matched as keys and the value "1" for every key. I later iterate
the hash and perform INSERTS into the connection-table
(Recipeingredient) for each key (ingredientID) in the hash.

This is what the simplified script looks like:
####################################
#!/usr/bin/perl
use DBI;

my $dsn = "DBI:mysql:database_name";
my $username = "username";
my $password = "password";
my %attr = ( printError => 1,
			RaiseError => 1
			);

$dbh = DBI->connect($dsn, $anvnamn, $losenord, \%attr) || die "Could
not connect to database: ", DBI->errstr, "\n";

my $recipeid = "5";
my $select_ingredient = "SELECT ingredientid, ingredientname FROM
Ingredient";

$sth = $dbh->prepare($select_ingredient) || die "Could not prepare
statement: ", DBI->errstr, "\n";
$sth->execute();

@ingredients = qw (onion cheese garlic goatcheese carrot);

while (($ingredientid, $ingredientname) = $sth->fetchrow_array) {
	foreach $ingredient (@ingredients) {
	if ($ingredient =~ /$ingredientname/ig) {
		$ingredienthash{$ingredientid} = 1;
		}
	}
}

foreach $key (keys %ingredienthash) {
	$dbh->do("INSERT INTO Recipeingredient (recipeid, ingredientid)
VALUES ($recipeid, $key)");
}

print "Done!\n";
################################

THE PROBLEM:
Because I use a REGEXP I expect the user input "goatcheese" to match
both "goatcheese" and "cheese" from the Ingredient table BUT I only get
a match for "cheese" and not for "goatcheese". It would probably be a
simple problem if it stopped here you think, but I have tried and tried
to solve it without result. Then I found out that if I change the order
of the ingredients in the Ingredient table, putting "cheese"
and "goatcheese" apart from each othet, it works exactly as I want to!
And I have tried with different ingredients in different places in the
table and it seems that it is only a problem if one ingredient before
or after "x" in its name contains "x" (cheese, goatcheese; berry,
blueberry etc)! WHY is this so?! I am puzzled! Please let me know if I
have missed something obvious (or not so obvious...). Or is this a bug
of some kind??

This is what my MySQL-tables look like:

CREATE TABLE Ingredient (
  ingredientid int NOT NULL PRIMARY KEY auto_increment,
  ingredientname char(24) NOT NULL
);

CREATE TABLE Recipeingredient (
	recipeid int NOT NULL,
	ingredientid int NOT NULL
);

INSERT INTO Ingredient (ingredientame) VALUES ('onion');
INSERT INTO Ingredient (ingredientame) VALUES ('garlic');
INSERT INTO Ingredient (ingredientame) VALUES ('cheese');
INSERT INTO Ingredient (ingredientame) VALUES ('goatcheese');
INSERT INTO Ingredient (ingredientame) VALUES ('carrot');

Try switching places between "goatcheese" and "carrot" -- suddenly it
works!!



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


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

Date: Wed, 14 Jun 2000 15:17:33 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: works without strict but not with why ????
Message-Id: <39475caa.187254962@news.nikoma.de>

On Wed, 14 Jun 2000 09:00:54 GMT, "Daniel van den Oord"
<danielxx@bart.nl> wrote:

> use strict;
> 
> my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$dst,@months);

Delete $wday, $yday, $dst (you don't use them), and add $date2 and
$timestamp.

> @months =
> ("January","February","March","April","May","June","July","August","Septembe
> r","October","November","December");

I'd use qw for this:

@months = qw(January February March April May June
             July August September October November December);

> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$dst) =
> localtime(time()-1*3600);

Not sure why you subtract 3600 from time() -- don't you want the current
local time? But OK.

($sec, $min, $hour, $mday, $mon, $year) = localtime(time() - 1*3600);

You can leave off variables at the end in list assignment.

> $mon = $mon + 1;
> if ($hour < 10)           {$hour = '0'.$hour;  }
> if ($min  < 10)           {$min  = '0'.$min;   }
> if ($sec  < 10)           {$sec  = '0'.$sec;   }
> if ($mon  < 10)           {$mon  = '0'.$mon;   }
> if ($mday < 10)           {$mday = '0'.$mday;  }
> $year += 1900;

Replace this bit with:

$mon = $mon + 1; # or $mon++; or $mon += 1;
$year += 1900
for($hour, $min, $sec, $mon, $mday) {
    $_ = sprintf("%.2d", $_);
}

The rest seems OK.

> errors with strict are
> Global symbol "$date2" requires explicit package name at
> C:\InetPub\cgi-bin\servertest.pl line 13.

So either write $::date2 or $main::date2, or add $date2 to the my(...)
declaration to make it a lexical variable instead of a global one. The
latter is preferred.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.


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

Date: Wed, 14 Jun 2000 23:57:56 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: works without strict but not with why ????
Message-Id: <ahvfkscdd66vm0ettibubjnivlukmse70r@4ax.com>

On Wed, 14 Jun 2000 09:00:54 GMT, "Daniel van den Oord"
<danielxx@bart.nl> wrote:

Hi,
Your question has been answered, but there's a bug in there :-(

> use strict;
> 
> my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$dst,@months);
> @months =
> ("January","February","March","April","May","June","July","August","Septembe
> r","October","November","December");
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$dst) =
> localtime(time()-1*3600);
> $mon = $mon + 1;
 ...
> $timestamp = "$months[$mon] $mday, $year $hour:$min:$sec";
                        ^^^^
That's a bug.
	$timestamp = "$months[$mon - 1] $mday, $year $hour:$min:$sec";

Array indeces are zero based (by default).

-- 
Good luck,
Abe


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

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


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