[10990] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4590 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 8 13:07:22 1999

Date: Fri, 8 Jan 99 10:00:17 -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           Fri, 8 Jan 1999     Volume: 8 Number: 4590

Today's topics:
    Re: "internal server error" (Bart Lateur)
    Re: "internal server error" (John Moreno)
    Re: Absolute Yuck <aqumsieh@matrox.com>
    Re: ActivePerl cgi problem (Bill Moseley)
    Re: ActivePerl cgi problem <UseNet@WebDude.FreeServe.CO.UK.CutThis>
    Re: Beginner problem (Clay Irving)
    Re: Does MacPerl live here too? <Arved_37@chebucto.ns.ca>
    Re: Global variables and use strict question (M.J.T. Guy)
        Gratuitous warnings when statting files with newlines <hniksic@srce.hr>
    Re: Gratuitous warnings when statting files with newlin (Greg Ward)
    Re: Matching binary strings (Tad McClellan)
        ODBC Drivers Andy.Fry@netserv.net
    Re: Passing hashes to a sub <aqumsieh@matrox.com>
    Re: Password Encryption (Martin Vorlaender)
    Re: Perl on Apache 1.3.3 running on Windows 95/NT <UseNet@WebDude.FreeServe.CO.UK.CutThis>
    Re: Why Is Perl not a Language? (Bart Lateur)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 08 Jan 1999 16:52:15 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: "internal server error"
Message-Id: <369735b1.700623@news.skynet.be>

Eirik Johansen wrote:

>I've just started learning Perl and I recently modified a CGI-skripy,
>but now it won't work and I don't know why.

Probably a syntax error. Try adding this to your script. At least it'll
tell you some more.

  BEGIN {
	$| = 1;
	$SIG{__WARN__} = sub { 
	 $headerPrinted ||= do { print "Content/type: text/plain\n\n"};
	 print @_;
	};
	open STDERR,'&STDOUT';
 }

If you STILL get nothing, the path in the "#!" line may be incorrect.
And do add the "-w" at the end of that line.

	Bart.


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

Date: Fri, 8 Jan 1999 12:22:57 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: "internal server error"
Message-Id: <1dlbb4u.1ke18dt1e3an6hN@roxboro0-055.dyn.interpath.net>

Tony Greenwood <paxton@cyberstrider.org> wrote:

> ** CyberSTrider Web Services http://web.cyberstrider.net ** 
>  
> 
> >> >Let's see.... you don't have -w, you don't have "use strict", you do
> >> 
> >> Niether do I.. what do they do ?
> >
> >Gives warning message on suspect code and enforces a stricter syntax.
> 
> haaa fanx

I don't know if I'm responding to a well done troll or you're simply
being difficult.   I'll give it one more try.

> >> >everything yourself instead of using modules written by people with a
> >> 
> >> Same here.. I still don't understand what a module is or how to use
> >> them
> >
> >"use" them and then call their functions, fairly simple.
> 
> I said I don't know how to use them.. your answer to use them is
> therefore a little confusing

"use" is similar to the C #include (or at least that's good enough to
get you started in the right direction).

use CGI;

is probably what was being referred to, in the above modules statement.


> >> I "think" I have the appropriate enviroment though so I am one up on
> >> the original poster :)
> >
> >Trying to learn perl by doing CGI programming (especially for someone
> >with no programming experience) is like trying to learn to ride a
> 
> I have ten years programming experience... you are having a bad day
> arn't you

No, and this wasn't directed at you -- you I assumed were learning by
doing regular programming (and that that was what you were referring to
when saying that you were using the appropriate environment).
 
> >> >Please crawl under a rock and wither away. You make me sick.
> >> 
> >> Hmm not the best sig I ever came accross...
> >
> >Not a sig or it would have been preceded by a proper sigdash (two dashes
> >followed by a single space on an otherwise blank line).
> 
> I see humour goes right over your head...Whoooosh!

Sometimes.

> >> .
> >> BTW it isn't sarcasm.. I really don't know the answers to the above..
> >> .
> >Then you need to read some more.
> 
> I agree, I just hope I don't have to read bad mannered posts too often

What you need to read isn't post, bad mannered or good.  What you need
to read is the perl documentation and maybe a book or two.

> >>      Cheers.....!ynoT 
> >>  CyberSTrider Web Services
> >> http://web.cyberstrider.net
> >
> >You seem to be missing a sigdash, would you like to borrow one?
> 
> What for?

The sigdash is how newsreaders recognize that what follows is a sig,
most commonly this is used to exclude it when replying, but that's not
all that it can be used for, but automation of something depends upon
recognition of it.

> Thanks for your response, but your post was of no help at all, however
> I think you already knew that, this would leave me to wonder why you
> posted it, sarcasm, an attempt to have a go at me, perhaps to look
> clever, well didn't that backfire :)
> 
> Now shall we drop this before you show yourself up anymore?

Either you are jerking me around or you took it for an attack for some
reason, I don't know why you'd do either.

-- 
John Moreno


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

Date: Fri, 8 Jan 1999 11:02:02 -0500 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Absolute Yuck
Message-Id: <x3yg19l7nyq.fsf@tigre.matrox.com>


comdog@computerdog.com (brian d foy) writes:

> 
> In article <369573A7.DE35FB1D@SiTera.com>, Todd LaWall <toddl@SiTera.com> posted:
> 
> > JTJ wrote:
> 
> > > $1 = @inputData;
> > > $1 =~ s/[TypeOfCard]/$in{'TypeOfCard'}/go;
> > 
> > Hmmmm, you can't do this, and I see another problem with what you've
> > coded.  You are trying to do a substitution on the $1 variable,
> > which another poster already stated is a reserved variable, but it
> > is also in how you are assigning a value to the $1 variable which 
> > bothers me.  See, the only value you would have in the $1 variable
> > would be an integer, since you are not specifing a specific element
> > of the @inputData array.
> 
> careful now - one cannot assign to $1.

He said that already. Read the second sentence in the above
paragraph. Do you usually read from the middle of posts?



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

Date: 08 Jan 1999 17:08:16 GMT
From: moseley@best.com (Bill Moseley)
Subject: Re: ActivePerl cgi problem
Message-Id: <36963b80$0$19116@nntp1.ba.best.com>

In article <775am9$8qr$1@nnrp1.dejanews.com>, jim@researchdesk.com says...
>
>When I try to use ActivePerl for a cgi, I get:
>
>Internal Server Error

and 

>malformed header from script. Bad header=: d:/apache/cgi-bin/cgitest.cgi


In perlfaq9
   "My CGI script runs from the command line but 
    not the browser. (500 Server Error)"


Is your script writing the "Content-type: text/html" header?


>The perl script runs fine standalone and the html produced ( I put the html in
>a file) looks fine when I bring it up in a browser by accessing the file.

The script must output more than what is displayed in your browser.  That's
not an indication that your script is working correctly.


--------------
Bill Moseley
moseley@best.com



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

Date: Fri, 8 Jan 1999 17:16:05 -0000
From: "Hywel Jenkins" <UseNet@WebDude.FreeServe.CO.UK.CutThis>
Subject: Re: ActivePerl cgi problem
Message-Id: <36963e60.0@news.star.co.uk>

Have you included
    print "Content-tyoe: text/html\n\n";
as the first output to the browser?

--
Hywel Jenkins
"I, too, have a job, a mortgage and a pension."
http://hyweljenkins.com/
Remove '.CutThis' from address to reply

jim@researchdesk.com wrote in message <775am9$8qr$1@nnrp1.dejanews.com>...
>When I try to use ActivePerl for a cgi, I get:
>
>Internal Server Error
>The server encountered an internal error or misconfiguration and was unable
to
>complete your request.
>Please contact the server administrator, you@your.address and inform them
of
>the time the error occurred, and anything you might have done that may have
>caused the error.
>
>malformed header from script. Bad header=: d:/apache/cgi-bin/cgitest.cgi
>
>
>
>---------------------------------------------------------------------------
-----
>
>Apache/1.3.3 Server at localhost Port 80
>
>The perl script runs fine standalone and the html produced ( I put the html
in
>a file) looks fine when I bring it up in a browser by accessing the file.
>
>Any help ?
>
>thanks
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own




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

Date: 8 Jan 1999 12:47:44 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Beginner problem
Message-Id: <775gc0$g7f@panix.com>

In <3695B07C.582BFDA2@netvigator.com> Alex <ex5316@netvigator.com> writes:

>Please help
>In order to learn perl, I get my own virtual hosting. It can use now.
>However when I put my first simple script (test.pl) to the cgi-bin
>directory for testing. It
>don't work. I check and try everything many many times, e.g.change Unix
>mode , ASCII, etc....but it's still not work.
>The script is simply:

>#!/usr/local/bin/perl
>print "content-type: text/plain\n\n";
        Content-type:

>print "This is a test";

-- 
Clay Irving
clay@panix.com


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

Date: Fri, 8 Jan 1999 13:55:11 -0400
From: Arved Sandstrom <Arved_37@chebucto.ns.ca>
Subject: Re: Does MacPerl live here too?
Message-Id: <Pine.GSO.3.95.iB1.0.990108135155.22826A-100000@halifax.chebucto.ns.ca>

On Thu, 7 Jan 1999, walter wrote:

> I didn't find a newsgroup for MacPerl, so I guess this is where those folks
> hang out as well (I hope).
> 
> I have a need to know if any of you MacPerl gurus out there know how to get
> the Time Zone that your Mac is set to?

Well, Perl, period, lives here, so people who use MacPerl do too. :-)

Seriously, though, there is a very active MacPerl mailing list. Find links
to it from the Mac references on www.perl.com or go to www.ptf.com.

As a matter of fact, getting the Time Zone in MacPerl is a current topic.
I haven't really been following it, though.

Arved




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

Date: 8 Jan 1999 17:53:13 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Global variables and use strict question
Message-Id: <775gm9$bjl$1@pegasus.csx.cam.ac.uk>

In article <36952119.20722055@mars.dsu.edu>,  <nospam@here.com> wrote:
>With Perl for Win32 form www.activestate.com build 508 it recommends
>using "use strict".  This then causes perl to complain about any
>global variables that you don't refer to as $main::variablename.  My
>question is, what is the best way to handle this?  Below is a little
>bit of my code.  For some of my global vars I'm using "use vars" to
>"declare" them (is that right?), but with the rest of them, I make
>them local to my program with the "my" keyword.  Both of these work,
>but which is better, or should I be using fully qualified references
>to all of my global variables instead?

If a variable isn't needed outside a particular file, make it lexical
with "my".    If a variable _needs_ to be global, you can either
"use vars" or fully qualify  -  it's a matter of taste.    I usually
fully qualify variables that are referenced once or twice, and "use vars"
for others.

>use Getopt::Std;
>#These vars are used in getopts.pl
>use vars qw ($opt_d	$opt_g $opt_x $opt_f);

In the particular case of Getopt::Std, I prefer to use the extra argument
to get the options in a lexically defined hash:

    my %opt;
    getopts('dgxf', \%opt);
    print "-d option set\n" if $opt{d};


Mike Guy


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

Date: 08 Jan 1999 17:50:36 +0100
From: Hrvoje Niksic <hniksic@srce.hr>
Subject: Gratuitous warnings when statting files with newlines
Message-Id: <kig3e5lzp2b.fsf@jagor.srce.hr>

I noticed a strange thing today.  This runs without warnings:

    perl -we '(-d "foo")'

However, this prints out a warning:

    perl -we '(-d "foo\nbar")'
    --> Unsuccessful stat on filename containing newline at -e line 1.

Apparently, `-w' doesn't like the stat-related operators to contain
newlines.  I find this strange -- unlike sh, Perl should be able (and
*is* able) to handle "funny" characters in the file names without
problems.

While I know files with newlines in the name are rare, their occurence
shouldn't cause my application, which otherwise handles those files
just fine, to spew warnings to stderr.

Of course, I can remove `-w', but I don't want to do that -- `-w' is
useful and I normally want to use it.


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

Date: 8 Jan 1999 17:36:24 GMT
From: gward@thrak.cnri.reston.va.us (Greg Ward)
Subject: Re: Gratuitous warnings when statting files with newlines
Message-Id: <775fmo$o2a$1@news0-alterdial.uu.net>

Hrvoje Niksic <hniksic@srce.hr> wrote:
> I noticed a strange thing today.  This runs without warnings:
> 
>     perl -we '(-d "foo")'
> 
> However, this prints out a warning:
> 
>     perl -we '(-d "foo\nbar")'
>     --> Unsuccessful stat on filename containing newline at -e line 1.

This sure looks like a feature to me.  Note that if the directory named
"foo\nbar" actually exists, you get no warning -- the "spurious" warning
only happens if -d fails.  Makes sense.

> Of course, I can remove `-w', but I don't want to do that -- `-w' is
> useful and I normally want to use it.

A little-known feature is that you can temporarily turn off -w in
sections of code known to be naughty:

  {
    local $^W = 0;
    if (-d $weird_filename) { ... }
  }

'man perlvar' and look for $^W for details.

        Greg
-- 
Greg Ward - software developer                    gward@cnri.reston.va.us
Corporation for National Research Initiatives    
1895 Preston White Drive                      voice: +1-703-620-8990 x287
Reston, Virginia, USA  20191-5434               fax: +1-703-620-0913


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

Date: Fri, 8 Jan 1999 10:45:04 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Matching binary strings
Message-Id: <gmc577.rrn.ln@magna.metronet.com>

Tim Shaw (Tim.Shaw@alcatel.be) wrote:
: In the following example, the strings are not in fact binary, but they
: would be at another level of interpolation (if that's the correct
: expression). Any idea why they do not match?

: #!/usr/bin/perl -w
: use strict;
: use diagnostics;

: my $value =  "\\x01\\x02";
: my $mask = "\\x01\\x02";

: print "value  = $value\n";
: print "mask = $mask\n";


   They are, of course, the same up to this point (8 bytes each).


: if ($value =~ m/$mask/)
                  ^^^^^

   But that is "double quotish", so the hex escapes get converted,
   and you are attempting to match 2 bytes (which don't match the
   ASCII codes for any of the printable chars in $value)


: {
:     print "Match\n";
: }
: else
: {
:     print "No match\n";
: }


   It will match if you:

      my $value =  "\x01\x02";   # interpolate to 2 bytes


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


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

Date: Fri, 08 Jan 1999 17:40:32 GMT
From: Andy.Fry@netserv.net
Subject: ODBC Drivers
Message-Id: <775fug$ds8$1@nnrp1.dejanews.com>

Help,

I have a SCO Unix Box and I'd like to connect to a remote Oracle server using
PERL, what drivers do I need, and where the heck can I get them. Or do I need
some Oracle Software (probably very expensive) in order to do this. I've
tried the DBD::Oracle module, and had no joy with that, cause it requires
some client software to be installed.

Any Ideas ????

Regards

Andy

--
Andy Fry				Phone:	+44 1924 422111
Internet Consultant		Fax:		+44 1924 425220
ICM NetServ Ltd

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


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

Date: Fri, 8 Jan 1999 10:17:17 -0500 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Passing hashes to a sub
Message-Id: <x3yhfu17q0z.fsf@tigre.matrox.com>


John Warner <jwarner@tivoli.com> writes:

> 
> I've reading up on hashes in perlfaq4, perlref,  _Programming Perl_, and
> the _Perl Cookbook_.  However, the one task I haven't found an
> explanation/example of how to pass a hash to a function.  Is this

That shouldn't have stopped you from going through the rest of the
FAQs.
>From perlfaq7:

     How can I pass/return a {Function, FileHandle, Array, Hash,
     Method, Regexp}?

You also seem to have missed pages 116-118 of the Camel (_Programming
Perl_), which explains passing by reference.

Always remember that Perl's documentation is one of its strongest
features.

Hope this helps,
Ala



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

Date: Fri, 08 Jan 1999 16:58:34 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Password Encryption
Message-Id: <36962b2a.524144494f47414741@radiogaga.harz.de>

Martin Vorlaender (martin@RADIOGAGA.HARZ.DE) wrote:
: Artoo (r2-d2@REMOVEbigfoot.com) wrote:
: : Mike wrote in message <3693686D.24757D41@counter.w-dt.com>...
: : >Use perls crypt function. It can't be decrypted, you just crypt both with
: : >the same salt and then compare them.
: :
: : Does the crypt function only work on UNIX, or is there an NT version?  (If
: : so where can I get it)
:
: http://www.pdv-systeme.de/users/martinv/Crypt.pm

I forgot:
Another way would be to get the CPAN source distribution (5.005_02),
follow the hints for getting and integrating a DES library, and build
perl with crypt yourself.

cu,
  Martin
--
                        | Martin Vorlaender | VMS & WNT programmer
 VMS is today what      | work: mv@pdv-systeme.de
 Microsoft wants        |       http://www.pdv-systeme.de/users/martinv/
 Windows NT 8.0 to be!  | home: martin@radiogaga.harz.de


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

Date: Fri, 8 Jan 1999 17:17:12 -0000
From: "Hywel Jenkins" <UseNet@WebDude.FreeServe.CO.UK.CutThis>
Subject: Re: Perl on Apache 1.3.3 running on Windows 95/NT
Message-Id: <36963e60.1@news.star.co.uk>

http://www.activestate.com/

You actually install it on Windows 95/NT - it just happens that you can use
it with Apache for CGI.

--
Hywel Jenkins
"I, too, have a job, a mortgage and a pension."
http://hyweljenkins.com/
Remove '.CutThis' from address to reply

Steve Shawl wrote in message <369583CA.7747A34B@nwcis.com>...
>Hey!
>How do I install Perl on Apache 1.3.3 running on Windows 95/NT?
>Where do I get the install file(s)?
>Where can I get some help (person, paper, or web site :-)?
>Also does anyone know the commands (or where I can get them) that will
>allow me to send data to the serial port (preferably rs-232) so I can
>control external devices with a web interface?
>Thank's
>Steve Shawl
>cpu2000@nwcis.com
>http://www.nwcis.com/steve
>




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

Date: Fri, 08 Jan 1999 17:04:08 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Why Is Perl not a Language?
Message-Id: <369838bc.1476603@news.skynet.be>

Trond Michelsen wrote:

>Sure you can make programs with user interfaces with Perl. 
>Any kind of text-only "press a key to continue" programs are a user
>interface, but you were probably thinking of a Graphical User
>Interface?

Er... Not necessarily. "press a key to continue" IS a user interface, in
my book. In scripting, you usually try to avoid this. 

>Any kind of web-page with a form is a Graphical User Interface.

Yes. But it's not part of the script. It's part of the browser.

Suppose you write a little thingy that gets attached to a menu item in
some programs menu. You're not actually changing that program, although
you do extend it's functionality. I'd call that a "menu script", even
though it's activated through a GUI.

>But, if you want to make a more traditional user-interface you can use
>some of the X11::Fvwm:: modules or Tcl::Tk. I haven't done this myself,
>so I don't know exactly how easy it is to use these modules, but they
>are there.

Indeed. But when you do use them, you're not scripting.

>I mostly use perl for scripting purposes myself, creating programs that
>need as little user intervention as possible, but that merely means
>that my _programs_, not my _programming language_, are GUI-less, don't
>you agree?

Yes. But my point is: a scripting language is a lanuage that is mainly
used for scripting, i.e. the way you appear to use Perl. So, basically,
Perl is a scripting language. Mainly.

Notte: these are just my point of view, and I'm not too strict in this.
In other words: I don't care too much if you see it differently. :-)

	Bart.


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

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

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