[9466] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3060 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 4 15:08:00 1998

Date: Sat, 4 Jul 98 12:00:25 -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           Sat, 4 Jul 1998     Volume: 8 Number: 3060

Today's topics:
    Re: Editeurs pour Perl? (NRE)
        first mess up <computalk_internet@msn.com>
    Re: first mess up (Ronald J Kimball)
    Re: first mess up (Tad McClellan)
    Re: HELP: Problem building Perl5 on Cygnus target (Bbirthisel)
    Re: limits of glob() ? <dtbaker_@flash.net>
    Re: limits of glob() ? <tchrist@mox.perl.com>
    Re: my perl object becomes a HASH when I try to use it. <rootbeer@teleport.com>
    Re: NEED HELP: forwarding email to PERL script <rootbeer@teleport.com>
        passing javascript var in perl cgi <yan@wwisp.com>
    Re: PERL + File Downloads <rootbeer@teleport.com>
    Re: Perl Editor for Windows NT ? (Bbirthisel)
    Re: Perl Editor for Windows NT ? (NRE)
    Re: Perl, IIS 4.0 - PLEASE HELP! <rootbeer@teleport.com>
    Re: replacing search variable in foreach <rootbeer@teleport.com>
    Re: replacing search variable in foreach (Ronald J Kimball)
    Re: Script displaying IP address and hostnames? <rootbeer@teleport.com>
    Re: Script displaying IP address and hostnames? <flavell@mail.cern.ch>
        Seeking programer for hire on small freelance project ( <mickael@adarweb.com>
        size limit on array ? <rferr@voicenet.com>
    Re: Uploading image files <rootbeer@teleport.com>
    Re: Uploading image files <rootbeer@teleport.com>
    Re: Why no Perl news/mailreader? <tchrist@mox.perl.com>
    Re: Win32 Modem driver (Bbirthisel)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sat, 04 Jul 1998 00:50:21 +0000
From: "David T. Bath (NRE)" <david.bath@nre.vic.gov.au>
Subject: Re: Editeurs pour Perl?
Message-Id: <359D7C4D.726A7327@nre.vic.gov.au>

CRETEL Dominique wrote:
> 
> Bonjour tout le monde,
> 
> Je sais, cela doit etre la n-ieme fois que quelqu'un parle de cela!
> 
> Mais, etant un nouvel utilisateur de Perl, j'aimerais savoir si il exite
> un bon editeur pour Perl, si possible freeware, ou il y aurait une aide
> en ligne sur les mots clis de Perl (ex: Shift F1 sur le mot cle GREP).
> 
> Merci de votre aide,
> Dominique Cretel

Je ne parle pas francais bon.
Quel systeme d'operation : Unix, Microsoft ?
Quel systeme de fenetre: X-windows, MS-Windows, zero ?
Peut etre Xemacs (ftp.gnu.org) ou Nedit (ftp.fnal.gov) ?

-- 
David T. Bath (from home) david.bath@nre.vic.gov.au
Phone: +613 9500 0894    Mobile: 015 824 171 (not always on)
Office: Global Consulting Ph:+613 9347 7511    Fax:+613 9347 0182
#include <std_disclaim.h>


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

Date: Sat, 4 Jul 1998 11:10:25 -0500
From: "Howard Dierking" <computalk_internet@msn.com>
Subject: first mess up
Message-Id: <ew2PVV2p9GA.294@upnetnews03>

Hi all,
I'm just starting to learn Perl and have of course already gotten stuck--I'm
trying to take a field from an HTML form and simply check to see if the
entry from the form matches any members of an array of file handles that I
eventually will have another perl file modify.  However, I can't even get
the thing to validate one that I have already put into the array.  I'm
getting an Internal Server Error message--and at this point, I fear that
this may just be a nice way of saying, "something's wrong with your code."
I've pasted the code below.  Please let me know if you see anything wrong.
Thanks,
howard
#!usr/bin/perl
#
# validateid.pl
#
# this perl program will take the input from the user concerning
# the registration key, will check against an array of file handles
# (those file handles will be the name given by the TRI people)
# in the same file that holds the file handles array, there will be
# another array that holds the locations of the files for those file
# handles.  If the user input matches one of the elements of the handles
# array, then the element of the same index value will be pulled off of the
# locations array and printed
use CGI qw(:standard);
my $key = param("reg_key");
@handles=("BETA");
@locations=("http://www.eventresponse.com/event1.html");
for ($i=0; $i<=@handles; $i++)
{
  if ($key eq @handles[$i])
  {
    my $url = @locations[$i];
    last;
  }
}
if ($url eq "" || $url eq "0"){
  $url = "http://www.eventresponse.com/wrong_id.html";
  print $url;
  }
else{
  print$url;
  }





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

Date: Sat, 4 Jul 1998 13:23:44 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: first mess up
Message-Id: <1dbn72n.agcexxkbqvuqN@bay2-131.quincy.ziplink.net>

[posted and mailed]

Howard Dierking <computalk_internet@msn.com> wrote:

> if ($url eq "" || $url eq "0"){
>   $url = "http://www.eventresponse.com/wrong_id.html";
>   print $url;
>   }
> else{
>   print$url;
>   }

I assume you have tested your script to make sure it compiles...

You never output a proper HTTP header.  The browser doesn't know what
it's getting.  You need something like
print "Content-type: text/html\n\n";

But, since you're using CGI.pm, this would be better
$query = new CGI;                # near the top of your script
print $query->header;            # also near the top of your script

Or, if you're trying to redirect the browser to another location
print "Location: $url\n\n";

But, since you're using CGI.pm, this would be a better
$query = new CGI;                # near the top of your script
print $query->redirect($url);    # somewhere in the script

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sat, 4 Jul 1998 12:14:45 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: first mess up
Message-Id: <5unln6.26f.ln@localhost>

Howard Dierking (computalk_internet@msn.com) wrote:

: I'm just starting to learn Perl and have of course already gotten stuck--I'm
: trying to take a field from an HTML form and simply check to see if the
: entry from the form matches any members of an array of file handles that I
: eventually will have another perl file modify.  However, I can't even get
: the thing to validate one that I have already put into the array.  I'm
: getting an Internal Server Error message--and at this point, I fear that
: this may just be a nice way of saying, "something's wrong with your code."
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


Right.

You first add a -w switch to your shebang line, and second go see what
error messages it put into your server's error log.

(how to access your error log is not a Perl question, ask your 
administrator, or see the CGI FAQs.)


: I've pasted the code below.  Please let me know if you see anything wrong.
: Thanks,
: howard
: #!usr/bin/perl

   #!usr/bin/perl -w

   Enable warnings.

   Let perl help you find your mistakes.


: @handles=("BETA");
: @locations=("http://www.eventresponse.com/event1.html");
: for ($i=0; $i<=@handles; $i++)
               ^^

@handles is in a scalar context here, so it will return the number of
elements in the array ( 1 in this case).

So $i goes from zero through one.

Uh oh, you walked off the end of the array...

You want either:

   for ($i=0; $i<@handles; $i++)    # @handles returns the number of elements

OR

   for ($i=0; $i<=$#handles; $i++)  # $#handles returns the index of the
                                    # last element

: {
:   if ($key eq @handles[$i])


The -w switch would have complained about an uninitialize variable 
(when $i=1) if you had turned it on...

It would also have complained about using that array slice there.

See? 

You have two errors in your script. 

Perl would have pointed them both out to you if you had asked it to...

You should always, yes always, enable warnings with the -w switch.


:   {
:     my $url = @locations[$i];
                ^^^^^^^^^^^^^^

Here is an array slice again. Make that three problems that -w would
have found for you  ;-)

You want a single scalar there, not an array slice:

   my $url = $locations[$i];
             ^
             ^


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


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

Date: 4 Jul 1998 16:48:54 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: HELP: Problem building Perl5 on Cygnus target
Message-Id: <1998070416485400.MAA18939@ladder01.news.aol.com>

Hi Jonathan and Cretel:

>gcc2 is a shell script I think - if it is and you look at it you will
>find that the #! line points to a non-existent interpreter : check the
>path to your version of bash.

The README file for Cygnus in the perl source distribution used to
suggest that you create a distinct "/bin" directory and move a couple
of things including "gcc2" into it. I don't have the lastest version in
front of me - but I suspect a similar recommendation still exists.

-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)


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

Date: Sat, 04 Jul 1998 11:45:24 -0500
From: Dan Baker <dtbaker_@flash.net>
Subject: Re: limits of glob() ?
Message-Id: <359E5C24.98@flash.net>

Tad McClellan wrote:
> 
> Dan Baker (dtbaker_@flash.net) wrote:
> : I've read that using glob() to return a list of items has limitations
>   ^^^^^^^^^
> : with "large numbers" of items....
> 
>    Did you read it in 'perlop'?
> 
>    "Furthermore, due to its current implementation of using a shell,
>     the glob() routine may get "Arg list too long" errors (unless
>     you've installed tcsh(1L) as /bin/csh)."
> 
> : What IS the limit?
> 
>    It depends on the shell, not on perl.
-------
how about on win32?





> 
> : i.e. when should I
> : consider using opendir(), readdir(), closedir()?
> 
>    Always.
> 
>    Assuming that you always want the most robust and portable way
>    of coding up stuff  ;-)
> 
> : A related topic that I've been wondering about is whether there is any
> : *significant* difference using glob() versus the magic <*>.
> 
>    Did you even look up glob() in the 'perlfunc' man page?
---------
no, I was looking the Oreilly "learning Perl on win32"


>    C'mon, use the docs Luke...
------------

sorry, haven't memorized the docs yet!  I have 5 different books I look
at, and none of them had good answers on these topics, so I thought I'd
ask. The problem is WHICH doc to look at!

Dan



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

Date: 4 Jul 1998 18:17:33 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: limits of glob() ?
Message-Id: <6nlrjt$qoo$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    dtbaker_@flash.net writes:
:sorry, haven't memorized the docs yet!  I have 5 different books I look
:at, and none of them had good answers on these topics, so I thought I'd
:ask. The problem is WHICH doc to look at!

The first stop should *always* be grepping the standard docset that's
included with every Perl distribution and electronically searchable.
The second stop should be some book with Larry's name on it. :-)

--tom
-- 
    I don't believe it's written in Perl, though it probably
    ought to have been.  :-)
	--Larry Wall in <1995Feb21.180249.25507@netlabs.com>


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

Date: Sat, 04 Jul 1998 16:42:42 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: my perl object becomes a HASH when I try to use it. please help
Message-Id: <Pine.GSO.3.96.980704093935.21492O-100000@user2.teleport.com>

On 3 Jul 1998, Stephen Riehm wrote:

> Here's a bit of test code: (the real code is an eval which ends up
> being the same - and displays the same results)
> 
> 	my $ref = $self->{"platforms"}{$Pkg::Overview::platform};
> 	print "ref is a ", ref( $ref ), "\n";
> 	# print $ref->get( "package_dir" ), "\n";

It would help if this were a stand-alone example. As it is, I'm not sure
where the problem is. Can you make a stand-alone example which is no
longer than a dozen lines or so? Thanks! 

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




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

Date: Sat, 04 Jul 1998 16:08:05 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: NEED HELP: forwarding email to PERL script
Message-Id: <Pine.GSO.3.96.980704085956.21492K-100000@user2.teleport.com>

On Fri, 3 Jul 1998 GSoup@yahoo.com wrote:

>         open (OUT, ">>testfile.txt");

Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.

> sub GetEmail {
>         while (<>) {
>                 last if /^$/;
>                 push (@headers,$_);
>                 $header .= $_;
>                 ($field, $value) = /^(\S*)\s*(.*)/;

That's not the way to identify a proper header; see the RFCs or use a
module. 

>                 if (length($field) > 1) {
>                         $fields{$field} = $value;
>                 }
>                 else {
>                         $fields{$field} .= " $value";
>                 }

That is, if $field is an empty string, you'll still use it as a hash key? 
That's probably not what you want. This is another good reason to use
somebody's already-debugged code from a module.

> sub CheckSubject {
>         my $local_subject = shift(@_);
>         if ($local_subject =~ /PERL TEST/) {
>                 return 0;
>         }
>         else {
>                 return 1;
>         }
> }

Nothing _wrong_ wrong with that, but if you're only trying to return a
true/false value, you could use this:

    sub CheckSubject {
	$_[0] !~ /PERL TEST/;
    }

In general, more concise code is faster to maintain and debug. Although
this principle can be taken too far. :-)

Hope this helps!

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



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

Date: Sat, 04 Jul 1998 10:45:23 -0400
From: Yan Zhu <yan@wwisp.com>
Subject: passing javascript var in perl cgi
Message-Id: <359E4003.596B@wwisp.com>

hi all:
	I have a cgi in perl creates a dynamic html. the html page includes
javascript which get cookie values from the client. My question is, how
do I take the value of the cookie and stick it into a perl variable?
	thanks a lot.
	email if possible please. :)

yan


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

Date: Sat, 04 Jul 1998 16:45:17 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: PERL + File Downloads
Message-Id: <Pine.GSO.3.96.980704094353.21492P-100000@user2.teleport.com>

On Fri, 3 Jul 1998, John J. Straumann wrote:

> I distribute software via the WWW and would like to combine a file
> download anchor with a call to a PERL function. I would like the action
> to be that when the user clicks the download button, the PERL script is
> called (writing out ENV stuff) and the file downloads...

If you want a browser to call your program, check out the docs, FAQs, and
newsgroups about browsers and related issues. If you want a server to call
your program, check out the docs, FAQs, and newsgroups about servers and
related issues. Hope this helps!

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



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

Date: 4 Jul 1998 17:08:45 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: Perl Editor for Windows NT ?
Message-Id: <1998070417084500.NAA20931@ladder01.news.aol.com>

Hi Jonathan and Jeremy:

>> > Does anyone know of any Editor (best would be freeware) for Windows
>> > NT that understands Perl Syntax ?
>> 
>>   http://www.cs.washington.edu/homes/voelker/ntemacs.html
>> 
>> But before you go there, you should take a moment to use DejaNews to
>> search for the inmnumerable times this question has been asked and
>> answered in this newsgroup.  You'll get plenty of information that
>> way.

It looks like, as of last week, ActiveState has stepped up to the
task of updating the Perl_for_Win32_FAQ and providing archives
of the Perl-Win32-Users list. Since this is certainly one of the highest
traffic questions on that list, you might also want to check:

#### http://www.activestate.com

-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)


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

Date: Sat, 04 Jul 1998 00:34:19 +0000
From: "David T. Bath (NRE)" <david.bath@nre.vic.gov.au>
To: Chris Wareham <chris.wareham@blackwell.co.uk>
Subject: Re: Perl Editor for Windows NT ?
Message-Id: <359D788B.149B829C@nre.vic.gov.au>

Chris Wareham wrote:
> 
> Uwe Hauck wrote:
> >
> > Hello !
> > Does anyone know of any Editor (best would be freeware)
> > for Windows NT that understands Perl Syntax ?
> 
It may be overkill, but my favorite GUI editor is NEdit (from a
SunSite near you) - from FermiLabs.  OK, it runs under X, but
with recent free X for NT, that might not be a problems.
You'd probably have to build it with GNU using cygnus libraries.
Maybe they've got a Win32 version, but I doubt it - Its VERY
X/Unix savvy.

While I use vi a *LOT* (and love it), and am to a certain
extents GUI-phobic (aparts from liking lots of xterms on my
desktop), NEdit (and TkDesk) are my constantly-used GUI tools.

Features:
	Configurable syntax highlighting for a host of languages
		Can add in your own.
		Can force language mode
			Handy for perl scripts that write HTML
	Can send/receive output from subprocesses
		A bit like vi bang-bangs, but you can put them
		on your menu - e.g. "Throw this out through
		perl to a new window so I can see where the
		errors are".
	Knows regular expression stuff really well, stacking
	previous search/replaces
Cons:
	You've got a lot of infrastructure to put in
Pros:
	Once you've put the infrastructure in, you'll be able to
	develop PORTABLE stuff using GNU.
-- 
David T. Bath (from home) david.bath@nre.vic.gov.au
Phone: +613 9500 0894    Mobile: 015 824 171 (not always on)
Office: Global Consulting Ph:+613 9347 7511    Fax:+613 9347 0182
#include <std_disclaim.h>


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

Date: Sat, 04 Jul 1998 16:33:59 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl, IIS 4.0 - PLEASE HELP!
Message-Id: <Pine.GSO.3.96.980704093052.21492N-100000@user2.teleport.com>

On Fri, 3 Jul 1998, Kai Chan wrote:

>     I've just installed the latest version of perl and IIS 4.0. The perl
> scripts runs fine on the command line with the correct output, but when
> I run it through a browser, there's no output, e.g. script
> 
> $foo = `dir`;
> print "$foo";
> print "bar";
> 
> On the command line it prints out the current directory and bar, while
> on the browser it only prints out bar. 

When you say "the current directory", what do you mean? The CGI protocol
specification doesn't promise that your script will be started with any
particular working directory.

Of course, this applies just as well if your program isn't written in
Perl. 

Hope this helps!

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



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

Date: Sat, 04 Jul 1998 16:47:33 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: replacing search variable in foreach
Message-Id: <Pine.GSO.3.96.980704094608.21492Q-100000@user2.teleport.com>

On Sat, 4 Jul 1998, it was written:

> What's your hangup with return values?  I never use return
> values, and my programs work great.  

I've never used my spare parachute, and I've survived every skydive.

Cheers!

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



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

Date: Sat, 4 Jul 1998 13:23:49 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: replacing search variable in foreach
Message-Id: <1dbn7j0.o3uz2til4myoN@bay2-131.quincy.ziplink.net>

- <root.noharvest.\@not_even\here.com> wrote:

> >> foreach $position(@position) {
> >>   open(FILE, "$section");
> >
> >It's unlikely (but possible) that you want to open a new file each time
> >through the loop. It's more likely that you want to open it once, outside
> >the loop. (You may or may not want to seek to the beginning in each
> >iteration.) 
> 
> Perhaps he's grep'ed a directory into @position, and now he's
> accessing each file looking for something?

Then why is he opening the filehandle on the $section variable, and not
the $position variable?

> >Of course, those double quotes are merely misleading. And even when your
> >script is "just an example" (and perhaps especially in that case!) you
> >should _always_ check the return value after opening a file. 
> 
> Do you have this on some kind of macro?  It's the same wording every
> time!!!  What's your hangup with return values?  I never use return
> values, and my programs work great.  

I'll be watching for a post from you like this...

---
Why doesn't this script work?

open FOO, "/this/file/probably/doesn't/exist";
while (<FOO>) {
  &do_something_really_cool;
}
---

 ...just so I can laugh my ass off at you.  I can understand someone not
checking the return value of open because he doesn't know any better,
but it takes a real idiot to know better and still not check return
values.

I notice you also hard code the socket define values
<35963800.149945650@news2.cais.com>, ignore case-sensitivity in module
names <358b0cb2.249309455@news2.cais.com>, and are ignorant of sprintf
<3581a69b.16861879@news2.cais.com>.

One of your "excuses" for never checking the return value of open is
that you generally write CGI scripts, and you don't care if the open
fails because you don't want the user to see an error message in their
browser.  In <358c395f.45979179@news2.cais.com>, your script is a mail
filter, not a CGI script.  If the open fails, the mail is lost
irretrievably, but hey, who cares, right?

Tom Phoenix helps newbies more often and more politely than anyone else
on this newsgroup, and your vendetta against him is ignorant and
misguided.

What exactly do you have to recommend you as a Perl programmer, anyway?

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sat, 04 Jul 1998 16:50:41 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Script displaying IP address and hostnames?
Message-Id: <Pine.GSO.3.96.980704094911.21492S-100000@user2.teleport.com>

On Sat, 4 Jul 1998, F.Quednau wrote:

> print "Content-type: text/html\n\n";
> foreach $key(keys %ENV) {
>   print "$key = $ENV{$key}";
> }

I think you wanted to use a different content-type to indicate plain text,
since your output isn't HTML. And a newline in the output wouldn't hurt,
either.  :-)  Cheers! 

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



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

Date: Sat, 4 Jul 1998 18:34:24 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Script displaying IP address and hostnames?
Message-Id: <Pine.HPP.3.95a.980704183236.21460I-100000@hpplus20.cern.ch>


On 4 Jul 1998, Randal Schwartz wrote:

> add:
> 
> 	use HTML::Entities;

I might've known there'd be a module.

> Alan> Oh well, in perl there's always several ways of doing it...
> 
> Of course.  Some of them are more robust than others. :)

You bet - I failed to "entify" the text.  Beware the quick hack.
(Scuttles off back to ciwah...)

Sorry.



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

Date: Sat, 04 Jul 1998 18:51:56 +0200
From: mickael <mickael@adarweb.com>
Subject: Seeking programer for hire on small freelance project (perlxstut)
Message-Id: <359E5DAC.E0FF0F4B@adarweb.com>

Hello,

My name is Mickael, I run a small web hosting co. We have
signed up to a program (proposed by a local bank) that will
allow ours customers to sell goods via the bank secured server.

I need to have a shopping cart (already written in Perl)
connected to a small C module given to us by our bank (see
below) 

perlxstut job

Our server runs on Solaris 2.61.  I was told that what we
really need is as follow (technical description)

- Call an existing library/executable from perl (or other cgi
type script)
- Some scripting to post and display form data based on user
input and return values from the function call.

I am eagerly searching for someone who will be able to do this
for hire very rapidly!!

Here is one of the files the bank gave us (the other is
compiled), I also have about 5 pages of description from the
bank that I will fax promptly to you upon request

Thank you for responding to mickael@adarweb.com

Mickael



extern int TestMAC (char *code_MAC,
     char *version,
     char *TPE, (Terminal payment machine)
     char *cdate,
     char *montant, (amount to be charged)
     char *ref_commande, (order reference)
     char *texte_libre, (free text whatever that means...)
     char *code_retour); (return status code)

extern void CreerFormulaireCM (char *url_CM, (creation form)
        char *version, (version)
        char *TPE, (Terminal payment machine)
        char *montant, (amount)
        char *ref_commande, (order reference)
        char *texte_libre,(free text whatever that means...)
        char *url_retour, (return URL)
        char *url_retour_ok, (return URL ok)
        char *url_retour_err,(error return URL)
        char *langue, (language)
        char *code_societe, (company)
        char *texte_bouton, (Text button)
        char *formulaire); (form)

/* Generation of response by weshop  */
(response created by the seller)
/* to the banl Credit Mutuel                                 */
extern void CreerReponseCM (char *phrase, (create phrase
response)
     char *reponse);


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

Date: Sat, 04 Jul 1998 18:34:33 GMT
From: "rferr" <rferr@voicenet.com>
Subject: size limit on array ?
Message-Id: <01bda77a$c00bf620$083847d1@rferr.voicenet.com>

i am performing the following command in my perl script:

@matches =  egrep -i -l '$user' dirname;. 

if (! $matches[0])
   {
     &nofound;
   }

this code works fine as long as the number of files in the search dir
doesnot exceed
a certain number. if i go above around 350-400 files it doesnt work. due to
the
nature of the files, i cant split the dir up. i can grep
from the command line and get the correct response. anyone see any problems
or
solutions?

thanks.


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

Date: Sat, 04 Jul 1998 16:16:22 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Uploading image files
Message-Id: <Pine.GSO.3.96.980704091331.21492L-100000@user2.teleport.com>

On Sat, 4 Jul 1998, Toby Chamberlain wrote:

>  A: Can't locate CGI.pm in @INC at ./setdat.cgi line2

Your perl is either over a year old or improperly installed. Don't
complain to us about that! :-)

> B: Because I like to know how things work sometimes, so if I need or
> want to do something different I can. 

You should look at the modules to see how they do it. If you're wanting to
do it all from the absolute beginning, start with the protocol
specifications.

> is there any reason why CGI.pm would be able to read data that is
> invisible to a non-CGI.pm script?? 

No, there's nothing magical about CGI.pm. But if it's working any your
code isn't, that's a big clue about where a bug may be found. :-)

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



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

Date: Sat, 04 Jul 1998 16:29:29 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Uploading image files
Message-Id: <Pine.GSO.3.96.980704091705.21492M-100000@user2.teleport.com>

On Fri, 3 Jul 1998, Toby Chamberlain wrote:

> #!/usr/bin/perl
> binmode STDIN;
> binmode STDOUT;
> binmode STDERROR;

That's not very STD. :-)  But are you sure you want binmode there? binmode
is for binary files, and STDIN and friends are (or should be) text. (Well,
I could see STDIN and STDOUT being non-text, possibly, but STDERR should
be just plain text.)

> @LINES = <$GIFFILE>;

I don't think that's what you mean.

> chmod (664, $LOCALGIF);

I'm sure that's not right.

>     # Get Name/Value pairs and decode....
>     foreach ($in =~ /\sname="([^\s]+)"[;\s]+filename="([^\s]+)"[;\s]/g) {

You should (as others have told you) be using a module or other debugged
code for this. Not only would that be easier...

>         $name = $1;
>         $name =~ s/\+/ /g;
>         $name=~ s/%(..)/sprintf("%c",hex($1))/ge;
> 
>         $value = $2;

 ...but it might actually work. :-)

>         $value=~ s/%(..)/sprintf("%c",hex($1))/ge;
>         $value =~ s/\+/ /g;

If you choose to write your own code for this sort of thing, be sure
you're following the protocol specification. But don't just cut-and-paste
someone else's buggy code without understanding it. You aren't saving any
time by doing that!

I recommend that you use the perl debugger to debug your code from the
command line before you install it as a CGI program. You should use -w
warnings (at least while developing your code), and you should use 'use
strict' always. Good luck!

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



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

Date: 4 Jul 1998 17:17:52 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why no Perl news/mailreader?
Message-Id: <6nlo40$fia$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    gebis@albrecht.ecn.purdue.edu (Michael J Gebis) writes:
:I don't know how many times I've wished that exmh was written in perl,
:not tcl.

There is plum.

--tom
-- 
_doprnt(pat, args, &fakebuf); /* what a kludge */
    --Larry Wall, from util.c in the v5.0 perl distribution


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

Date: 4 Jul 1998 16:41:07 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: Win32 Modem driver
Message-Id: <1998070416410700.MAA18676@ladder03.news.aol.com>

Hi Paul and David:

>Paul, Dee & Mark Gardner <paul.gardner3@virgin.net> wrote:
>> I would like to use the Win32 distribution of perl to write 
>> a modem driver routine. Having managed to redirect the 
>> serial port as desbribed in a recent FAQ, I can find no way of setting the
>> protocol settings (baud rate, parity, stop bits) for the PC's COMM port.

>Have a look at the Win32::SerialPort module on CPAN.
>David  

Not quite yet on CPAN. The beta will get there, but I want to test
on AS build 469 (released last Thurs.) and Win98 first so I can
document any new issues. The exact namespace is still not firmly
resolved. I've been using Win32API:: instead of Win32::. But I will
follow the CPAN administrators preference when the code is
uploaded.

In the interim, try alpha 4 (Version 0.08). It runs on Win95 and NT.
There are a lot more options than baud, parity, stop - but if you were
thinking about Posix.pm, than copious options are'nt an issue ;-)
For a modem driver, you'll need good docs on your modem. Most
of the TAPI stuff isn't supported (and may not be in THIS module -
a TAPI module which inherits from this one may be a better layout).

You can get the alpha at:

### http://members.aol.com/Bbirthisel/alpha.html

You'll also need Aldo Calpini's Win32::API module if you don't
already have it. Alphas 3 and 4 have both been very stable. The
beta will add a couple of functions, expand the examples, and
extend the documentation (including a first cut at a tutorial).

SerialPort is currently "100% pure but convoluted perl" (nothing
applied for) - mostly to allow use with 5.003. So you can find (and
fix) anything wrong. And I like feedback, too: good, bad or ugly.

Good Luck:

-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)


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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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