[10655] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4247 Volume: 8

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

Date: Wed, 18 Nov 98 09:00:21 -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, 18 Nov 1998     Volume: 8 Number: 4247

Today's topics:
    Re: 500 server error <jtjohnston@erase.courrier.usherb.ca>
    Re: 500 server error <dgris@moiraine.dimensional.com>
    Re: Access Database dave@mag-sol.com
    Re: Are there no PERL experts out there?? Is there no o <joemoore@att.com>
    Re: Are there no PERL experts out there?? Is there no o <grifftoe@sni.net>
        Base64 encoding problem... (The Corruptor)
        Cannot install modules with CPAN.pm <jurgen@pallas.tid.es>
        CHUNK Error <kwoodhead@kenan.com>
        CPU time with NT <thomas_poirel@crediteurop.lu>
    Re: Exec question! <eva_spiral@hotmail.com>
    Re: exhaust memory even with close?!?!? <tbriles@austin.ibm.com>
    Re: Holy Abounding Books, Batman! (Clinton Pierce)
    Re: Holy Abounding Books, Batman! (James Peregrino)
        it reaches $RS->Close() then hangs?? any ideas?? (John Hardy)
    Re: Learning <jeff@webdesigns1.com>
    Re: MacPerl + Resource Fork <eva_spiral@hotmail.com>
    Re: MacPerl + Resource Fork <eva_spiral@hotmail.com>
    Re: MacPerl + Resource Fork (Andrew M. Langmead)
    Re: MacPerl + Resource Fork (Andrew M. Langmead)
    Re: Parsing Success & Error <rootbeer@teleport.com>
    Re: perl 5.005_02 <ebohlman@netcom.com>
    Re: Perl Array Question? Anybody... <tbriles@austin.ibm.com>
        Scope question for Perl xaqtnr@my-dejanews.com
    Re: Smarter Web Mailer (Clay Irving)
        Sounds easy when I type it fast <brandis@benet.net.au>
    Re: test for.t failure due to bad rounding everybodydies@my-dejanews.com
    Re: User ID problem (James Peregrino)
        writing to file on winnt perl cgi <as@asd.asd>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Wed, 18 Nov 1998 10:44:14 -0500
From: JTJ <jtjohnston@erase.courrier.usherb.ca>
Subject: Re: 500 server error
Message-Id: <3652EB4E.1438@erase.courrier.usherb.ca>

Matthew Bafford wrote:
> 
> In article <36523476.4AA6@erase.courrier.usherb.ca>, JTJ
> <jtjohnston@erase.courrier.usherb.ca> pounded in the following:
> =>      perl -w file.pl
> =>      perl -w file.cgi
> =>
> => These will run your perl debugger.
> =>
> 
> They will?
> 
> Maybe you mean:
> 
>      perl -d file.pl
>      perl -d file.cgi
> 
> --Matthew

No I mean:
      perl -c file.pl
      perl -c file.cgi
      perl -w file.pl
      perl -w file.cgi

Unix AIX RS-6000 Server.


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

Date: 18 Nov 1998 09:45:11 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: 500 server error
Message-Id: <m3af1pkl0o.fsf@moiraine.dimensional.com>

JTJ <jtjohnston@erase.courrier.usherb.ca> writes:

> No I mean:
>       perl -c file.pl
>       perl -c file.cgi

These check the syntax of your program.

>       perl -w file.pl
>       perl -w file.cgi

These enable warnings.

Neither invokes the debugger, for that you want
perl -d.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
Supporter of grumpiness where grumpiness is due on clpm.
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Wed, 18 Nov 1998 15:57:11 GMT
From: dave@mag-sol.com
Subject: Re: Access Database
Message-Id: <72uqoc$6o9$1@nnrp1.dejanews.com>

In article <72udch$4vb$2@mawar.singnet.com.sg>,
  "Ho Seng Yip" <hsengyip@(nospam)singnet.com.sg> wrote:
> Hi,
>
> I am wondering if Perl can actually read and write data into / from a
> Microsoft Access database.
>
> If you have any useful links to relevant resources, please let me know too.

You should look at the DBD::ODBC and Win32::ODBC modules available from CPAN
<http://www.perl.com/CPAN/>.

hth,

Dave...

--
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

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


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

Date: Wed, 18 Nov 1998 10:40:51 -0500
From: Joe Moore <joemoore@att.com>
To: Rafely@xxiname.com
Subject: Re: Are there no PERL experts out there?? Is there no one who can solve  this??
Message-Id: <3652EA83.9DD95D2A@att.com>

First, you have to get the form to pass the name to the program.
HTML code:
<Form action="yourcgiprogram" method="POST">
<input type="text" name="name">
<input type="submit">
</form>

Perl code:
use CGI;
$query = new CGI;

if ($query->param('name') =~ /^[A-Za-z\s]+$/) {
    # VALID
} else {
    # INVALID
}

There are alternative ways to read the form variables, if you already have that
part working by using ReadParse() or some other method, just substitute the
appropriate variable in the if statement:

if ($in{'name'} =~ /^[A-Za-z\s]+$/) {

or

if ($name =~ /^[A-Za-z\s]+$/) {

The expression:
    ^ -- begin line
    [A-Za-z\s]+ -- one or more (+) of capital letters(A-Z), small letters (a-z),

                           or whitespace (\s).  You may want to add commas and
                           periods to your list  John Smith, Jr. [A-Za-z\s\,\.]+

    $ -- end of line

By sandwiching the expression between ^ and $ you force the user to use ONLY the
expression.  Otherwise, if you just used /[A-Za-z\s]+/ then that will match:
000xyz#$%.  It matches the xyz portion.  The ^ $ makes it match the beginning of
the line followed by allowed character followed by the end of the line.

To complicate matters, the character ^ takes on a special meaning when it is
inside brackets [].  The expression /[^A-Z]/ means match any character except
A-Z.  As first character inside the square brackets, the ^ loses the meaning of
begin line and takes on a new meaning invert or "everything but".

Rafely@xxiname.com wrote:

> Hello,
>
> I'm making a form so users can send me information.
> The also have to send me their name. How do I check
> and see if the name only consists of letters and white
> spaces?? So "My Name" is allowed but "Jj&*d d#fdhd"
> is not allowed!!! I want to send a message saying that
> the name was invalid! But how do I check and see if
> the name is valid?



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

Date: Wed, 18 Nov 1998 09:12:32 -0700
From: John Griffiths <grifftoe@sni.net>
To: Joe Moore <joemoore@att.com>
Subject: Re: Are there no PERL experts out there?? Is there no one who can solve  this??
Message-Id: <3652F1F0.4D8F4054@sni.net>

Joe Moore wrote:
> 
> First, you have to get the form to pass the name to the program.
> HTML code:
> <Form action="yourcgiprogram" method="POST">
> <input type="text" name="name">
> <input type="submit">
>[snip]
>have that
> part working by using ReadParse() or some other method, just substitute the
> appropriate variable in the if statement:
> 
> if ($in{'name'} =~ /^[A-Za-z\s]+$/) {
> 
because

> Rafely@xxiname.com wrote:
> 
> > Hello,
> >
> > I'm making a form so users can send me information.
> > The also have to send me their name. How do I check
> > and see if the name only consists of letters and white
> > spaces?? So "My Name" is allowed but "Jj&*d d#fdhd"
> > is not allowed!!! I want to send a message saying that
> > the name was invalid! But how do I check and see if
> > the name is valid?

I prefer to check FORM input fields with javascript, I'll
see if Joe's suggestion can be implemented on a FORM I check
for a non-blank name field
(http://www.mcalvany.com/inquiry.html)
-- 
Dr. John  Griffiths  \( ~ )7  The Teahouse of Experience
grifftoe@csn.net           http://www.sni.net/~grifftoe/
O, call back yesterday. Richard II, act 3, sc. 2.
Less than 300 working days remain until the year 2000!


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

Date: Wed, 18 Nov 1998 03:20:20 GMT
From: corruptor@terry.org.uk (The Corruptor)
Subject: Base64 encoding problem...
Message-Id: <36523bb3.6480218@news.ukonline.co.uk>

I'm trying to write a script to encode a binary file into Base64 using
MIME::Base64.

The following is a listing of the code I've got:

#	Base64Encode
#	Simple base64 encoder, using MIME-Base64 module

require 5.003;
use MIME::Base64 qw(encode_base64);
use integer;

#	Check usage
($#ARGV != 0) && die "Error: usage: base64encode file\n";

#	Open file or die 
open(INFILE, $ARGV[0]) || die "Error: Can't open input file
$ARGV[0]\n";

#	Open output file or die
$ARGV[0] =~ /(.*)\.(\w+)$/;
open(OUTFILE, ">$1.base64") || die "Error: Can't open output file
$1.base64\n";

#	Do the business...
while (read(INFILE, $Buf, 60*57)) {
	print OUTFILE encode_base64($buf);
}


My problem is that this code will only generate a few bytes of encoded
data (2.3MB file outputs 4.3K of Base64). Debugging shows that on
first entry to the while loop the correct number of bytes is read in,
and output to the OUTFILE handle. However the loop never seems to
iterate a second time.

I'm running a freshly installed NT4.0 (Service Pack3) and Activestate
Perl 5.007 (the same problem occurred on version .005 & .006) with the
mime package downloaded from their site.

Please, can anyone shed any light on this oddity? I'm getting
desperate...

Thanks in advance.
-- 

_THE_____                                      ____
______   \________________________  ___________\___\______________________
  \   \____/  __  \_____  \  __   \/  /\  \ _____  \ ______/  __  \_____  \
   \    __/__/  \__\  \ \__\ \ \__/__/  \__\\   /  / \    /__/  \__\  \ \__\
\   \__/ /  \____/  \  \  \   \  /  \____/  \\_/  /   \__/  \____/  \  \
 \_______\__________/___\  \___\ \__________/  __/ \_____\__________/___\
----====-=**********=====---====--=********\___\=---======**********===----
                                            -===-
             "EGO iS NotHinG wIthOuT ArrOgAncE tO BaCk iT uP..."


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

Date: Wed, 18 Nov 1998 15:09:21 +0000
From: Jurgen Koeleman <jurgen@pallas.tid.es>
Subject: Cannot install modules with CPAN.pm
Message-Id: <3652E321.C6DCF994@pallas.tid.es>

I am trying to use "perl -MCPAN -e shell" to install modules, but it fails
and I don't have the faintest idea how to solve the problem.

The full URL of my nearest CPAN mirror-site is
"ftp://ftp.rediris.es/mirror/CPAN" and the proxy I have to use is
"nube.tid.es:8080" for I do not have direct access to ftp.rediris.es.
With i.e. netscape I can access the URL's without any problem.

In the CPAN/Config.pm file I have the following settings:

 $CPAN::Config = {
  'build_cache' => q[10],
  'build_dir' => q[/users/gnu/.cpan/build],
  'cpan_home' => q[/users/gnu/.cpan],
  'ftp' => q[/bin/ftp],
  'ftp_proxy' => q[nube.tid.es:8080],
  'getcwd' => q[cwd],
  'gzip' => q[/users/gnu/bin/gzip],
  'http_proxy' => q[nube.tid.es:8080],
  'inactivity_timeout' => q[0],
  'index_expire' => q[1],
  'inhibit_startup_message' => q[0],
  'keep_source_where' => q[/users/gnu/.cpan/sources],
  'lynx' => q[],
  'make' => q[/users/gnu/bin/make],
  'make_arg' => q[],
  'make_install_arg' => q[],
  'makepl_arg' => q[],
  'ncftp' => q[],
  'no_proxy' => q[],
  'pager' => q[pg -e -p " Page: %d " -sn],
  'shell' => q[/bin/ksh],
  'tar' => q[/users/gnu/bin/tar],
  'unzip' => q[/users/gnu/bin/gunzip],
  'urllist' => [q[ftp://ftp.rediris.es/mirror/CPAN]],
  'wait_list' => [q[wait://ls6.informatik.uni-dortmund.de:1404]],
 };

It seems to me that the proxy is not used at all. It's as if is intented to
access ftp.rediris.es right away.
For instance if I try to install Bundle::CPAN, the following output is
generated:

cpan> install Bundle::CPAN
CPAN: LWP loaded ok
Fetching with LWP:
  ftp://ftp.rediris.es/mirror/CPAN/authors/01mailrc.txt.gz
Issuing "/bin/ftp -n"
ftp.rediris.es: unknown host
Not connected.
Local directory now /users/gnu/.cpan/sources/authors
Not connected.
Not connected.
Not connected.
Not connected.
Not connected.
Not connected.
Bad luck... Still failed!
Can't access URL ftp://ftp.rediris.es/mirror/CPAN/authors/01mailrc.txt.gz.

Please check, if the URLs I found in your configuration file
(ftp://ftp.rediris.es/mirror/CPAN) are valid. The urllist can be edited.
E.g. with ``o conf urllist push ftp://myurl/''

Cannot fetch authors/01mailrc.txt.gz


Any idea what's going on and how the solve it?

TIA,

Jurgen Koeleman




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

Date: Wed, 18 Nov 1998 14:53:27 +0000
From: kelly woodhead <kwoodhead@kenan.com>
Subject: CHUNK Error
Message-Id: <3652DF66.C4917C24@kenan.com>

Hi

Im new to looking at perl and wondered if anybody could let me know what
the folowing error indicates:

CHUNK ERROR 274.

I guess that it is an internal perl error but can anybody actualoly tell
me what this is?.


Thx




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

Date: Wed, 18 Nov 1998 16:57:53 +0100
From: "POIREL Thomas" <thomas_poirel@crediteurop.lu>
Subject: CPU time with NT
Message-Id: <72uqr7$lpc$1@news.pt.lu>


How can get CPU time in my Perl process with NT machine ?

Times does not work with NT !!!

Thanks

thomas_poirel@crediteurop.lu








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

Date: Wed, 18 Nov 1998 15:41:19 +0000
From: "eva m. klopper" <eva_spiral@hotmail.com>
To: jesper kempe <kempe@mtek.chalmers.se>
Subject: Re: Exec question!
Message-Id: <3652EA9F.BBFC9786@hotmail.com>

Hello Jesper,

Just browsing, but are you sure that exec() is implemented under Win32 port
of Perl? The last time I looked it wasn't.

If I remember correctly, there are a set of Win32 modules for launching new
programs etc...

Bye!

jesper kempe wrote:

> Hi
> I4ve got a problem:
> On my computer I run win95 and a webserver with Xitami. I4ve got a very
> simple thing on my page so that you can send me a message that appears
> emidiately on my screen and I can answer and they can see my answer in a
> frame that updates automaticly.
> Ok, now to my real problem. In my very simple perl script I exec another
> program written i Visual basic. The problem is that when I exec the vb
> program the script pause and if i dont answer the user gets the
> "document contians no data" in his browser.
> Is there another way to execute  another program in perl?
>
> Hope you understand my problem and can help me.
>
> Any comments are appritiated...
>
>             /Jesper Kempe
>             http://malte.hemmet.s-hem.chalmers.se





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

Date: Wed, 18 Nov 1998 09:22:15 -0600
From: Tom Briles <tbriles@austin.ibm.com>
Subject: Re: exhaust memory even with close?!?!?
Message-Id: <3652E627.60F8F4CC@austin.ibm.com>

Douglas L. Cordero, PhD wrote:

> Hi guys:
>
> My code is exhausing all of my virtual memory with
> sucessive file opens.  It dies (can't open...) on
> file 33 out of 263.  The files themselves are quite large.
> (about 1 M each).  Hash of arrays "%array" winds up
> holding about 1 million values (before it dies) -- which is not
> enough to fill up 67 M of virtual memory, I would think.
> So, it looks like its not freeing the memory after the
> read is finished.  What's weird is that I am closing
> the filehandle after reading is done.
>
> (just a note, dxread is a fortran program that opens/reads the
> linked file and screen dumps 2 values: a key and a number, which
> get sucked into %array.  dxread exits properly and dumps a total
> of about 100,000 lines per file.)
>
> Any ideas what's up with it???
>
> Thanks in advance,
> -Doug Cordero
>
> system:  IBM RS-6000 Model 397
> perl version  5.003  and 5.004
>

<snipped the code>

Doug -

Just an educated guess, but have you checked the ulimits of the user executing
the program?  How do you know it's a virtual memory issue?

You could be hitting any of the various limits.

- Tom



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

Date: Wed, 18 Nov 1998 15:49:30 GMT
From: cpierce1@mail.ford.com (Clinton Pierce)
Subject: Re: Holy Abounding Books, Batman!
Message-Id: <365eec87.518501692@news.ford.com>

On 18 Nov 1998 05:06:55 GMT, richm@ucesucks.mulveyr.roc.servtech.com
(Rich) wrote:

>On 17 Nov 1998 22:32:18 GMT, Tom Christiansen <tchrist@mox.perl.com> wrote:
>>In comp.lang.perl.misc, Helen Rice @ foothill.net writes:
>>:I don't recommend Programming Perl, too encyclopedic and absolutely useless
>>:for learning. Once you know it, it might be a good reference book. Not
>>:enough examples.

I disagree, almost completely.  It's quite useful for learning, if
that's the style you like.  I wouldn't call it a "gentle introduction"
to the language, but it's not "useless" at all!   

And there are PLENTY of examples.

>>[..]
>>I realize I'm probably too close to the problem to see it.  So, if you
>>could please point out to me what's not where, I'm sure that everyone
>>will be happier.
>>
>
>   I suspect that the previous poster was commenting on the 
>apparent assumption made in PP that the reader has at least a
>passing familiarity with computer programming, in general.  I.E.
>you don't explain what a variable is, what a loop is, etc.  ( As
>opposed to describing the Perl syntax for loops ).

I've only taught perl to about 50-60 people, so my oberservations
might not be as accurate as Tom's or someone else who has taught
hundreds? (thousands?) of people but...

PP ramps up pretty quickly, sometimes too quickly for someone who's a
casual programmer (SysAdmin, for example) or who's most recent
programming experience is Visual Basic.  In three chapters (don't have
mine handy, just the PCB) all of the basics of the language are covered:
basic syntax, the interpreter, RE's, expressions, etc... Really, beyond
Chapter 3 (+/-1?) the remaining topics might not interest the casual
Perl user.  (Advanced data structures might. IPC?  Maybe not.  Most of
the modules section isn't interesting to a casual user.)

Without having a lot of languages under your belt, or not having someone
to ask silly questions of[1], PP can be pretty *brief*.

Also, organizationally, for a novice user it can be "inconvenient".  If
someone's having problems (searching for an example...) reading
directories, it's a lot easier in Learning Perl to go back and re-read
the entire chapter on it.  Rather than finding the couple pages on it in
the Camel, and flipping to the readdir() entry in Chapter 3.  For
someone learning the language this sometimes leaves them with the
feeling that "they've missed something".

Around DCI and Ford, I've taken the approach of the Llama.   We do a
16-20 hour "Crash Course in Perl"...basically going over each of the
basic parts of the language, and giving them an "outline" (~80 pages)
and lots of labs.  We also give them a copy of the Camel to take home.
It gives everyone a warm fuzzy to be writing complicated programs so
quickly, understanding them.  If they want depth, they get sent to the
Camel.  A lot of handwaving goes on where it's not good to go into
depth.[2]  This approach seems successful.[3]

It's the oberservation around here that a lot of people have both the
Llama and the Camel.  The Llama gets used to DEATH for a couple of
weeks--and then put away.  The Camel then gets used from then on...



[1] "My program won't run", "I can't FIND this syntax error", "My hashes
don't look right", "This RE isn't doing what I'd hoped"...etc..  The
kinds of silly questions nobody wants in comp.lang.perl.misc

[2] For example, the fact that there are 20-odd filehandle tests.
They'll need only 4 or 5 initially.  Why present all of them right away?
Show the interesting ones, leave a pointer to the whole list, move on.

[3] Then again, reading Milton (PL), or Tolstoy (W&P) was _MUCH_ more
enjoyable for me after I had read the Cliff's Notes...I still read the
novels, and enjoyed them thoroughly.  I think the experience was more
complete having a gentle, skimming introduction to the books first.
Many other people are like me, apparently.


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

Date: Wed, 18 Nov 1998 11:03:04 -0500
From: james_peregrino@harvard.edu (James Peregrino)
Subject: Re: Holy Abounding Books, Batman!
Message-Id: <1dioq95.ttl7n1fjg98gN@dcepf5.harvard.edu>

I teach a class on Perl and Web Programming, and last year my only
required book was Programming Perl.  I got many comments from students
saying that they wished I had required the Learning Perl book instead.
Their complaints did use the terms "encyclopdedic", "reference", "not
enough examples".  The students were supposed to have had taken an intro
programming course as a prerequisite - but they ranged as high as people
who professionally programmed in another language.

What I learned is that many of the people who claim they know how to
program were lacking in a skill that I thought I could count on.  This
skill is the initiative to take a well written book (such as Programming
Perl) chock full of examples, and learn from it.

Think of it this way:

Programming Perl is like having daily chats with a friend about Perl
programming.  This friend is full of examples, stories, humor and
information.  From these daily chats, you get excited, try somethings on
your own, and you learn Perl.

Learning Perl is like having someone come to your home, guide you by the
hand, and help you do the basic tasks.

I also had a measurable number of students who could have gotten by
perfectly with the pod docs and the Perl Cookbook.  These would be the
eager pro programmers who love to learn new languages, and therefore can
formulate any programming task into an language neutral question.

I myself cut my teeth on 'man perl' and was in heaven when the first
edition of Programming Perl came out.  Compare that to the days when I
first learned to program by someone handing me the IBM FORTRAN 77
reference manual.  Because I was in 7th grade I could get away with
crying in my pillow back then...

In summary, there are many different learning styles out there.  People
cling to their personal style and get really frustrated when you don't
accodate them.

-James
Tom Christiansen <tchrist@mox.perl.com> wrote:

> In comp.lang.perl.misc, Helen Rice @ foothill.net writes:
> :I don't recommend Programming Perl, too encyclopedic and absolutely useless
> :for learning. Once you know it, it might be a good reference book. Not
> :enough examples.
> 
> After reading your astonishing message, I flipped through Programming
> Perl in search of long stretches of text devoid of examples.  I came up
> empty handed though -- virtually every page has code example, usually
> indented and in a constant-width font.
> 
> If you could please indicate which parts don't have enough examples,
> I will do my very best to fix this in the next edition.  Right now,
> though, I am at a complete loss to help you, because as far as I can see,
> it's simply jammed full of them all the way from stem to stern.
> 
> I realize I'm probably too close to the problem to see it.  So, if you
> could please point out to me what's not where, I'm sure that everyone
> will be happier.
> 
> --tom


-- 
 James Peregrino                                 (617)496-6288 (v)
 Manager of Comp. Services                       (617)495-5685 (f)
 Harvard Div. Cont. Ed.
 james_peregrino@harvard.edu


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

Date: Wed, 18 Nov 1998 16:43:40 GMT
From: jhardy@cins.com (John Hardy)
Subject: it reaches $RS->Close() then hangs?? any ideas??
Message-Id: <0PC42.16$Ux6.18675@198.235.216.4>

When I run this script it works fine, until it reaches $RS->Close()
then it hangs ?? Any ideas??




use diagnostics;                                                ## Use 
Diagnostics module for debugging
use OLE;                                                        ## Call OLE 
module 
use Win32::ADO;                                                 ## Call ADO 
module


$Conn = CreateObject OLE "ADODB.Connection";            ## Create connection 
Object
$CMD = CreateObject OLE  "ADODB.Command";

 
$Conn->Open("DSN=iHRS;UID=sa;PWD=");                    ## Use the connection 
Object to Connect to the Database
$Conn or die "Cannot Connect";
  


my ($LOCK_EX);
$LOCK_EX = 2;

$file = 'VVarin';                                                       # Name 
the file
open(INFO, $file) or die "Couldn't open INFO file";                     # Open 
the file
flock (INFO, $LOCK_EX) || bail ("cannot flock $file: $!");

while ( <INFO> ) {
    chomp;
    ( $key, $value ) = split /:/;
    $linesin{$key}=$value;
};
close(INFO);   
foreach $key (sort keys %linesin ) {
$value=$linesin{$key};
#$value=join('','@',$value);                                    ##add the table 
name to the field name
#print "$value\n";                                                      ## here 
for debugging purposes

}



$CMD->{CommandType} = adCmdStoredProc;

$CMD->{CommandText} = "CandidateINS 
('$linesin{fname}','$linesin{lname}','$linesin{address}','$linesin{po_box}','$l
inesin{province}','$linesin{postal_code}','$linesin{city}',
'$linesin{country}','$linesin{telephone}','$linesin{email}','$linesin{ext}','$l
inesin{fax}','$linesin{citizen_ship}','$linesin{citizen_status}','$linesin{comm
ent}')";

$CMD->{ActiveConnection} = $Conn;

$RS=$CMD->Execute;



if(!$RS) {
        $Errors = $Conn->Errors();
        print "Errors:\n";
        foreach $error (keys %$Errors) {
                print $error->{Description}, "\n";
        }
        die;

}

$cid=($RS->Fields('lastkey')->value );
chomp ($cid);
        
print "$cid \n";


$RS->Close();        ### Hangs here can't close HASH ???
$Conn->Close();





exit;




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

Date: Wed, 18 Nov 1998 08:48:07 -0600
From: "Jeff Oien" <jeff@webdesigns1.com>
Subject: Re: Learning
Message-Id: <72umeo$9ph$1@oak.prod.itd.earthlink.net>

Ross Milton wrote in message <72sthj$hfs$1@oak.prod.itd.earthlink.net>...
>I am interested in Learning Perl. Where should I start. Are there any good
>tutorials on the web?

I have a site which may be of help:
http://www.webdesigns1.com/perl/
--
Jeff Oien, WebDesigns
http://www.webdesigns1.com/
jeff@webdesigns1.com






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

Date: Wed, 18 Nov 1998 15:04:39 +0000
From: "eva m. klopper" <eva_spiral@hotmail.com>
To: Steffen Beyer <sb@engelschall.com>
Subject: Re: MacPerl + Resource Fork
Message-Id: <3652E207.981F7CC8@hotmail.com>



Steffen Beyer wrote:

> eva m. klopper <eva_spiral@hotmail.com> wrote:
>
> > I have a weird task to do here. A client has sent us a file that appears
> > to contain a Mac resource fork that has been transformed into a data
> > fork.
>
> > What I've been trying to do is use MacPerl to open the data fork, slurp
> > in the data (OK so far), then open the resource fork of a new file and
> > write it out as a single block of data.
>
> > Stuck here...
>
> > Does anyone know if this is even possible? Already tried ResEdit and
> > Resourcerer without much luck.
>
> Did you already ask your client *how* the heck they succeeded doing this
> conversion in the first place?
>
> Maybe you can use the same method in order to reverse the change.
>

Yeah, already tried that thanks. But this is a very secretive client and my
Project Manager says they're too busy to answer.

Thanks




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

Date: Wed, 18 Nov 1998 15:04:49 +0000
From: "eva m. klopper" <eva_spiral@hotmail.com>
To: Steffen Beyer <sb@engelschall.com>
Subject: Re: MacPerl + Resource Fork
Message-Id: <3652E211.95DB5E87@hotmail.com>



Steffen Beyer wrote:

> eva m. klopper <eva_spiral@hotmail.com> wrote:
>
> > I have a weird task to do here. A client has sent us a file that appears
> > to contain a Mac resource fork that has been transformed into a data
> > fork.
>
> > What I've been trying to do is use MacPerl to open the data fork, slurp
> > in the data (OK so far), then open the resource fork of a new file and
> > write it out as a single block of data.
>
> > Stuck here...
>
> > Does anyone know if this is even possible? Already tried ResEdit and
> > Resourcerer without much luck.
>
> Did you already ask your client *how* the heck they succeeded doing this
> conversion in the first place?
>
> Maybe you can use the same method in order to reverse the change.
>

Yeah, already tried that thanks. But this is a very secretive client and my
Project Manager says they're too busy to answer.

Thanks




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

Date: Wed, 18 Nov 1998 16:05:06 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: MacPerl + Resource Fork
Message-Id: <F2MKoI.Kv2@world.std.com>

"eva m. klopper" <eva_spiral@hotmail.com> writes:

>I have a weird task to do here. A client has sent us a file that appears
>to contain a Mac resource fork that has been transformed into a data
>fork.

It souds like the file is in MacBinary format, where the data fork,
resource fork, and Finder info (type,creater, etc) get flattened into
a single stream of bytes. Usually, macintosh communication programs
convert macintosh files into MacBinary when sending files, and attempt
to convert from MacBinary to a standard macintosh file when
receiving. (This way it can be stored on a computer with no concept of
the macintosh file format without destroying the resource and other
data).

For non-perl solutions, take a look at the mcvert program. It can
split a MacBinary file into its component data and resource
components.

For a Perl solution, take a look at the Convert::Binhex module.
<URL:http://www.perl.com/CPAN-local/modules/by-module/Convert/
Convert-BinHex-1.119.tar.gz> I think it also does MacBinary to fork
conversion.

Otherwise, If the type of file you have can deal with trailing
garbage. (A GIF file for instance) remove the first 128 bytes of the
MacBinary file. The MacBinary format has a 128 byte header, followed
by the data fork, then followed by the resource fork.


perl -pe 'BEGIN {read STDIN, $chuck, 128}' < macbinary_file > data.file

I started to write something that extracted the data fork out of the
file, just to show that it could be done in under two dozen lines, but
unfortunately after about 10 minutes I have about two dozen lines that
don't quite work right, and thats about all the time I can spend on it
right now. Sorry.
-- 
Andrew Langmead


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

Date: Wed, 18 Nov 1998 16:35:53 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: MacPerl + Resource Fork
Message-Id: <F2MM3u.J4F@world.std.com>

I wrote:
: I started to write something that extracted the data fork out of the
: file, just to show that it could be done in under two dozen lines, but
: unfortunately after about 10 minutes I have about two dozen lines that
: don't quite work right, and thats about all the time I can spend on it
: right now. Sorry.

A couple of minutes after I posted this, I found my problem. (A wrong
offset into the MacBinary header either caused by incorrect
documentation or incorrect addition.)

#!/usr/bin/perl -w

# A program that will take the name of a single MacBinary file on the 
# command line and output its resource fork on STDOUT.

use strict;

my $filename = shift;
open MAC, $filename or die "Can't open $filename: $!\n";
my $header;
read MAC, $header, 128 or die "Error reading header: $!\n";
# header format taken from the mcvert source code.
my $datasize = unpack 'x83N', $header;

# get the prefered block size. If stat returns an
# error, don't worry about it yet(!) 
# just guess some reasonable default.
my $blocksize = (stat MAC)[11] || 4096;


my $fullblocks = int($datasize/$blocksize);
my $leftover = $datasize % $blocksize;
my ($length, $buffer);

while($fullblocks--) {
    $length = read MAC, $buffer, $blocksize;
    die "Error reading from $filename: $!\n" unless $length == $blocksize;
    print $buffer;
}

$length = read MAC, $buffer, $leftover;
die "Error reading from $filename: $!\n" unless $length == $leftover;
print $buffer;





-- 
Andrew Langmead


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

Date: Wed, 18 Nov 1998 16:46:29 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Parsing Success & Error
Message-Id: <Pine.GSO.4.02A.9811180846060.27321-100000@user2.teleport.com>

On Tue, 17 Nov 1998, Freeness wrote:

> When I run the script in IE i get a 500 Error and "Cannot Open The
> Page".

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.

   http://www.perl.com/CPAN/
   http://www.perl.org/CPAN/
   http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
   http://www.perl.org/CPAN/doc/manual/html/pod/

Hope this helps!

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



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

Date: Wed, 18 Nov 1998 14:55:56 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: perl 5.005_02
Message-Id: <ebohlmanF2MHH8.6A5@netcom.com>

Balazs Rauznitz <prauz@sprynet.com> wrote:
: I've just compiled and installed  Perl 5.005_02 on my linux box. My
: qusetion is where can I find some docs on what's new in Perl 5.005. I
: know there are the Changes files in the distribution, but I don't think
: they are docs. Also why is there not a Changes5.005 which would list the
: deltas from 5.004 to 5.005 ?

perldoc perldelta



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

Date: Wed, 18 Nov 1998 09:37:27 -0600
From: Tom Briles <tbriles@austin.ibm.com>
Subject: Re: Perl Array Question? Anybody...
Message-Id: <3652E9B6.4D2F6BEA@austin.ibm.com>

shazad@my-dejanews.com wrote:

> Hi perl people....

<snip>

> How can I APPEND the second file "rules", so that
> @myarray=("harry","object","rule");
>
> I have tries pop(@mtarray,$a), unshift(@mtarray,$a)...but nothing seems to
> work!!  Anybody!!!
>
> IN SIMPLE ENGLISH!! How can I restore the context of @myarray each time I run
> my script.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

If I understand your question correctly,

perldoc -f push

It's basically the opposite of pop.

- Tom



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

Date: Wed, 18 Nov 1998 16:28:45 GMT
From: xaqtnr@my-dejanews.com
Subject: Scope question for Perl
Message-Id: <72usj3$8gh$1@nnrp1.dejanews.com>

Is there any documentation that will explain in detail how Perl handles the
variables in relation to their scope and persistence. Or maybe someone can
give me a general run-down. I know you can use local/my to declare variables,
but how does this affect their scope? For example in C:

void myFunction();

void main(){
  int x = 10;
  myFunction();
  cout << x;
}

void myFunction(){
  int x = 0;
  cout << x;
}

There are two 'x' variables, but they exist differently since their scope is
within their respective functions. Even the following variables have different
scope as far as I've found in C:

int x = 0;

if (x == 0){
  int y = 0;
}else{
  y++;
}

This will produce a 'undeclared variable' error since the first 'y' variable
is not in the same scope as the one that is incremeted.

How does Perl handle all of this? Are variables only in scope within
respective sub-routines, or are the local/my identifiers needed to restrict
the variable to that function?

Thanks.





--

Shay

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


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

Date: 18 Nov 1998 11:20:32 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Smarter Web Mailer
Message-Id: <72us4g$is1@panix.com>

In <365215B2.625E@courrier.usherb.ca> JTJ <jtjohnston@courrier.usherb.ca> writes:

>I am playing with a Web-Based E-mailer. How do I extract a web address
>in a block of text and replace it with a link:

>-------- Sample message ---------
>here is the link:
>http://somewhere.com
>---------------------------------

>---------- What I want ----------
>here is the link:
><A HREF="http://somewhere.com">http://somewhere.com</A>
>---------------------------------

>I would use a substitution string:

>$message =~ s/???/???/g;

>Something like??

>	$message =~ s/http:\/\/\s*(\w+|$)/????/go;

I must be dense this morning.

Is this what you want to do?
  
  #!/usr/local/bin/perl5
  
  $string = "http://reference.perl.com";
  
  $line   = "<A HREF=$string>$string</A>";
  print "$line\n";

It prints:

  <A HREF=http://reference.perl.com>http://reference.perl.com</A>

-- 
Clay Irving
clay@panix.com


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

Date: Wed, 18 Nov 1998 22:24:21 +0800
From: Jenny Brandis <brandis@benet.net.au>
Subject: Sounds easy when I type it fast
Message-Id: <3652D895.385F282E@benet.net.au>

I know nothing about programming but would like to make my site
interactive with a searchable database and maybe get some user stats.

Sounds easy when I type it fast. <g>

I have asked my ISP what is available in his cgi-bin and was told I
should have my own. So I downloaded STABLE.ZIP to my hard drive.

I made a directory called cgi-bin on my ISP server, above my public
directory as he told me.

Downloaded a couple of scripts that sound ok. (Matt's simple search,
urlsrch.cgi, websearch and intermediate search.)

But now what? I guess I need to upload the (unzipped) stable.zip to my
cgi-bin, but do I need all those files? Or just some that run the bits I
want?

Is it true that with cgi I can't test drive it on my computer like I do
HTML?

Any (helpful) advise would be welcome. 

I guess I should have mentioned that I live in a very small town and to
the best of my knowledge there is no one who can guide me in this. Even
the school teachers are 'out of their area of expertise'.

-- 
Jenny Brandis Meekatharra, Western Australia
Aussie and Kiwi Genealogy http://www.benet.net.au/~brandis/
Research interests:
http://carmen.murdoch.edu.au/community/dps/research/bra01.html


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

Date: Wed, 18 Nov 1998 14:56:33 GMT
From: everybodydies@my-dejanews.com
Subject: Re: test for.t failure due to bad rounding
Message-Id: <72un6l$3fd$1@nnrp1.dejanews.com>

In article <Pine.GSO.4.02A.9811170852420.27321-100000@user2.teleport.com>,
  Tom Phoenix <rootbeer@teleport.com> wrote:
> Well, _if_ my test code was correct and the problem really is the
> stringification, I _think_ that's always done by your system's library
> routines. (Gconvert, gcvt, or sprintf, I believe.) I don't know as much as
> I'd like to know about Perl's internals. So, either those library routines
> are buggy, or Perl is calling them incorrectly, I think.
>
> Check to see what Configure is doing about "how to convert floats to
> strings". (Search for that text.) It may be getting the wrong idea on your
> system. Good luck!

it is, in fact, gconvert which is being used.  unfortunately, it's responsible
for the bad results (see enclosed c code which generates bad output).
now i'm really ticked off.  i can only think that this is a problem with
either solaris 2.5.1 running on old hardware (an ancient ipx), or with the
floating point hardware in the machine itself.  ugh.  i've asked about it on
comp.unix.solaris, but have yet to receive an answer.  anyone here a solaris
expert who could explain why gconvert is flakin' out?

here's the test code:

/*
 * this test program yields these results on a sparc solaris2.5.1 box:
 * 0 1 2 3 3.999999 5 6 7 7.999997 9 10
 */

#include <floatingpoint.h>
#include <float.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
    char buf[28];
    int i;

    for (i = 0; i <= 10; ++i)
      printf("%s ", gconvert(i, DBL_DIG, 0, buf));
    printf("\n");
    return 0;
}

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


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

Date: Wed, 18 Nov 1998 11:03:04 -0500
From: james_peregrino@harvard.edu (James Peregrino)
Subject: Re: User ID problem
Message-Id: <1diorlx.19dqcff1p3lxmuN@dcepf5.harvard.edu>

I tried to email this...but it looks like it came from an unconfigured
newsreader.

Try this (A)  Have your registration page display the ID once the user
succesfully registers.  Put the ID in the cookie.  When the survey form
comes (I assume it is a cgi too), have it read the ID from the cookie
and place it into an editable text field.  Should there be no cookie,
you now have a blank field where the user can go back and type in to
cookie by hand.

Try this (B) Have the registration program create the survey page too.
Pass the ID as a hidden field.

In any case, I think it means deviating from the simple two HTML pages
and two cgi's that just respone to METHOD=POST.

-James
<email@address.com> wrote:

> Hello-
> 
> I have an online survey in the works. There are 2 scripts, one to
> register users, and one that collects the survey data to a file. The
> survey data must be blind, so I have to assign ID's to each of the
> users when they register. The output file has their answers to the
> survey and their ID. The registration script assign's the ID and
> writes the name and ID to a seperate file so it can be matched up
> later with the survey results.
> 
> Right now, the user stores their Name and ID in a cookie--which works
> fine. However, if the user does not support or rejects cookies, I am
> screwed. The data collection script has no way to know the user's name
> or what their ID is. 
> 
> Anyone have any clever ideas how to circumvent the problem? The
> registration part must be on a seperate page as the survey itself. I
> would prefer not to reject those users who do not support or reject
> cookies.
> 
> Thanks in advancel.
> 
> GJB


-- 
 James Peregrino                                 (617)496-6288 (v)
 Manager of Comp. Services                       (617)495-5685 (f)
 Harvard Div. Cont. Ed.
 james_peregrino@harvard.edu


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

Date: 18 Nov 1998 07:33:07 GMT
From: "ps" <as@asd.asd>
Subject: writing to file on winnt perl cgi
Message-Id: <01be12cd$af1e8080$630de00a@pchelp2nt>

hi all 
do you know way the following line wont work on winnt Perl cgi script?

open (FILE,">$FullPath\\Filename.ext") or die
print FILE, "string";
For some reason I cant Opens the file for writing using this method 
$fullPath is the absolute path to the directory in which I got the files.
thanks
Zohar



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

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

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