[11883] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5483 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 26 07:16:52 1999

Date: Mon, 26 Apr 99 04:00:23 -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           Mon, 26 Apr 1999     Volume: 8 Number: 5483

Today's topics:
        Better implementation of the modulus function? <clint@drtech.co.uk>
    Re: Can Perl Run Local under Win 98? <nospam.newton@gmx.net>
        cgi script <zgil@cs.technion.ac.il>
    Re: cgi script <alain_chiorboli@email.sps.mot.com>
    Re: Country of a visitor (Michael Stillwell)
    Re: Country of a visitor <nospam.newton@gmx.net>
        DBI:ODBC - Problems adding, updating and deleteing reco (Neil Jedrzejewski)
    Re: Deferences in Explorer vs. Netscape? (Sitaram Chamarty)
    Re: Extracting attachments from e-mail (Linux) <evgenya@cs.huji.ac.il>
    Re: FAQ 4.31: How do I pad a string with blanks or pad  <nospam.newton@gmx.net>
    Re: FAQ 7.14: How can I pass/return a {Function, FileHa <nospam.newton@gmx.net>
    Re: FAQ 7.14: How can I pass/return a {Function, FileHa <ebohlman@netcom.com>
        Fork goddamit! Fork! ralawrence@my-dejanews.com
        Fork() for windows <engp8518@nus.edu.sg>
    Re: Free Web Hosting with CGI (Bob Trieger)
    Re: Generating a unique string for order number <nospam.newton@gmx.net>
        h2ph help please <jking2019@my-dejanews.com>
    Re: Help with Code <srg@babcom.com.au>
    Re: Help:How to find Pixel size of an uploaded image us <nospam.newton@gmx.net>
    Re: How do i print something using perl? <nospam.newton@gmx.net>
    Re: I need help!!!!! <nospam.newton@gmx.net>
    Re: Net::FTP creates Empty file <gellyfish@gellyfish.com>
    Re: Newbie regex query (David Cantrell)
    Re: Perl and ASP <matt-news@sergeant.org>
    Re: Perl operate autonomously? <Michael.Cameron@no.spam.technologist.com>
    Re: Perl operate autonomously? <carvdawg@patriot.net>
    Re: QUESTION:Perl Regular Expression Subtring Matches?  <c_graham@hinge.mistral.co.uk>
    Re: returning a hashtable from a subformula <Michael.Cameron@no.spam.technologist.com>
        serial port <alain_chiorboli@email.sps.mot.com>
        Supported data types in Oraperl (Wei Tang)
    Re: The question about debug and design <Ed@gec.nospam.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 26 Apr 1999 10:58:31 +0100
From: "Clinton Gormley" <clint@drtech.co.uk>
Subject: Better implementation of the modulus function?
Message-Id: <7g1cuv$7fc$1@taliesin.netcom.net.uk>

I have recently needed to find the answer to Large Number % 97, and this
always gave me the wrong answer - presumably because the modulus is worked
out like this :

(Number / 97 - int(number/97))*97  and with large numbers, too many decimal
points get lost and you end up with the wrong answer.

Surely, a better implementation would be :

Number  - 97*int(number/97) - then you are working purely with integers and
the result should be accurate?

Right / wrong?

Clinton Gormley





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

Date: Mon, 26 Apr 1999 12:47:43 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: Re: Can Perl Run Local under Win 98?
Message-Id: <3724444F.4D005552@gmx.net>

Jason Simms wrote:
> 
> <joeyandsherry@mindspring.com> wrote in message
> news:7g0e19$15q$1@nntp2.atl.mindspring.net...
> > Hello,
> >
> >     Thanks for your assistance:
> >
> >     I want to make a website run locally, but I use perl to do a simple
> > search, can perl be set up to operate locally, just as it does on the net?
> 
> Sure, using Personal Web Server.

ObDisagreement: "Personal Web Server doesn't run on my {Linux,*BSD,
Amiga,Mac,etc} box even though Perl does."

Perl, in general, always runs locally. It may be running locally on your
machine, or locally on your ISP's web server, but it doesn't [have to]
communicate with remote machines.

Often, Perl is used for CGI applications, in which case the CGI is
responsible for mediating between the remote computer and a Perl script.
Getting a CGI environment running on your local machine requires a Web
server of some description, such as Apache (for 'most everything) or
Sambar/PWS/IIS/Xitami (for machines running Windows). But Perl doesn't
care.

Cheers,
Philip


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

Date: Mon, 26 Apr 1999 10:16:13 +0200
From: Gil Zigelman <zgil@cs.technion.ac.il>
Subject: cgi script
Message-Id: <372420CD.B1915BC6@cs.technion.ac.il>

Hi,

I am writing a cgi script using perl.
In my script, I need to modify a file. The problem is that the script
doesn't modify the file unless I give full writing permissions to the
file, which is something I obviously to not want.

Does anyone know the correct way to do this?

Thanks,
Gil




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

Date: Mon, 26 Apr 1999 11:10:11 +0200
From: alainch <alain_chiorboli@email.sps.mot.com>
Subject: Re: cgi script
Message-Id: <37242D73.BE04D858@email.sps.mot.com>

If you are under unix you can try to set the setgid bit for your cgi
script: chmod +s cgi_script_name
Gil Zigelman wrote:

> Hi,
>
> I am writing a cgi script using perl.
> In my script, I need to modify a file. The problem is that the script
> doesn't modify the file unless I give full writing permissions to the
> file, which is something I obviously to not want.
>
> Does anyone know the correct way to do this?
>
> Thanks,
> Gil

--
_____________________________________________________________________

Alain CHIORBOLI                            MOTOROLA
_____________________________________________________________________





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

Date: 26 Apr 1999 07:52:15 GMT
From: mist@yoyo.cc.monash.edu.au (Michael Stillwell)
Subject: Re: Country of a visitor
Message-Id: <slrn7i86pf.f6i.mist@fangorn.cs.monash.edu.au>

On 26 Apr 1999 01:51:16 GMT, Abigail <abigail@fnx.com> wrote:
: selectthree (selectthree@gsig-net.qc.ca) wrote on MMLXII September
: MCMXCIII in <URL:news:37222417.3253@gsig-net.qc.ca>:
: ## Does anyone know the code to determine the origin country of a visitor
: ## (or only it's code, like .com, .ca, .uk, .fr...)?
: 
: 
: You can't.
: 
: You can of course do a 'gethostbyaddr', but there's nothing that
: prevents someone from using 'foo.bar.com', 'foo.bar.ca', 'foo.bar.uk'
: and 'foo.bar.fr' as names for the same host.
: 
: Not to mention that .com, .org and .net are everywhere. And do you 
: really thing those .to hosts domains are all located on an island?
: 
: And what are you going to do with a "visitor" from country A, that
: uses a proxy in country B?

In your opinion, what proportion of hosts misrepresent their location?
Is this proportion worth worrying about?  

It's nice to have a rough idea of where your visitors are coming from
(in the case of a web site).  What's the chance of your figures being
more than 15% wrong?  (And I think that the actual error is much less
than that.)  Sometimes, near enough is good enough, and better than no
estimate at all.  (Does your editor do syntax highlighting of perl
code?)

To the poser of the original question: you want the Locale::Country
module.

Michael

-- 
 .. ABSOLUT .SIG. ..
 .. Michael Stillwell ..
 .. mist@yoyo.cc.monash.edu.au ..
 .. http://yoyo.cc.monash.edu.au/~mist/ ..


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

Date: Mon, 26 Apr 1999 11:15:19 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: Re: Country of a visitor
Message-Id: <37242EA7.BFB03D7B@gmx.net>

Michael Stillwell wrote:
> 
> In your opinion, what proportion of hosts misrepresent their location?
> Is this proportion worth worrying about?

What do you mean, location? Most hosts don't say anything about their
location. Domains are not necessarily connected with geography. Just
because I'm in Germany doesn't mean I have to use a .de address; .com
 .org .net and even .si .to .tv etc. work just fine.

Cheers,
Philip


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

Date: Mon, 26 Apr 1999 10:58:13 GMT
From: jed@grafx.co.uk (Neil Jedrzejewski)
Subject: DBI:ODBC - Problems adding, updating and deleteing records in MS Access Database.
Message-Id: <372446bf.14708404@news.dircon.co.uk>

Hi All,

Due to a need to get our databases in running on non NT servers, I've
been tasked with the job of re-writing our ASP as Perl to run on some
Unix boxes.

We're going to use MySQL in the end, but for now, I'm using DBI:ODB to
interface with an existing MS Access database on my PC to test/debug.

So far, everything is going find with searching the database, but I'm
having problems with some more basic functions.

My MS Access database has a primary key field called ID which is an
auto-incrementing value for each record.

The Update SQL statement seems to be working and using:

$SQL = "UPDATE Test SET [Number] = 1, [Radio] = 'Alpha' WHERE [ID] =
1";

works fine and will update records as needed.

However, when I do and ADD statement with.

$SQL = "INSERT INTO Test VALUES(0, '6', 'Foxtrot')";

I hit a few snags. It works, but sets the ID field to 0 (as directed)
but what I need is it to allow the database to automatically add the
next available ID (auto-increment). Of course, executing the same
command again, causes and error as it says ID 0 is already in use.

Does anyone know how to do this or am I using the wrong SQL statment?

Lastly, I'm lost as to what the SQL is I need to use to DELETE a
value. Any pointers?

Regards

- Jed

P.S. Please CC me replies via e-mail.


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

Date: Mon, 26 Apr 1999 10:38:34 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Deferences in Explorer vs. Netscape?
Message-Id: <slrn7i6mq9.28b.sitaram@japh.unidata.com>

I have never seen any deference in either of the 2 browsers.  Even
the Linux version of netscape refuses to acknowledge that I am the
master.  I have been trying for 2 years now, so I ought to know.

Just like kids, pets, and so on.

<sigh>


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

Date: Mon, 26 Apr 1999 11:56:44 +0300
From: Evgenya Borisenko <evgenya@cs.huji.ac.il>
To: Mats Pettersson <mats.pettersson@falukuriren.se>
Subject: Re: Extracting attachments from e-mail (Linux)
Message-Id: <Pine.BSI.4.05L.9904261151410.15497-100000@narn.cs.huji.ac.il>

Hi,

I don't know of any modules but I programmed something similar in C once.
All of your mail messages are kept in /var/spool/mail, you can read this
file - it's in ASCII format. All mail messages are devided by special set
of headers, same are the attachements for each message. Take a look at
the following MIME description page, http://www.hunnysoft.com/mime/, and
you'll have all the headers. After you devide the message or the
attachement you can decode it by uudecode for example. For a start, take a
look at your mail file.

Bye
----------
Evgenya Borisenko
CS System Group 
Hebrew University, Jerusalem, Israel

On Mon, 26 Apr 1999, Mats Pettersson wrote:

>Hi!
>
>Are there any modules or similar that can handle e-mail? Especially
>attachments?
>
>The problem:
>
>A person is going to regulary post a mail with an attachment (text),
>which i shall extract and make available on the web.
>
>I thought i might try to make this automatic, since the webserver and
>mailserver is on the same computer (RedHat Linux 5.2).
>
>Mats
>
>



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

Date: Mon, 26 Apr 1999 10:59:26 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: Re: FAQ 4.31: How do I pad a string with blanks or pad a number with zeroes?
Message-Id: <37242AEE.970360C5@gmx.net>

Tom Christiansen wrote:
> 
> (This excerpt from perlfaq4 - Data Manipulation
>     ($Revision: 1.46 $, $Date: 1999/04/20 18:59:53 $)
[...]
>         # Left padding with blank:
>         $padded = sprintf( "%${pad_len}s", $text ) ;
> 
>         # Right padding with blank:
>         $padded = sprintf( "%${pad_len}s", $text ) ;

I must confess I fail to see the difference between those two bits of
code. Can anyone else enlighten me?

Cheers,
Philip


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

Date: Mon, 26 Apr 1999 11:44:34 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: Re: FAQ 7.14: How can I pass/return a {Function, FileHandle, Array, Hash, Method, Regexp}?
Message-Id: <37243582.25D4CDD8@gmx.net>

Tom Christiansen wrote:
> 
> (This excerpt from perlfaq7 - Perl Language Issues
>     ($Revision: 1.25 $, $Date: 1999/04/14 03:46:19 $)
[...]
>     Passing Regexps
>         To pass regexps around, you'll need to either use one of the
>         highly experimental regular expression modules from CPAN (Nick
>         Ing-Simmons's Regexp or Ilya Zakharevich's Devel::Regexp), pass
>         around strings and use an exception-trapping eval, or else be
>         very, very clever.

How about pre-compiling one with my $re = qr/whatever/ and passing around
$re?

Cheers,
Philip


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

Date: Mon, 26 Apr 1999 10:15:39 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: FAQ 7.14: How can I pass/return a {Function, FileHandle, Array, Hash, Method, Regexp}?
Message-Id: <ebohlmanFAsKI3.1sL@netcom.com>

Tom Christiansen <perlfaq-suggestions@perl.com> wrote:
:   How can I pass/return a {Function, FileHandle, Array, Hash, Method, Regexp}?
:     Passing Regexps
:         To pass regexps around, you'll need to either use one of the
:         highly experimental regular expression modules from CPAN (Nick
:         Ing-Simmons's Regexp or Ilya Zakharevich's Devel::Regexp), pass
:         around strings and use an exception-trapping eval, or else be
:         very, very clever. Here's an example of how to pass in a string
:         to be regexp compared:

This needs to be updated to take qr// into account.



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

Date: Mon, 26 Apr 1999 09:41:16 GMT
From: ralawrence@my-dejanews.com
Subject: Fork goddamit! Fork!
Message-Id: <7g1cbt$v8f$1@nnrp1.dejanews.com>

I hope someone can help :o)

I have some perl run as cgi which takes a whole load of params, forks, the
child displays a "thanks!" message whilst the parent goes off and does
something (which takes a while).

Now I've tested this under the shell and it all works fine. You run it, add
the params, up comes the "thanks" message and about 4 mins later the parent
finishes (no output is required).

But .. running under control of the webpage causes the browser to declare that
its found the page and then the whole thing times out waiting for the page to
arrive (that page should have arrived instantly).

I've tried swapping it around so that the parent displays the message and the
child does the main thing but its the same.

Can anyone help? The code snipped is below if it will help:

if (!defined($child_pid = fork()))
{
  internal_error("couldn't fork");
  exit;
}

if ($child_pid) # if we are the child
{
  print "Content-type: text/html\n\n";
  open (MSG, "working.html") || internal_error("can't open working.html: $!");
  print <MSG>;
  close MSG;
  exit;
}

# we are the parent, so do the search

@result = ();

# and so on ...

Cheers

Rich

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


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

Date: Mon, 26 Apr 1999 14:57:51 +0800
From: "Lawrence Ng" <engp8518@nus.edu.sg>
Subject: Fork() for windows
Message-Id: <7g12p5$lgo$1@nuscc.nus.edu.sg>

Is there a fork equivalent in Perl for windows?

I am trying to do this.
I use a perl script to start Matlab and then before the matlab finish
running, I want to open a web page at the client's side to display the
Matlab results (MAtlab is still running). However, I cannot do this because
perl waits for Matlab to finish executing before it opens the web page. Can
someone tell me how to "fork" processes in windows?

Also, I am trying to retrieve several web pages using the LWP package
function "get". Can I get them all at one time (something like a fork
process) so that I don't have to wait for Perl to get them one by one.

Thanks

Lawrence




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

Date: Mon, 26 Apr 1999 09:09:02 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Free Web Hosting with CGI
Message-Id: <7g1a1d$7h4$1@fir.prod.itd.earthlink.net>

"Paul A. Fortin" <pafortin@i-1.net> wrote:
>Is there a site out there that allows CGI hosting and that is free.
>I've tried "webjump" but they severely limit what you can do in a script
>and it has become an irritant?


And this has something to do with perl?



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

Date: Mon, 26 Apr 1999 10:17:50 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: Re: Generating a unique string for order number
Message-Id: <3724212E.4D7C5E82@gmx.net>

Greg McCann wrote:
> 
> my $order_pid = '0' x (5 - length($$)) . $$;
> my $order_no = '0' x (10 - length($order_time)) . $order_time;
> $order_no = substr($order_no, 0, 5) . '-' . substr($order_no, 5, 5) .
> '-' . $order_pid;

This looks (to me) like a job for sprintf -- e.g. my $order_pid =
sprintf "%.5d", $$; etc. (To do the zero-padding.)

Cheers,
Philip


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

Date: Mon, 26 Apr 1999 10:49:31 GMT
From: John <jking2019@my-dejanews.com>
Subject: h2ph help please
Message-Id: <7g1gbq$2e3$1@nnrp1.dejanews.com>

Hello, I am having a serious headache using h2ph on Solaris 2.6 and Perl 5002

>From what I have found the answer is to upgrade to the 5005003 code but that
is something that cannot be done since we are using 3rd part software that
currently is only supported on the 5002 platform.

I tried compiling perl on another solaris system and then copying the h2ph
program to the server running 5002 and redoing the header conversions. This
seemed to work, but caused another problem:

All the require statements fail to find the modules. I tried replacing the
requires with use statements but there are way too many parts and the few I
did caused other errors such as not being able to recognize various
procedures and functions which exist.

Would someone be kind enough to rewrite h2ph for perl 5002 so that it will
convert the headers over correctly or tell me what I need to do? The only
reason I think its a problem with h2ph is that there are other posts from
Solaris users stating they had the same kind of problems (mainly with the
definiitions file recognzing __sparc and other items).

Thanks

--
-John

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


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

Date: Mon, 26 Apr 1999 18:33:36 +1000
From: Simon Gronow <srg@babcom.com.au>
Subject: Re: Help with Code
Message-Id: <372424E0.11D8FC0D@babcom.com.au>

Thanks to all who have emailed me, I have now fixed the problem

Rgds
Simon.

Simon Gronow wrote:

> I need help with a bit of code
>
> I have a line in a string as follows
>
> /files/download/myfile.ext
>
> I need it to be
>
> \files\download\myfile.ext
>
> My Question is how can I get one character in a line, the "/" to be
> changed to "\"
>
> Can any one help me ? If so please E-mail me at simon@babcom.com.au
>
> Thanks
> Rgds
> Simon.



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

Date: Mon, 26 Apr 1999 11:11:53 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: Re: Help:How to find Pixel size of an uploaded image using CGI?
Message-Id: <37242DD9.6E777F42@gmx.net>

Jonathan Stowe wrote:
> 
> On Sat, 24 Apr 1999 18:14:57 GMT ltif@my-dejanews.com wrote:
> > When user is uploading an image (.gif or .jpeg) into
> > our LINUX/APACHE server using his/her
> > browser, how can we find out the pixel size of the image
> > using CGI (of course we can do it offline using paintshoppro)?
> 
> I figure that the module Image::Size available from CPAN does that -
> though I have never had cause to use it myself not being a pornographer.

No, Jonathan; Image::Size requires Perl. ltif wanted to find out the size
of a picture using only the Common Gateway Interface.

Cheers,
Philip


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

Date: Mon, 26 Apr 1999 11:26:58 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: Re: How do i print something using perl?
Message-Id: <37243162.647D77A3@gmx.net>

smnayeem@my-dejanews.com wrote:
> 
> Does anyone know how i can direct the output of print statements to
> the printer?

Where's "the printer"? Attached to a serial port? Parallel port? Network
connection? Served by lpd, or SMB, or some other method?

Once you know where "the printer" is in your operating system and
configuration, you'll probably know how to talk to it from Perl. Or if
not, come back for help with more details.

Cheers,
Philip


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

Date: Mon, 26 Apr 1999 10:43:55 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: Re: I need help!!!!!
Message-Id: <3724274B.4A058375@gmx.net>

jhelgesen@my-dejanews.com wrote:
> 
> > The point is I cant launch the script show.pl with the link <a
> > href=/cgi-bin/com/show.pl?index=12345>"
> >
> > Whats wrong with the script show.pl
> 
> It may be that your browser expects quotes around the URL.

It may be that the HTML standard expects quotes around the URL (since it
includes [^A-Za-z0-9] characters). The browser would be right to expect
them as well. (Not saying this is the problem with your script, but it
*is* invalid HTML AFAIK.)

Cheers,
Philip


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

Date: 26 Apr 1999 11:44:16 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Net::FTP creates Empty file
Message-Id: <37244380@newsread3.dircon.co.uk>

Wayne Keenan <tripix@tdi-net.freeserve.co.uk> wrote:
> 
> I have done some testing before using 2 different ISPs  (freeserve.net and Southampton University)
> I cannot tell what FTP server Freeserve is using, listed above is a FTP server at Soton univ.
> 
Hmm ...

Connected to ftp.freeserve.net.
220 freeserve-com-06 Microsoft FTP Service (Version 4.0).

Nah all bets are off ;-}

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



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

Date: Mon, 26 Apr 1999 10:48:10 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Newbie regex query
Message-Id: <372542f4.859053854@news.insnet.net>

On Sat, 24 Apr 1999 08:00:15 -0400, tadmc@metronet.com (Tad McClellan)
enlightened us thusly:

>Andy Elvey (andyelv@ibm.net) wrote:
>
>: !#/usr/bin/perl
>  ^^
>  ^^ transposed
>
>   Something tells me that we are not looking at the code
>   that you are looking at.

If he's using a MS platform the shebang isn't necessary, so this could
well be real code.

>:   if (/([0-9]*)([a-zA-Z]+)([0-9]*)/) 
>               ^                  ^
>   So if   $_='x'  you want to calculate the derivative?

$_='x' is equivalent to 1x1 in his notation.  The derivative of which
is 1.  He has forgotten to put in some defaults for when the user gets
lazy and just types 'x' or '5x' or 'x3'.  Or maybe he's assuming that,
whilst _programmers_ are allowed to be lazy, _users_ should be subject
to whips, chains, and other forms of discipline.  I know several who
could do with a good thrashing ;-)

>   If digits are required, then don't let them be optional.

They aren't required.  I am more curious about why the + is there
after the [a-zA-Z] - and why he didn't use /i.

[Copying newsgroup posts to me by mail is considered rude]

-- 
David Cantrell, part-time Unix/perl/SQL/java techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


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

Date: Mon, 26 Apr 1999 11:51:52 +0100
From: Matt Sergeant <matt-news@sergeant.org>
Subject: Re: Perl and ASP
Message-Id: <37244548.2D72CC0B@sergeant.org>

Jalil Feghhi wrote:
> 
> Is it possible to use Perl (instead of VBScript or JScript) in ASP pages?

Of course... See http://www.activestate.com (download and install
ActivePerl) and then read the complete documentation on my web site.
(URL below).

-- 
<Matt email="msergeant@ndirect.co.uk" />

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


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

Date: Mon, 26 Apr 1999 09:00:29 +0000
From: Michael Cameron <Michael.Cameron@no.spam.technologist.com>
To: joeyandsherry@mindspring.com
Subject: Re: Perl operate autonomously?
Message-Id: <37242B2D.93070EC6@no.spam.technologist.com>

joeyandsherry@mindspring.com wrote:
> Is there a way
> for this script to operate on its own? Not requiring it to be called to have
> it perform these checks?
> 
No.  You cannot have a program that does not have to be called but
performs an action.

You can run it once and have it regularly wake up, do its stuff then go
back to sleep and embed this code into an infinite loop (have a look at
daemons) OR you can run it regularly (have a look at cron).  I do not
know what the Windows equivalents of these are (in case you have the
misfortune to be using one).

HTH,

Michael


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

Date: Mon, 26 Apr 1999 06:31:51 +0100
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: Re: Perl operate autonomously?
Message-Id: <3723FA47.BC4E5B7@patriot.net>

> I want to create a little utility that keeps a "robotic" watch on my
> database files, like periodically checking for errors, etc. Is there a way
> for this script to operate on its own? Not requiring it to be called to have
> it perform these checks?

A program must be "called" in order to operate, but there are ways around
this...

If you are using NT, you can install your script as a service and have it run
that
way.  If you wish to predetermine what constitutes "periodic", say every 10-20
minutes, you can simply add a "sleep()" command to the script.  If you want
the script to run every night at 2:30am, then you can run it using the Scheduler

service...

Carv



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

Date: Mon, 26 Apr 1999 09:52:43 +0000
From: Craig Graham <c_graham@hinge.mistral.co.uk>
Subject: Re: QUESTION:Perl Regular Expression Subtring Matches? Strange   Behaviour...
Message-Id: <3724376B.20BCF765@hinge.mistral.co.uk>

Hmm. Some folk's seem interested - here's what I mailled to David, also
appended is another mail I sent back to Anurag Varma on the same topic.
------------

David Cassell wrote:

>Craig Graham wrote:
>> 
>> Eric Bohlman wrote:
>> >
>> > Craig Graham <c_graham@hinge.mistral.co.uk> wrote:
>> > : When I came to code the regex processor, I noticed this behaviour
>> > : from Netscape - and when I checked with Perl, that's the same:
>> >
>> > :    $_=aibajbccc;
>> >
>> > :    /(a.b)+c+/;
>> >
>> > :    print("$_\n");
>> > :    print("$& $1 $2 $3\n");
>> >
>> > : This gives a result of $&="aibajbccc" as I would expect.
>> > : But it only gives the first substring match $1="aib", even though
>> > : I would have expected (a.b)+ to imply multiple substring matches
>> > : (indeed it does in the final match $&, where both substring matches
>> > : "aib" and "ajb" appear). If substring's are matched and processed into
>> > : the final match, how come only the first is actually returned on it's
>> > : own?
>> >
>> > Each $n variable corresponds to a physical pair of parentheses.  Since
>> > your regex has only one pair of parentheses, $2 and $3 are not going to
>> > be touched.  If there's a quantifier (such as '+') after a pair of
>> > parenthesis, only the last match is recorded.
>> 
>> Ok, it's not quite what I would have expected (excuse my ignorance
>> here), as intuitively I'd have expected the + to extend to include 1 or
>> more substrings - it seems me to be an inconsistency in the
>> syntax/semantics
>> that it doesn't (I'm sure this has been discussed a hundred times
>> before).
>
>Craig, I think that you are expecting (a.b)+ to match this:
>((a.b)+)
>where $1 would hold the matched material from the outer parens, and
>$2 would match what is in the inner parens.

Not quite - I was expecting the + to effect the first paren clause (as
it
effects the contents of the parens).

>Do you see the difference?  The parens around (a.b) capture something..
>but that something can only be three characters long [or nothing, if
>there were no match].

That's not in fact true, as the final match for that pattern will in
fact
have (a.b)+ matching 6 characters (see my example) but only 3
of them appearing as a substring (the first substring is only returned
as a component of the last matched $&).

>So it's not an inconsistency in the syntax.  But it may be different
>from what you are used to.  Still, any good regex package should only
>match three characters there.  That's all your parens surround at
>any time.

Yep. But my assertion was that the ()+ implied that it should match
the three characters several times (as seperate substrings).

>And I seriously wonder if Netscape's pattern-matching should be held
>up as any sort of standard for programming languages to aspire to.  :-)

It should if you're contracted by a company which produces standalone
Web Browser set-top boxes that wants JavaScript support adding
to their in-house written browser ;)

*** Added Note: Netscape/JavaScript's regexp handler is taken directly
from Perl anyway.....

>David

Craig.

>David Cassell, OAO                            cassell@mail.cor.epa.gov
> Senior Computing Specialist                      phone: (541) 754-4468
> mathematical statistician                          fax: (541) 754-4716

Craig Graham, MEng                     c_graham@intelligent-group.com
Embedded Systems Consultant,
Intelligent Research Ltd.

=========================
NEXT: mail to Anurag Varma:
=========================

On Sun, 25 Apr 1999, Anurag Varma wrote:
>Craig,
>I guess its normal behavior. See u wrote
>(a.b)+
>
>$1 is anything in between "(" and ")"
>which is a.b -------> which is aib
>"+"  is out side the ( ) so it doesn't come in $1.
>
>I haven't tried this but I expect something like this
>
>((a.b)+)    ---> $1 = aib        and $2 = aibajb

Thanks, I've had some useful comments (one from the
senior mathmatical statistician at the US EPA), and I think
I'm fight a lost cause on this one...but anyway, my point was:

a+       = a repeated 1 or more times
[a-b]+   = a or b repeated 1 or more times
(a.b)+   = (a.b) substring match repeated 1 or more times

The final one has slightly skewed semantics in that
the substring match repeats in the last match, but only
reports one substring no matter how many strings it matchs.

eg.
  $_="axbaybazb"
  /(a.b)+/
  print $&

will print axbaybazb, as the substring match has repeated
in the last matched ($&)  - try it.
But.....only the last of the substring matches will actually
appear as an accessible substring in $1, ie. $1=azb.
So, even though the + operator has effected the parens,
it hasn't had the effect of truly creating 1 or more substrings
it's simply matched the sequence inside the substring
several times and returned the substring at some later stage.

I still reckon it's  bug.

Craig.


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

Date: Mon, 26 Apr 1999 10:39:50 +0000
From: Michael Cameron <Michael.Cameron@no.spam.technologist.com>
To: Kimberly Rice <kimrice@leland.Stanford.EDU>
Subject: Re: returning a hashtable from a subformula
Message-Id: <37244276.F57C0@no.spam.technologist.com>

Kimberly Rice wrote:
> 
> 
> But, it is not working; there is no %globalHash after the subformula call.
> Can a subformula return a hash table?  If so, what am I doing wrong?

Try the FAQs.  FAQ 7 General Perl Language Issues contains answers to
"How can I pass/return a {Function, FileHandle, Array, Hash, Method,
Regexp}?"

See http://language.perl.com/faq/index.html

> Thanks, Kim (a 1st day perl programmer)

Hope you enjoy day 2 onwards.

HTH

Michael


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

Date: Mon, 26 Apr 1999 10:45:29 +0200
From: alainch <alain_chiorboli@email.sps.mot.com>
Subject: serial port
Message-Id: <372427A9.4B00FF27@email.sps.mot.com>

Hi all,

I'd like to have access and configure serial ports (such as ttya or
ttyb) under unix
with perl. Can someone help me ?

Thanks.

--
_____________________________________________________________________

Alain CHIORBOLI
_____________________________________________________________________





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

Date: 26 Apr 1999 08:25:33 GMT
From: wtang@cs.ualberta.ca (Wei Tang)
Subject: Supported data types in Oraperl
Message-Id: <7g17tt$1p2$1@scapa.cs.ualberta.ca>

Hi there,

I have been using Oracle DBD:DBI for Perl5 (Oraperl layer) for some time. 
Everything was fine until I changed the data type for one table column from 
varchar2 to long. When I send the query over the database concerning the 
changed table column, I always got nothing in the result.

However, I checked the Oracle database using SQL*Plus, the data was there.
I also tried JDBC access to the database, it's also working. So I am
suspicious that something is wrong with the Oracle DBD module (more
specifically, Oraperl layer wrapper). Our Oralce server is 8.0.4.

The csr I got after the database open (using &ora_open($lda, $query)) is:
	DBI::st=HASH(0x1dd1d0)

I suppose the database open (with the query) was successful (or maybe I am
wrong? How do I get the hash value?). But &ora_fetch($csr) returned nothing.

Experts, any clue? Does this problem have something to do with the data
type 'long'? Previous varchar2 works fine.

Thank you very much.



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

Date: Mon, 26 Apr 1999 09:02:09 -0700
From: Ed <Ed@gec.nospam.com>
Subject: Re: The question about debug and design
Message-Id: <37248E01.A89@gec.nospam.com>

Carfield Yim wrote:
:
: I know that I want to write persuade code, but how to write it well?
: I find that I will always change the persuade code a lot as I haven't
: consider many thing,
: and the other reason is I find the original design is impossible to
: implentment, or is not a good design,
: so I think that there shall be some thing do before writing persuade
code,
: right?

exactly, if you can't see it's not going to work in your design
your using the wrong design method.
You can't just write the requirements on a piece of paper and
call that a design.  Have a look at a few design methidologies
from simple flowcharting to SASD, the pieces should all fit
together before you go ahead with it.
Pseudo-code is a good way of convaying a certain algortihm
to another programmer who doesn't neccesarily code in the same
languages you do, If you design somehting properly you should
be able to program it directly from the design and not need to use
pseudocode at all.

: 
: And do you have any recommendation of debugging?
: can we analysis the bug logically?
: 

Their are various debugging methodoligies out there have a go at
a few and see what suits you. I peer code walkthoughs are usually
a very good starting point.

Ed


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

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

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