[10604] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4196 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 11 09:07:12 1998

Date: Wed, 11 Nov 98 06:00:23 -0800
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, 11 Nov 1998     Volume: 8 Number: 4196

Today's topics:
        & for subroutines   Was:Re: Perl "Newbie" Needs Help De <bradw@newbridge.com>
        64-bit Perl? <berend@istanbul.engr.sgi.com>
    Re: 64-bit Perl? <zenin@bawdycaste.org>
        <<My Sort Problem>> dccobb@yahoo.com
    Re: attaching a jpeg <gary.ennis@strath.ac.uk>
    Re: attaching a jpeg (Sam Holden)
        continuation of backquoted lines  (123) (Nick Halloway)
        DIE or Similar <adam@2kmedia.co.uk>
    Re: Difficulty with PERL <perlguy@technologist.com>
        e-mail petra_danielsson@my-dejanews.com
    Re: e-mail (M.)
    Re: e-mail RoyStephan@yahoo.com
        help:counting the number of occurences of a specified s (bjjgann)
    Re: I want my perl program to return a specific number <tonylabb@infonline.net>
        info on files meehanc@my-dejanews.com
    Re: Is there a compiler for Perl? <greg@silverspin.net>
    Re: Is there a compiler for Perl? <rbank@csf.edu>
    Re: Is there a compiler for Perl? <tchrist@mox.perl.com>
    Re: Learning Perl by video <ckc@dmi.dk>
    Re: Net::FTP Help me please. RoyStephan@yahoo.com
    Re: New to perl - How do I run a script and view result <harrisp2@cf.ac.uk>
    Re: Newbie question, uppercase a string.. <rbank@csf.edu>
        operation code for "flock" under HP-UX ronald_f@my-dejanews.com
    Re: Perl and Btrieve Support (Jeffrey R. Drumm)
    Re: PERL CGI on an ordinary file server? <perlguy@technologist.com>
    Re: PERL is TOO flexible <ajohnson@gatewest.net>
        please respond <fdm@internethomeschool.com>
        Problem: alternately reading 2+ files in PERL <joeyychen@geocities.com>
    Re: Problem: alternately reading 2+ files in PERL (Sam Holden)
    Re: Problem: alternately reading 2+ files in PERL <zenin@bawdycaste.org>
    Re: Resource for activescpiting in perl <msergeant@ndirect.co.uk_NOSPAM>
    Re: some help with a script . . (Bradley K. Farrell)
    Re: unable to write to MS access database...HELP <perlguy@technologist.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 11 Nov 1998 08:10:37 -0500
From: bj <bradw@newbridge.com>
Subject: & for subroutines   Was:Re: Perl "Newbie" Needs Help Debugging Code
Message-Id: <op1sofqtlwy.fsf_-_@ca.newbridge.com>

eln@cyberhighway.net (Erik) writes:

[in  commenting on someone's code ]

> On a side note, calling a subroutine like this with the & character is not necessary,
> and (i think) deprecated.  Call it like a normal function.  Use () if you're
> a past C programmer and calling functions without an argument set makes you
> feel dirty.

Anyone care to expand on this. I tend to call my own subs using &, so
that they are easily distiguishable from "normal functions". 

Straight out of the blue camel, page 114, bottom paragraph:

"The official name of a subroutine includes the & prefix. A subroutine
may be called using the prefix, but the & is usually optional, and so
are the parentheses if the subroutine has been predeclared."

It goes on to note the cases when the & is required. While the & is
optional in most cases, I do not get the sense that it is deprecated.

bj


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

Date: Wed, 11 Nov 98 00:07:45 PST
From: "Berend Ozceri" <berend@istanbul.engr.sgi.com>
Subject: 64-bit Perl?
Message-Id: <72bgkh$85kvo@fido.engr.sgi.com>

What's the status of Perl having native support for 64-bit integers (i.e. the 
built-in integer type has 64-bit storage)?

Thanks.

Berend



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

Date: 11 Nov 1998 09:26:46 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: 64-bit Perl?
Message-Id: <910776466.364784@thrush.omix.com>

Berend Ozceri <berend@istanbul.engr.sgi.com> wrote:
: What's the status of Perl having native support for 64-bit integers (i.e. the 
: built-in integer type has 64-bit storage)?

	I thought it was already there on 64bit machines?

	If you need really big ints, Math::BigInt may be for you.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Wed, 11 Nov 1998 12:25:05 GMT
From: dccobb@yahoo.com
Subject: <<My Sort Problem>>
Message-Id: <72bvn1$g6o$1@nnrp1.dejanews.com>

Hello all,

I have the following problem:

I have a list as shown below, I need to sort the list on the first column in
alphabetical order.  The list is currently in a file and would have to stuffed
into an array.  Is there any sort techniques I could use in Perl, e.g. Sort,
incorporating a bubble sort technique?

SJR-01 MR. F
TCC-03 MR. G
FFF-04 MR. J
GHT-09 MR. X
DCC-34 MR. Z
SJR-01 MR. T

Thanks
--
"Everything should be as simple as possible, but no simpler",
Albert Einstein.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 11 Nov 1998 09:00:12 +0000
From: Gareth Ennis <gary.ennis@strath.ac.uk>
To: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: attaching a jpeg
Message-Id: <3649521C.41C6@strath.ac.uk>

Randal Schwartz wrote:

> No.  bad code.  No.  please delete.
> 
> What if $recip_email is  "fred&barney@stonehenge.com", which is a
> legitimate address, or "fred & rm -rf /", which is broken but cannot
> easily be distinguished from legitimate addresses without an
> 1800-character regular expression.
> 
> NEVER pass email addresses to a shell.
> 
> NEVER pass email addresses to a shell.
> 


Surely if i validate  $recip_email so that it cannot contain a " " or a
"/" then nobody can cause any damage...???

Please advise.
-- 
Gareth Ennis
ABACUS - Strathclyde University 
email: gary.ennis@strath.ac.uk
http://iris.abacus.strath.ac.uk/new/


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

Date: 11 Nov 1998 09:15:55 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: attaching a jpeg
Message-Id: <slrn74ileb.gc3.sholden@pgrad.cs.usyd.edu.au>

On Wed, 11 Nov 1998 09:00:12 +0000, Gareth Ennis <gary.ennis@strath.ac.uk>
	wrote:
>Randal Schwartz wrote:
>
>> No.  bad code.  No.  please delete.
>> 
>> What if $recip_email is  "fred&barney@stonehenge.com", which is a
>> legitimate address, or "fred & rm -rf /", which is broken but cannot
>> easily be distinguished from legitimate addresses without an
>> 1800-character regular expression.
>
>Surely if i validate  $recip_email so that it cannot contain a " " or a
>"/" then nobody can cause any damage...???

If you like the idea of letting people run programs on your computer without
permission...

-- 
Sam

PC's are backwards ... throw them out! Linux is ok though.
	--Rob Pike (on the subject of CR/LF etc)
Sam


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

Date: 11 Nov 1998 10:20:19 GMT
From: snowe@rain.org (Nick Halloway)
Subject: continuation of backquoted lines  (123)
Message-Id: <72bod3$2vc$1@news.rain.org>

How do you put a backquoted expresson on several lines?  

$Con = `echo '$Subject' | egrep -i '^ *cmsg +cancel +<.+>.*$' |sed 's/a/b/'`;

doesn't give the same answer as

$Con = `echo '$Subject' | egrep -i '^ *cmsg +cancel +<.+>.*$'
 |sed 's/a/b/'`;

and 

$Con = `echo '$Subject' | egrep -i '^ *cmsg +cancel +<.+>.*$'` .
 `|sed 's/a/b/'`;

gives an error message.  Thanks.


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

Date: Wed, 11 Nov 1998 12:10:24 -0000
From: "Adam Carden" <adam@2kmedia.co.uk>
Subject: DIE or Similar
Message-Id: <910786404.1084.0.nnrp-11.c2de97e4@news.demon.co.uk>

I have created a set of subroutines which are strore in the file security.pl
and then called when needed.

One of the subroutines needs to kill the entire process with no futher
messages (it outputs an error page first) I have tried die but this still
lets the child process continue.

I need to shut the security script and the calling script with no further
messages. Is their an easy way to do this?

Replies by e-mail would be great but I will check back later.

Thanks
Adam Carden
2K Media
http://www.2kmedia.co.uk




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

Date: Wed, 11 Nov 1998 13:12:53 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: Difficulty with PERL
Message-Id: <36498D55.E15CF4CB@technologist.com>

please don't post the same question multiple times with different
titles.

-- 
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$            Brent Michalski             $
$         -- Perl Evangelist --          $
$    E-Mail: perlguy@technologist.com    $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


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

Date: Wed, 11 Nov 1998 08:13:33 GMT
From: petra_danielsson@my-dejanews.com
Subject: e-mail
Message-Id: <72bgvd$4c7$1@nnrp1.dejanews.com>

Hello!

I'm using Perl on NT 4 and I have a problem with mailing from Perl. I wrote:
open(MAIL, "|mail me\@myserver.com");
Is this code only for UNIX users. Can anyone please tell me how I should write
for NT. I'm using Outlook mailprogram.

Thank you very much!!!

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 11 Nov 1998 10:36:35 GMT
From: pub @ alma . ch (M.)
Subject: Re: e-mail
Message-Id: <364967d8.93121248@news.urbanet.ch>

Have a look at http://alma.ch/perl/mail.htm

There's the docs for Mail::Sendmail, which is a very easy Perl only
platform independent  module. 

At the bottom of that page, you will find links to other mail modules
and command-line mailers like Mal::Sender and Net::SMTP.

>Hello!
>
>I'm using Perl on NT 4 and I have a problem with mailing from Perl. I wrote:
>open(MAIL, "|mail me\@myserver.com");
>Is this code only for UNIX users. Can anyone please tell me how I should write
>for NT. I'm using Outlook mailprogram.



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

Date: Wed, 11 Nov 1998 13:18:35 GMT
From: RoyStephan@yahoo.com
Subject: Re: e-mail
Message-Id: <36498d6e.50996312@news.esinet.net>

On Wed, 11 Nov 1998 08:13:33 GMT, petra_danielsson@my-dejanews.com
wrote:

>Hello!
>
>I'm using Perl on NT 4 and I have a problem with mailing from Perl. I wrote:
>open(MAIL, "|mail me\@myserver.com");
>Is this code only for UNIX users. Can anyone please tell me how I should write
>for NT. I'm using Outlook mailprogram.
>

Ouch, don't ever try to interface with Outlook.  IThere are ways to do
it with IMAPI(sp?)  protocols but it is very buggy right now.  I
suspect that Microsoft will get it right when they release a third
patch for the fledgling interface.


The previous advice of going with Sendmail is a good idea.  We had
some problems installing sendmail on NT here.  We have found that Blat
(a simple exe mail program that you can easily shell out of perl to)
works like a charm.

This is a comparison between sendmail and Blat


This is the Balt Home Page (now in release 1.8.0):
http://gepasi.dbs.aber.ac.uk/softw/Blat.html


>Thank you very much!!!

your welcome!
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

Roy Stephan
RoyStephan@yahoo.com
Internet Analyst 
SNL Securities



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

Date: Wed, 11 Nov 1998 10:46:22 GMT
From: bjjgann@liv.ac.uk (bjjgann)
Subject: help:counting the number of occurences of a specified string in a file
Message-Id: <F2979A.616@liverpool.ac.uk>

I am trying to count the number of times a string appears
in a given file.

So far I have managed to count the number of occurences on a particular line,
the number of the line where the string occurs, and just about any other 
combination you care to imagine, except for the result I want.

Is this an easy 3 liner, which am just missing or is it more complex.
Any advice would be appreciated.

B Gannon



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

Date: Wed, 11 Nov 1998 08:47:54 -0500
From: Tony Labbiento <tonylabb@infonline.net>
Subject: Re: I want my perl program to return a specific number
Message-Id: <3649958A.B8245709@infonline.net>

It seems to me that you should just be able to use the exit command in
foo.pl (i.e. exit 1;)

luong@my-dejanews.com wrote:
> 
> Hi all,
> 
> I'm sorry in advance if my question sounds stupid. Just wonder if I can set
> the numeric return code of my perl program to a specific value.
> 
> For example: ...  $return = system ("foo.pl");  if ($return > 12) {  ## do
> something  } .... in which $return is a number calculated by the foo.pl, not
> the status of running it. I think I can do it by reset some predefined
> variable in foo.pl but I don't know how to. Any glue? Thanks, Luong
> 
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

-- 
			****************************************
			*    Tony Labbiento                    *
			*    Infinity Online, Inc.             *
			****************************************


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

Date: Wed, 11 Nov 1998 11:08:30 GMT
From: meehanc@my-dejanews.com
Subject: info on files
Message-Id: <72br7e$cnp$1@nnrp1.dejanews.com>

Hi,
	I was wondering if there`s a way to display just the file
        attributes of a list of files in Perl. for example, run a
	perl script passing it a list of files, and perl would then
	print out  <filename> has the following permissions -rwx---r-x
    	or whatever is relevant. I thought it could be done with stat
	and mode but mode only returns the numeric version of permissions,
	at least that was my understanding of it. I`ve included the script
	for what it`s worth, any help would be really appreciated.
	Secondly is there a mailing list version of this group, I know
	there`s a Win32 mailing list for general questions but all the
	UNIX perl mailing lists seem to focus on Perl specifics,
	tk, www, cgi etc. again thanks in advance.
cathal
<cathal.meehan@tecnomen.ie>

#! /usr/bin/perl -w
use File::stat;
while (<>)
{
 chomp; # eliminate the newline
 $file_perm =  stat($_) -> mode;
 print "$_ has the following permissions $file_perm\n";
 print "$_ does not exist\n" unless -e;
}

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 11 Nov 1998 01:40:10 -0800
From: Greg Webster <greg@silverspin.net>
Subject: Re: Is there a compiler for Perl?
Message-Id: <36495B7A.FA4D9BC2@silverspin.net>

Yep, I haven't tried it, but it's called Perl2exe. Search for that on
the web and you'll find it pretty quick.

Peter wrote:

> Is there a compiler for Perl?
>
> If not, does anyone know a similar language where I can convert Perl
> to a compiled self contained .exe?
>
> Peter



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

Date: Tue, 10 Nov 1998 21:00:47 -0700
From: "Robin Bank" <rbank@csf.edu>
Subject: Re: Is there a compiler for Perl?
Message-Id: <36490df7.0@news.globalpac.com>

man perlfaq


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

Date: 11 Nov 1998 13:44:21 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Is there a compiler for Perl?
Message-Id: <72c4bl$apj$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Greg Webster <greg@silverspin.net> writes:
:> Is there a compiler for Perl?
:Yep, I haven't tried it, but it's called Perl2exe. Search for that on
:the web and you'll find it pretty quick.

THAT IS NOT A COMPILER.  

Please stop FUD spreading, whether you are the instigator or the victim.

--tom
-- 
There's no such thing as a simple cache bug. --Rob Pike


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

Date: Wed, 11 Nov 1998 13:11:24 +0100
From: Casper Kvan Clausen <ckc@dmi.dk>
Subject: Re: Learning Perl by video
Message-Id: <Pine.GSO.3.92.981111130450.25513I-100000@edb>

On 10 Nov 1998 scott@softbase.com wrote:

> whom one sense does not dominate. But by and large, a significant
> number of people would be of an orientation that would make learning
> from a video preferable to anything else.  Therefore, a Perl video
> would seriously fulfill a serious need.

Well, I guess my mode of learning is just so different as to make it
impossible for me to see how this could be helpful. BTW, I usually learn
by reading a book through once - anad only the bits I find interesting -
and then diving right in and trying out what I learned. After a while I'll
then return and read the entire book to pick up the nuances. Would that be
called kinesthetic? I do prefer to read books over looking at a screen,
but only because reading from a screen physically strains my eyes. I thus
have to look away more often, which means I can read a book faster. And I
prefer looking at and trying out things myself, rather than having them
shown to me.

Interesting, anyway, that the differences in how people learn are so
extreme.

Kvan, learning something new every day.

-------Casper Kvan Clausen------ | 'A *person* is smart. People are
----------<ckc@dmi.dk>---------- |  dumb, panicky, dangerous animals
           Lokal  544            |  and you know it.'
I do not speak for DMI, just me. |        - "K" in Men in Black.



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

Date: Wed, 11 Nov 1998 13:07:04 GMT
From: RoyStephan@yahoo.com
Subject: Re: Net::FTP Help me please.
Message-Id: <36498974.49978140@news.esinet.net>

On Wed, 11 Nov 1998 03:18:57 GMT, "sethnjen" <sethnjen@megahertz.net>
wrote:

>I am a perl beginner and I am trying to use get and/or getstore to get a
>file through ftp:
>
>getstore('ftp://some.site/some.file', 'some.file');
>
>If i use http this works, yet using ftp gives many headaches.  The first
>thing I figured out is that I don't have Net::FTP but I got it.  Then the
>files for Net::FTP contained compiler errors!  I fixed, I believe, all of
>them but I still cant retrieve files over ftp...if i try to get the
>directory listing (ftp://some.site) it gives me a html back that would
>represent that but if i want a file (ftp://some.site/some.file) it returns
>ftp error 500.

What System are you using?  I ran into some of these problems a few
months back on NT.  You just need to manuallyupdate the Config file.
It is pretty self explanatory, once you find it.
>
>I also tried a little with using the ua object oriented approach but it
>resulted in the same errors.  I was not sure what to use as an object so I
>used the HTTP::Request, the same as if i wanted an html page.
>

This is something that could be caused by a proxy server.  My company
was using (MS?) Proxy Client 1.  There is NO ability to FTP with this
proxy client.  Proxy Client 2 fixes *some* of the FTP problems.  

--Interestingly Proxy 1 also kills the (libwww) user agent after one
http page retrieval.  Again, Proxy 2 solved this error.

>All I want to be able to do is retrieve a plain text file through a ftp
>command.
>
>Please email me if you can provide help, thanks a lot.
>
>

I would suggest the following (assuming you are running on a windows
platform with some sort of firewall/proxy server configuration) ---

Go to your web server or FTP server or something that is OUTSIDE your
network and try to run it there.  At least use one of these machines
to get your example scripts running and an idea how to deal with the
Net::FTP config file.  Then discuss the benefits of upgrading you to a
better proxy client.  Setting up a fixed IP for your computer (and
taking it off of proxy client) will also provide good results.

--Roy Stephan
RoyStephan@yahoo.com
Internet Analyst
SNL Securities




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

Date: Wed, 11 Nov 1998 10:19:10 -0000
From: "Phil Harris" <harrisp2@cf.ac.uk>
Subject: Re: New to perl - How do I run a script and view results offline?
Message-Id: <36497254.0@d032>

Probably easiest to install a web-server such as Apache, MS-PWS,  It's easy
to do and can be a life saver.

It would mean that you could set up your site locally and then 'publish' it
to your main server when needed.

Try www.apache.org
or www.eu.microsoft.com/iis

HTH

Phil
Lorick <ce492@torfree.net> wrote in message
news:72bdcq$lt6$1@news.bconnex.net...
>I just started using Perl yesterday and don't know anything otherwise about
CGI
>type things, but I've found a need to write some things in Perl to put on a
>web page like a guest book or something else that reads/writes data, and I
have
>found lots of sample code to do this, but my question Is:
>
>I am running win 95/dos on my desktop machine and I am wondering how I can
>run a PERL script at home locally to see how it works before uploading it
to
>my provider, because they don't have open CGI access.  I'd have to
re-submit
>the script for security checking by system admin before it would be able to
>run...so how can I run it at home to see how it runs?
>I installed a dos port that I obtained from www.perl.com and I can run a
script
>into it on the commandline and it executes as if there has been no data
entered
>on the web page (obviously) and it spits out the error message, but can I
>simulate an online connection with the html files calling the perl script
>somehow to check operation and read/write file access?
>




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

Date: Tue, 10 Nov 1998 21:04:55 -0700
From: "Robin Bank" <rbank@csf.edu>
Subject: Re: Newbie question, uppercase a string..
Message-Id: <36490df9.0@news.globalpac.com>

$test = "\UHi ThErE"   assigns     $test = "HI THERE" 

\U converts all the next characters to uppercase...

Later,
Robin
******|
------| rbank@csf.edu
******|


----------
In article <3648B7EB.93E57D00@sprintmail.com>, Chris Duerr
<cdduerr@sprintmail.com> wrote:


>
>Hi, Im sort of new to Perl and Im writing a small CGI script that will
>require a variable to be changed to uppercase.  Can anyone please help?
>
>I basically need this
>
>$test = "hi there"
>
>to be turned into
>
>$test = "HI THERE"
>
>Should I be using regular expressions? Is there a string functin to
>accomplish this? I've looked through my book (Learning Perl) and I cant
>seem to find it, I've also skimmed through "man perlfunc" and still
>nothing...
>
>
>Thanks,
>
>Chris
>__cdduerr@sprintmail.com__
>
>


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

Date: Wed, 11 Nov 1998 09:42:08 GMT
From: ronald_f@my-dejanews.com
Subject: operation code for "flock" under HP-UX
Message-Id: <72bm5g$91u$1@nnrp1.dejanews.com>

I have a question regarding file locking/unlocking: When I follow the advise
in the Camel book, i.e.  flock HANDLE,2; # lock file  flock HANDLE,8; #
unlock file everything works fine (and indeed this is how the example
programs are implemented in Randal Schwartz' page 
http://www.stonehenge.com/merlyn/WebTechniques/

Wondering why those operation codes (2 and 8) have to be hard coded - is this
portable at all? - I looked for a different way to do this.

The camel book suggests looking at the man page for flock(2). Alas, HP-UX
10.01 has no man page for this, and the include files coming with HP-UX C
have neither flock.h nor sys/flock.h.

Next, I tried to use Perl's Fcntl module:

   use Fcntl;
   flock HANDLE,LOCK_SH; # LOCK_SH exported by Fcntl
   flock HANDLE,LOCK_UN;

This does not work ("LOCK_SH not numeric") - no surprise, since sys/fcntl.h
does not define those constants and Fcntl can only pull out from fcntl.h
what is already in it. But sys/fcntl.h has the following definitions:

   /* Values for l_type used for record locking with fcntl() */
   #  define F_RDLCK 01
   #  define F_WRLCK 02
   #  define F_UNLCK 03

but using these does not work either:
   use Fcntl;
   flock HANDLE,F_WRLCK; # locks, since F_WRLCK happens to be 2, but ...
   flock HANDLE,F_UNLCK; # does not unlock, since F_UNLCK not equals 8

I would like to know if someone knows a better way to write the flock call
than to use hard coded constants.
--
Ronald Fischer <ronald_f@my-dejanews.com>
http://ourworld.compuserve.com/homepages/ronald_fischer/

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 11 Nov 1998 12:55:44 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Perl and Btrieve Support
Message-Id: <364987e3.153331388@news.mmc.org>

[ posted to comp.lang.perl.misc and a courtesy copy was mailed to the cited
author ]

On Tue, 10 Nov 1998 17:19:38 -0800, Lee Rouman <lrouman@definity.com> wrote:

[ rewrapped because of Lee's improperly configured news reader ]

>Anyone completed (or working on) a database interface for Btrieve?  I don't see one 
>on http://reference.perl.com/query.cgi?database but I'm hopeful that this is a 
>problem that has already been solved.
>
>Lee Rouman

If you've got ODBC drivers for Btrieve, you can use Win32::ODBC or the DBI/DBD
ODBC module. See CPAN at www.perl.com.

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: Wed, 11 Nov 1998 13:11:27 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: PERL CGI on an ordinary file server?
Message-Id: <36498CFF.4CFF688A@technologist.com>

You cannot call a CGI script from a web browser and just "expect" the
server to know what to do with it, it just doesn't work that way.

You seem to have access to the whole system so why not load a web
server?  There are several *free* ones out there for NT,
http://www.apache.org has one.

Once you get the web server up and properly configured to handle CGI
scripts, (instructions will be in the documentation),  THEN come back
and ask question(s) about why they aren't working.

With your current configuration, the __only__ way you are going to run
Perl programs is via the command line...

Good luck!
Brent

-- 
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$            Brent Michalski             $
$         -- Perl Evangelist --          $
$    E-Mail: perlguy@technologist.com    $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


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

Date: Wed, 11 Nov 1998 02:45:34 -0600
From: Andrew Johnson <ajohnson@gatewest.net>
Subject: Re: PERL is TOO flexible
Message-Id: <36494EAE.32AB69BE@gatewest.net>

Jay Rogers wrote:
> 
> amw@world.std.com (Anita M Wilcox) writes:
[snip]
> >
> > This isn't a language problem, it is a programmer problem.  You can
> > write ugly, unmaintainable code in *any* language.
> 
> If the ability to write maintainable code is *only* a function of the
> programmer and not the language then according to that logic, assembly
> language is just as easy to maintain as perl.

yes.

Well, for a given assembly language, one can write code that's easier
or more difficult to maintain ... for an assembly programmer in that
assembly language! Readablility is not language independent!
 
I don't know why people always insist on programs being readable by
those who don't know, or are new to, the given language --- sure, its
a mark of readability if a programmer unfamiliar with language X can
read language X to some degree ... but, come on, language X was
designed to be read by language X programmers---people who have
learned at least something about language X. I'm sure German is
perfectly readable to those who know German, but is it more or
less readable than English?

Python is easy to read for python programmers. Perl is easy to read
for perl programmers...tcl, BASIC, Pascal, C ... same thing. Granted,
some are also more readable by programmers experienced in different
languages---But, that's not a remark about readability, that's a
remark about similarity. Is all BASIC code readable for all BASIC
programmers?, Is all Python code readable by all python coders --- is
all Perl code readable by all perl programmers?

The answer to all of the above is simply, no!

Programmers in a given language can write code that is 'less than
readable' for others using the same language --- heck, not all
English writings are readable by English speakers/writers. A language
is demonstrably readable (understandable) by all its conversants only
when there is exactly one way of "meaning" something...even languages that
try to be as orthogonal as possible lack this "only one way to mean
one thing" quality. The important wording here is 'one way to "mean"
one thing', not, 'one way to "say" one thing'.

Readability is a lofty goal, and one worth attempting when
programming in any language, but any kind of absolute readability is
a chimera in language design.  As soon as you design a language
powerful enough for people to express themselves in, they'll begin to
express themselves in unanticipated ways.  Readability is contextual.
A physicist may write a paper (in English) that is only really
readable by others in the field (hey, look in any scientific
journal)...but the fact that some readers may not understand it does
not mean that English is less readable than any other language the
scientist might have chosen to express himself in.

regards
andrew


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

Date: Wed, 11 Nov 1998 05:50:51 -0800
From: "Happy Joe" <fdm@internethomeschool.com>
Subject: please respond
Message-Id: <72c4pd$sfn$1@supernews.com>

test

--
fdm@internethomeschool.com
moody@internethomeschool.com
ihs@internethomeschool.com




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

Date: Tue, 10 Nov 1998 23:56:28 -0800
From: Joey Chen <joeyychen@geocities.com>
Subject: Problem: alternately reading 2+ files in PERL
Message-Id: <3649432C.FC85431A@geocities.com>

Hi,

How do I go about opening 2 files, and read one line from them
alternately:

condition1:
  read from file1
condition2:
  read from file2

The while(<>) construct seems to only be able to read one file
at at time.  Any help would be greatly appreciated.  Thanks.

Joey



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

Date: 11 Nov 1998 08:39:29 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Problem: alternately reading 2+ files in PERL
Message-Id: <slrn74ija1.fvu.sholden@pgrad.cs.usyd.edu.au>

On Tue, 10 Nov 1998 23:56:28 -0800, Joey Chen <joeyychen@geocities.com> wrote:
>Hi,
>
>How do I go about opening 2 files, and read one line from them
>alternately:
>
>condition1:
>  read from file1
>condition2:
>  read from file2
>
>The while(<>) construct seems to only be able to read one file
>at at time.  Any help would be greatly appreciated.  Thanks.

Read the manual.. you know perlop and perlfunc... The bits that tell
you how to open files... close files... read from files...

-- 
Sam

Basically, avoid comments. If your code needs a comment to be
understood, it would be better to rewrite it so it's easier to
understand.	--Rob Pike
Sam



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

Date: 11 Nov 98 09:26:42 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Problem: alternately reading 2+ files in PERL
Message-Id: <910776771.313341@thrush.omix.com>

Joey Chen <joeyychen@geocities.com> wrote:
: How do I go about opening 2 files, and read one line from them
: alternately:

	perldoc -f open
	perldoc -f readline
	perldoc perlsyn

: The while(<>) construct seems to only be able to read one file
: at at time.  Any help would be greatly appreciated.  Thanks.

	while(<>) is a shortcut for common operations.  Your operation
	isn't common, so you have to do it "long hand".  See the references
	above for details.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Wed, 11 Nov 1998 09:35:14 +0000
From: Matt Sergeant <msergeant@ndirect.co.uk_NOSPAM>
Subject: Re: Resource for activescpiting in perl
Message-Id: <36495A51.682EF6D9@ndirect.co.uk_NOSPAM>

Manuel Labor wrote:
> 
> Im looking for a resource on how to use perlscript in a html file. I don't
> want to write a script, save as *.pl and then try to run from the html file.
> I want to use <scipt tags>

See the resource pages on ActiveState's web site. Note though that
PerlScript in html pages using <script> is a security risk (and only
enabled for intranet/local connections).

For ASP PerlScript, see my web site for the complete docs.

-- 
<Matt/>

| Fastnet Software Ltd              |   Perl in Active Server Pages   |
| Perl Consultancy, Web Development |   Database Design   |    XML    |
| http://come.to/fastnet            |    Information Consolidation    |


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

Date: Wed, 11 Nov 1998 08:27:43 GMT
From: bradley@iinet.net.au (Bradley K. Farrell)
Subject: Re: some help with a script . .
Message-Id: <364c4952.82709828@news.m.iinet.net.au>

1. Follow advice from Alastair and Martien
2. Have a look at Brent Michalski's great piece:
    http://webreview.com/wr/pub/98/08/14/perl/index.html
3. Be prepared to hack away on your own. It's a good way to learn.
HTH
--
Bradley K. Farrell
bradley@iinet.net.au


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

Date: Wed, 11 Nov 1998 13:22:44 GMT
From: Brent Michalski <perlguy@technologist.com>
Subject: Re: unable to write to MS access database...HELP
Message-Id: <36498FA4.8BF1B397@technologist.com>

Casema wrote:
> Now, another one:
> 
> $a = "michel";
> $b = "wouterse";
> $sql = "INSERT INTO form (lastname, firstname) VALUES ($a, $b)";
> 
> above line wants the \'   \' in the strings....is there a quick way to do
> this?

Have you tried:
 $sql = "INSERT INTO form (lastname, firstname) VALUES ('$a', '$b')";

This works for me too!

Now, if you want the ' inside the string, it causes the ODBC driver to
puke.  I haven't found an elegant solution for this yet.  I simply
replace the ' with another character and then replace it back once I
have read it in.

I just thought of something while typing this, I haven't tried it yet
but you may give it a shot:  If you need a ' inside a string, try to
replace it with two of them '', this works on SQL server so it may also
work on Access.

Also, $a and $b are used for sorting in Perl, I am not sure if it is
"bad" to use them casually in your programs, but I try to avoid using
them as variables just to be safe and prevent possible (hard to debug)
conflicts.

HTH,
Brent

-- 
Java? I've heard of it, it is what I drink when I am hacking Perl. -me
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$            Brent Michalski             $
$         -- Perl Evangelist --          $
$    E-Mail: perlguy@technologist.com    $
$ Resume: http://www.inlink.com/~perlguy $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$


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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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