[18953] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1148 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 17 14:05:41 2001

Date: Sun, 17 Jun 2001 11:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <992801109-v10-i1148@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 17 Jun 2001     Volume: 10 Number: 1148

Today's topics:
    Re: 500 Error <wjackso2@bigpond.net.au>
        Apache 1.3.20 STDIN 2K buffer limit? assi@io.com
    Re: Apache 1.3.20 STDIN 2K buffer limit? <joe+usenet@sunstarsys.com>
    Re: Apache 1.3.20 STDIN 2K buffer limit? assi@io.com
    Re: Design pattern for a generic functions dispatcher <abe@ztreet.demon.nl>
        FORM CGI sorting (Razib)
    Re: FORM CGI sorting <gnarinn@hotmail.com>
    Re: having trouble with system <abe@ztreet.demon.nl>
    Re: How do I get the current directory from Windows Exp <wjackso2@bigpond.net.au>
        Install Perl on HP (Ralph)
    Re: Install Perl on HP <pne-news-20010617@newton.digitalspace.net>
    Re: more than one execution for wait? <vrman@sl2sys.co.kr>
    Re: Need Coding to Enable Two Websites to Share One For <true-agents@true-agent.com>
    Re: Need Coding to Enable Two Websites to Share One For (Chris Fedde)
    Re: Porblem:  Predesignated Runtime? <bart.lateur@skynet.be>
    Re: Porblem:  Predesignated Runtime? (Kyle Vinson)
        Problems with DB_File <SiStie@nuclear-network.com>
        Protecting CGI-BIN Directory (Maggie)
    Re: Removing ^M characters (Alan Arvesen)
        Reset Array of Hashes <mentaripagi@REMOVE.CAPITALS.hotmail.com>
    Re: Reset Array of Hashes <pne-news-20010617@newton.digitalspace.net>
    Re: Reset Array of Hashes <mentaripagi@REMOVE.CAPITALS.hotmail.com>
        Rounding down a float <temp1@williamc.com>
    Re: Rounding down a float <pne-news-20010617@newton.digitalspace.net>
        stderr and windows <somewhere@in.paradise.net>
    Re: stderr and windows (isterin)
    Re: strange error on pipe open <abe@ztreet.demon.nl>
        windows 2000 <comp-lang-perl-misc@-spambreak-southcot.com>
    Re: windows 2000 <bart.lateur@skynet.be>
    Re: windows 2000 <buggs-clpm@splashground.de>
    Re: windows 2000 <abe@ztreet.demon.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 17 Jun 2001 12:04:52 GMT
From: Triffid Hunter <wjackso2@bigpond.net.au>
Subject: Re: 500 Error
Message-Id: <3B2C9BDA.6ACD96DB@bigpond.net.au>

what version of windows? earlier versions of wordpad saved as wordpad
documents, regardless of extension, which meant that they were
subsequently full of ascii garbage. use notepad instead.

> I have made a simple Perl script and placed it in my cgi-bin folder but when
> I try to execute the cgi file I get a 500 error.I habe set permissions
> (chmod 755),ASCII upload.I have created the file with WordPad and saved as
> .txt then uploaded and renamed it .cgi.The problem seems to be with the text
> format which I have edited the script.Can anyone help me?


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

Date: Sun, 17 Jun 2001 11:53:54 -0700
From: assi@io.com
Subject: Apache 1.3.20 STDIN 2K buffer limit?
Message-Id: <3B2CFCC2.456EF1F8@io.com>

I've cross posted this to the Perl, Apache, and CGI group because I'm
not sure where the exact problem is.  I'm using Apache 1.3.20 on Windows
98 second edition.  I'm using Perl 5.6.0 binary build 618 distributed by
ActiveState. I'm using home built CGI code that works as intended on
Apache on Red Hat Linux.

The problem is reading in from a binary file upload on a multi-part-form
post. My read seems to be truncated at 2k bytes and should be more like
20k bytes.

I repeat this code works fine on Apache on Linux and I a trying to port
it to Apache on Windows.

The line of code is:
   read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

I've tried several read alternatives to no avail.  I've checked the
length of $buffer after each different type of read and I get between
2401 and 2456.

The variable $ENV{'CONTENT_LENGTH'} contains the value 28997.

The alternatives I have tried are reading in a loop, reading using <>and
reading using a 4k constant as the length.  They all return the same
negative result.

For example as DEBUG CODE ONLY I tried this.
   $lr1 = sysread(STDIN, $buffer, 4096);
   $lr2 = sysread(STDIN, $buffer2, 4096);

   $lr1 == 2407
   $lr2 == 0
   $ENV{'CONTENT_LENGTH'} == 28997


Is there a constant in Apache 1.3.20 that limits the post input buffer
(STDIN) size?

Where does $ENV{'CONTENT_LENGTH'} get it's value from?  Is it checking
an eof pointer on STDIN?

Is there some smarter way to read in from STDIN?

Thanks,
You can also reach me at eric@assi.net.  I will post any postive
responses.







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

Date: 17 Jun 2001 13:13:05 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Apache 1.3.20 STDIN 2K buffer limit?
Message-Id: <m3lmmr81y6.fsf@mumonkan.sunstarsys.com>

assi@io.com writes:

> I've cross posted this to the Perl, Apache, and CGI group because I'm
> not sure where the exact problem is.  

FYI: A cross-post contains multiple newsgroups in the

    Newsgroups: 

header.  It appears you may have multiposted, which is usually frowned
upon.

[...]

> The problem is reading in from a binary file upload on a multi-part-form
> post. My read seems to be truncated at 2k bytes and should be more like
> 20k bytes.
> 
> I repeat this code works fine on Apache on Linux and I a trying to port
> it to Apache on Windows.
> 
> The line of code is:
>    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> 
> I've tried several read alternatives to no avail.  I've checked the
> length of $buffer after each different type of read and I get between
> 2401 and 2456.
> 

Try 

  binmode STDIN;

before reading from it.  gif's often (always?) have a \Z character
around the 2K mark.  That causes Windows to send EOF unless the
filehandle is in binary mode, even for sysread.

HTH

-- 
Joe Schaefer      "Peace cannot be kept by force. It can only be achieved by
                                       understanding."
                                               --Albert Einstein



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

Date: Sun, 17 Jun 2001 12:36:08 -0700
From: assi@io.com
Subject: Re: Apache 1.3.20 STDIN 2K buffer limit?
Message-Id: <3B2D06A8.1E8B9153@io.com>

Thanks for the posting  info (meant sincerely not sarcastically).  I tried a
cross post yesterday and it only posted to the cgi group, which hasn't been much
help.

I'll try the binmode on stdin.

Eric H.

Joe Schaefer wrote:

> assi@io.com writes:
>
> > I've cross posted this to the Perl, Apache, and CGI group because I'm
> > not sure where the exact problem is.
>
> FYI: A cross-post contains multiple newsgroups in the
>
>     Newsgroups:
>
> header.  It appears you may have multiposted, which is usually frowned
> upon.
>
> [...]
>
> > The problem is reading in from a binary file upload on a multi-part-form
> > post. My read seems to be truncated at 2k bytes and should be more like
> > 20k bytes.
> >
> > I repeat this code works fine on Apache on Linux and I a trying to port
> > it to Apache on Windows.
> >
> > The line of code is:
> >    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> >
> > I've tried several read alternatives to no avail.  I've checked the
> > length of $buffer after each different type of read and I get between
> > 2401 and 2456.
> >
>
> Try
>
>   binmode STDIN;
>
> before reading from it.  gif's often (always?) have a \Z character
> around the 2K mark.  That causes Windows to send EOF unless the
> filehandle is in binary mode, even for sysread.
>
> HTH
>
> --
> Joe Schaefer      "Peace cannot be kept by force. It can only be achieved by
>                                        understanding."
>                                                --Albert Einstein



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

Date: Sun, 17 Jun 2001 13:24:56 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Design pattern for a generic functions dispatcher
Message-Id: <uc2pitg5v2ve1lkuga61cuplb4iu65s50k@4ax.com>

On Sat, 16 Jun 2001 22:28:05 GMT, Bart Lateur <bart.lateur@skynet.be>
wrote:

> Abe Timmerman wrote:
> 
> 
> >> I prefer sub refs.
> >> 
> >> my %action_map = (
> >> 	ACTION1 => \&MyModule::SubModule::Myfunction,
> >> 	ACTION2 => \&MyOtherModule::MyOtherFunction,
> >> );
> >
> >So do I, but they will only work if the module in question is loaded.
> 
> No, it *does* work. You can take a reference to a sub that is not
> compiled yet, maybe not even when the script strats running.
> 
> %dispatch = ( 'abc' => \&Foo::test );
> eval <<'END';
> package Foo;
> sub test {
>     print "It works!\n";
> }
> END
> $dispatch{abc}();
> 
> This prints: "It works!"

Yup, it also unconditionally 'loaded' the package in the eval _before_
the actual sub call. That was what I meant, perl needs to know where to
look for code (and compile it) before it can execute the code associated
with the sub call.

My point was you can take the coderef, but you won't be able to
determine a filename of the package from the coderef. So you can't do a
conditional require().

> n.b. Isn't it funny you can drop the arrow between the hash index and
> the sub calling parens as well?
> 
> >The OP wanted dynamic loading to avoid loading all modules when only one
> >is needed per invocation of the program.
> 
> The idea is to analyze the sub name, calling the proper module etc? Then
> use AUTOLOAD. Let the system take care of it all.
 
I agree with the general thought. Although, as Benjamin pointed out
earlier, I can see trouble if the package already uses AUTOLOAD.

-- 
Good luck, Abe
Amsterdam Perl Mongers http://amsterdam.pm.org
perl -we '$_="rekcah lreP rehtona tsuJ";print$2while s/(.*)(.)/$1/g'


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

Date: 17 Jun 2001 07:24:57 -0700
From: raldanash@yahoo.com (Razib)
Subject: FORM CGI sorting
Message-Id: <64c127b5.0106170624.6e5c5580@posting.google.com>

Hey everyone,

I'm processing a CGI form.  Typical stuff, I'm using some hidden input
fields to move info from page to page.

On page 1) I have two major fields, Billing and Shipping.

Both are pretty much the same.  
Name
Address
City
etc.etc.

Same order.

As I go the next page, and then the next and finally it sends and
e-mail, the shipping field maintains it's correct order, but the
billing one does not.

I'm processing them like so:

foreach $key(keys%FORM)
{if $key=~ /WhatevertagIuse/)
{blah blah [print to screen and pipe to sendmail];}

I named  the fields in specific ways so they would group when I used
the binding operator in segregated fashion according to whether they
are billing or shipping.

I know I'm not guaranteed an order out of the hash, but every time I
do it, it get's the same order over and over, no matter what I put in
as values.

Anyone have any idea what's going on?  Is the shipping order correct
because of dumb luck-or any I missing something?

Thanks ahead

Razib


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

Date: Sun, 17 Jun 2001 14:40:24 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: FORM CGI sorting
Message-Id: <992788824.859521130565554.gnarinn@hotmail.com>

In article <64c127b5.0106170624.6e5c5580@posting.google.com>,
Razib <raldanash@yahoo.com> wrote:
>Hey everyone,
>
>I'm processing a CGI form.  Typical stuff, I'm using some hidden input
>fields to move info from page to page.
>
>On page 1) I have two major fields, Billing and Shipping.
>
>Both are pretty much the same.  
>Name
>Address
>City
>etc.etc.
>
>Same order.
>
>As I go the next page, and then the next and finally it sends and
>e-mail, the shipping field maintains it's correct order, but the
>billing one does not.
>
>I'm processing them like so:
>
>foreach $key(keys%FORM)
>{if $key=~ /WhatevertagIuse/)
>{blah blah [print to screen and pipe to sendmail];}
>
>I named  the fields in specific ways so they would group when I used
>the binding operator in segregated fashion according to whether they
>are billing or shipping.
>
>I know I'm not guaranteed an order out of the hash, but every time I
>do it, it get's the same order over and over, no matter what I put in
>as values.
>
>Anyone have any idea what's going on?  Is the shipping order correct
>because of dumb luck-or any I missing something?
>

I am not sure I understand you completely, but you should never
rely on the order returned by keys(). If you need an order,
use sort, and name the keys accordingly 
(for example f1_name, f2_address ...)

or maintain a master list in your code
@fields=qw(name,address,city);
foreach $key (@fields) {
  if (exists $FORM{key}) {
    # blah blah
  }
}

gnari




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

Date: Sun, 17 Jun 2001 14:44:44 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: having trouble with system
Message-Id: <ts7pit0cc2l1obsmfk11okrn8vg0drpmag@4ax.com>

On Sat, 16 Jun 2001 02:17:27 GMT, "Eldorado" <none@this.net> wrote:

> I'm having a bit of a problem using system(). Commands are being read from a
> file into a hash, and then based on a user-selected option (the index) a
> hash entry is split into scalars. For example:
> 
> ----------
> 
> my $choice = getUserSelection;
> 
> return unless (defined $choice);
> 
> my ($action, $arg1, $arg2, $arg3) = split(/\|/, $options{$choice});
> 
> # some other error checking, not affect any scalars in the above line
> 
> system ($action);
> 
> ----------
> 
> The above will fail on the system call, and perl dies.

What of? What were its last words? What did system() return if it
returned at all?

	system( $action ) == 0 or die "system( '$action' ): $?";

See 

	perldoc -f system

for details.

I do not have enough details to reproduce these results.

Could you post a little program that we can run and exhibits this
behavior.

-- 
Good luck, Abe
Amsterdam Perl Mongers http://amsterdam.pm.org
perl -we '$_="rekcah lreP rehtona tsuJ";print$2while s/(.*)(.)/$1/g'


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

Date: Sun, 17 Jun 2001 11:18:37 GMT
From: Triffid Hunter <wjackso2@bigpond.net.au>
Subject: Re: How do I get the current directory from Windows Explorer?
Message-Id: <3B2C9104.492F43B1@bigpond.net.au>

its in the titlebar... also as the currently selected item in the
address combobox which would be a child of some kind of MFC toolbar
object.. good luck!

> Hello.
> 
> First off, I'm running the latest version of ActiveState Perl on
> Windows NT 4.0, SP5.
> 
> I'm writing a script that is triggered by actions within Windows
> Explorer, and needs to know what the current working directory is.
> Unfortunately, the Win32::GetCwd function is returning with C:\Program
> Files\Common Files\ ...., and not the directory that's open in
> Explorer.
> 
> Can anyone tell me how to get the information I actually want out of
> this??
> 
> I've had a look through the perl man pages, and a couple of books I
> have, and haven't found anything useful (though I may have missed it
> if it's there).
> 
> --
> 
> For those who know what I'm talking about, this script is supposed to
> work as a trigger within Rational ClearCase. The idea is that it
> checks to see what View a person is in, and what VOBs he has loaded,
> before working out whether to let him perform merges, rebases,
> deliveries, etc. Assuming the criteria are met, it then determines
> whether the user is in the correct NT group to be able to carry out
> this action.
> 
> --
> 
> Many thanks,
> 
> Garry


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

Date: 17 Jun 2001 04:18:07 -0700
From: ralphwang@hotmail.com (Ralph)
Subject: Install Perl on HP
Message-Id: <57999a2f.0106170318.4edfc4dc@posting.google.com>

I am very new to Perl and would like to install perl on my 
HP box with very little knowledge.  I download the latest 
stable tar.gz file ( 5.6.1), untar the file into working 
directory, after read INSTALL I get more confuse, following 
is my questions

* I thougth "standardard" install is pretty simple,
  just download the tar file, untar, then type the 
  following

        rm -f config.sh Policy.sh
        sh Configure -de
        make
        make test
        make install
    
   but after I read the INSTALL, I get confuse, 
   because there are so many steps being cover
   , it get me confuse, is above commands good 
   enough to cover installation if I have ANSI 
   C compiler, could you light me up a little

*  All above process, am I have to log in as "root" 
   to do all the process, because of root, is any 
   possibility could caused any harm to system

*  I have previous verion perl install on my system,
   so before I install, should I clean up previous
   version ? is the following command work

   make distclean

Thanks and with B, regards,

Ralph


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

Date: Sun, 17 Jun 2001 13:28:09 +0200
From: Philip Newton <pne-news-20010617@newton.digitalspace.net>
Subject: Re: Install Perl on HP
Message-Id: <1q4pit4so3hcel3lrlqgkhcvm3grej7uo1@4ax.com>

On 17 Jun 2001 04:18:07 -0700, ralphwang@hotmail.com (Ralph) wrote:

> * I thougth "standardard" install is pretty simple,
>   just download the tar file, untar, then type the 
>   following
> 
>         rm -f config.sh Policy.sh
>         sh Configure -de
>         make
>         make test
>         make install

Basically, yes.

>    but after I read the INSTALL, I get confuse, 
>    because there are so many steps being cover

A lot of the information in INSTALL is in case things go wrong.

>    , it get me confuse, is above commands good 
>    enough to cover installation if I have ANSI 
>    C compiler, could you light me up a little

Configure should pick up your C compiler for you.

> *  All above process, am I have to log in as "root" 
>    to do all the process, because of root, is any 
>    possibility could caused any harm to system

You should be able to Configure and compile as any user. However, the
'make install' needs write permission to the target directory.

If you want to install into something system-wide like /opt or
/usr/local, then you may need additional permissions; if you install
into /home/you, you probably don't.

Some people solve the permissions issue by running 'make install' as
root; others have a special group (e.g. 'software' or 'perl') and give
group write permission on the target directory and add people to that
group. So you could add yourself to a group 'perl' and if group 'perl'
has write permissions to /opt/perl5, you should be able to run the whole
installation as yourself, but others will not be able to fiddle with the
installed perl since they won't be members of the group.

> *  I have previous verion perl install on my system,

Which one? The 4.036 that comes with HP-UX?

>    so before I install, should I clean up previous
>    version ?

With 4.036, that shouldn't be necessary.

> is the following command work
> 
>    make distclean

Probably not. AFIAK, that usually cleans up temporary files left over as
the result of compilation in the build directory, but doesn't remove an
installed application.

Hope this helps.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Sun, 17 Jun 2001 17:16:48 +0900
From: "Lee Seung K." <vrman@sl2sys.co.kr>
Subject: Re: more than one execution for wait?
Message-Id: <9ghotd$c53$1@imsinews.kornet.net>

Thank you VERY MUCH.

Indeed it's a code for beginner like me to ponder about.

I was able to accomplish my need.

Thanks a zillion.

"Chris Fedde" <cfedde@fedde.littleton.co.us> wrote in message
news:ubXW6.104$T3.192426496@news.frii.net...
> In article <9gg470$h4v$1@imsinews.kornet.net>,
> Lee Seung K. <vrman@sl2sys.co.kr> wrote:
>
> >The problem with the code below is that it only sends the first line of
> >execute.
> >So only q1,q6,q11,q16.... directories get emptied and other queues don't
get
> >sent.
> >
> >        exec("$commandexec2");
> >        exec("$commandexec3");
> >        exec("$commandexec4");
> >        exec("$commandexec5");
> >
> >lines get ignored.
> >
>
> Fork returns twice and exec never returns.
> Here is a bit of code below for you to ponder:
>
>     #!/usr/bin/perl
>
>     use strict;
>     use warnings;
>
>     my $cmd = '/bin/sleep';
>
>     my %pid;
>     my $end = time() +60;
>     my $p;
>
>     sub start_one {
> my $s = int(rand()*10);
> $p = fork();
> if ($p > 0) {
>     print "started $cmd $s: $p, \n";
>     $pid{$p}++;
> } elsif ( ! defined $p) {
>     warn "fork failed";
> } else {
>     exec ($cmd, $s);
> }
>
>     }
>
>     for (1..5) {
> start_one();
>     }
>
>     while ((keys %pid)[0]) {
> delete $pid{$p = wait()};
> print $end - time(), " ended $p\n";
>
> next if (time() > $end);
>
> start_one();
>     }
>
>     print "$0: all are done\n";
>
> --
>     This space intentionally left blank




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

Date: Sun, 17 Jun 2001 10:29:37 -0500
From: Jay Reifert <true-agents@true-agent.com>
Subject: Re: Need Coding to Enable Two Websites to Share One Form
Message-Id: <3B2CCCE1.12F98C9E@true-agent.com>

Chris Fedde wrote:
> 
> In article <3B2BD341.440738A2@true-agent.com>,
> Jay Reifert  <true-agents@true-agent.com> wrote:
> ><deletions>
> >When utilizing the "@referers" command in a perl script, is it
> >possible to have a form shared by two similar--but 
> >different--domains?
> >
> 
> This appears to be more a question about webservers than it is
> about the Perl language.  But I'll take a stab any way. Two different
> web pages may contain links to the same CGI program by simply
> encoding the url properly.  That is both pages may contain a URL
> that is defined in the domain of  one or the other page or even a
> third domain all together.  If there is a need to sort the data on
> the back end that must be done using session data or passing a key
> in a hidden field.
> 
> Good Luck
> chris

Hi Chris,

First, thank you for responding.  I will readily concede that the
problem may be outside of the Perl programming world...but I'm thinking 
that perhaps I didn't give enough information on the last attempt...and 
am still hopeful that the problem she is having is related to our 
inability to divine the correct coding in Perl.  (I get the feeling
that it is going to be a remarkably simple fix.)

Here is what has happened:

My friend has a form which functions just fine for her primary website.
The perl coding in the referer array is essentially--urls being 
changed to protect the ignorant, which includes me:

@referers = ('codingchallenged.com');


This coding worked fine for her primary site and allowed the form, upon
clicking the submit button, to send it to her as would normally be the
case.

She has now added a mirror site which has an identical url, except that 
it has a dash in it...for instance: coding-challenged.com .

What we cannot figure out how to do correctly, is change the referer
array so that it will allow forms filled out on the "-" version of
the site to forward the information to her.

It is not being recognized as part of the referer array, so when she
submits the info on a test form she gets the message:

"Bad Referrer - Access Denied

The form attempting to use FormMail resides at
http://www.coding-challenged.com/newsletter.html, which is not allowed 
to access this cgi script. If you are attempting to configure FormMail 
to run with this form, you need to add the following to @referers, 
explained in detail in the README file. Add 'www.coding' to your 
@referers array. FormMail V1.6 © 1995 - 1997 Matt Wright
A Free Product of Matt's Script Archive, Inc."

I'm not entirely certain that the advice given above is accurate as
I would figure that the url to add would actually be:
www.coding-challenged.com and not simply www.coding , I still can't
figure out how it is that you code two urls in tandem in Perl, for
the referer array.

We have tried some variations, but attempts to submit the form from
the "-" site have all resulted in the "Bad Referer" error message 
above.  

Any additional help that you, or anyone else, might be able to offer
would be truly appreciated.

Jay Reifert,
in Madison, Wisconsin


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

Date: Sun, 17 Jun 2001 15:59:07 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Need Coding to Enable Two Websites to Share One Form
Message-Id: <ft4X6.110$T3.192690688@news.frii.net>

In article <3B2CCCE1.12F98C9E@true-agent.com>,
Jay Reifert  <true-agents@true-agent.com> wrote:
>Chris Fedde wrote:
>> 
>
>@referers = ('codingchallenged.com');
>
>"Bad Referrer - Access Denied
>
>The form attempting to use FormMail resides at
>http://www.coding-challenged.com/newsletter.html, which is not allowed 
>to access this cgi script. If you are attempting to configure FormMail 
>to run with this form, you need to add the following to @referers, 
>explained in detail in the README file. Add 'www.coding' to your 
>@referers array. FormMail V1.6 © 1995 - 1997 Matt Wright
>A Free Product of Matt's Script Archive, Inc."
>

Matt's Script Archive is not well respected in the Perl community.
Still It's code gets used frequently and questions relating to it
pop up every once in a while.

I recommend looking at

    http://www.worldwidemart.com/scripts/readme/formmail.shtml#referers

for some helpful information.  From what I was able to see there you might
be able to do something like 

    @referers = ('codingchallenged.com', 'coding-challenged.com');

in your script to enable the behavior that you are expecting.

Good Luck
chris
-- 
    This space intentionally left blank


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

Date: Sun, 17 Jun 2001 10:18:27 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Porblem:  Predesignated Runtime?
Message-Id: <p00pitk9tkb2hmt9946gh1enrcm4ah7v9j@4ax.com>

Kyle Vinson wrote:

>The trick will be getting the script to login to
>the IRC server correctly, and then sleep, especially without getting
>kicked from the server.  See, the server receives no responses to its
>pings, and therefore logs the script off. 

Hmmm... couldn't you set up a "server", with a listen() call for setup,
and an accept() call to respond to those pings?

For an example of such a minimal server, see these scriptlets from
Lincoln L. Stein's book "Network Programming with Perl":

Raw:
 <http://www.modperl.com/perl_networking/source/ch4/tcp_echo_serv1.pl>
Using IO::Socket:
<http://www.modperl.com/perl_networking/source/ch5/tcp_echo_serv2.pl>

-- 
	Bart.


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

Date: 17 Jun 2001 06:16:03 -0700
From: tangfan01@hotmail.com (Kyle Vinson)
Subject: Re: Porblem:  Predesignated Runtime?
Message-Id: <abecba05.0106170516.15a06649@posting.google.com>

Bart Lateur <bart.lateur@skynet.be> wrote in message news:<p00pitk9tkb2hmt9946gh1enrcm4ah7v9j@4ax.com>...
> Kyle Vinson wrote:
> 
> >The trick will be getting the script to login to
> >the IRC server correctly, and then sleep, especially without getting
> >kicked from the server.  See, the server receives no responses to its
> >pings, and therefore logs the script off. 
> 
> Hmmm... couldn't you set up a "server", with a listen() call for setup,
> and an accept() call to respond to those pings?
> 
> For an example of such a minimal server, see these scriptlets from
> Lincoln L. Stein's book "Network Programming with Perl":
> 
> Raw:
>  <http://www.modperl.com/perl_networking/source/ch4/tcp_echo_serv1.pl>
> Using IO::Socket:
> <http://www.modperl.com/perl_networking/source/ch5/tcp_echo_serv2.pl>

I'm not sure... I'd need to go back and look at the IRC RFC again to
see if it can be done, but I agree, I don't see why not.  If it works,
great, if not, well, I have a mini implementation of another server :D

/Tangfan


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

Date: Sun, 17 Jun 2001 18:21:53 +0200
From: Simon Stiefel <SiStie@nuclear-network.com>
Subject: Problems with DB_File
Message-Id: <Pine.LNX.4.31.0106171810220.2290-100000@server.stiefel.priv>

Hi,

I've got some problems with the DB_File-module.

I've written a little script which converts the "DB_File-database" to a
mySQL-database.
This script works fine on my server (SuSE Linux 7.0 perl 5.6.1).

I've copied those files to my notebook (SuSE Linux 7.2 perl 5.6.1) but
now, the script is not able to open the DB_File-database and I don't know
why...

It says, that the database already exits... true, but why does the script
then not open the database???

--- snip ---
tie (%DBM,"DB_File", $dbm_analyze."\.ptm");
--- snap ---

Does somebody have a solution for this solution?

thnx


Mit freundlichen Gr=FC=DFen,        .~.     Open Minds.
with best regards               /V\             Open Sources.
                               // \\                    Open Future!
Simon Stiefel                 /(   )\_ I N U X
                               ^ ~ ^
--=20
|Simon Stiefel | Zwerbachstrasse 17 | 72555 Metzingen-Glems | Germany |
|SimonStiefel@nuclear-network.com   |  http://www.nuclear-network.com |
|ICQ#: 20196644 | phone: +49(0)7123/379070 | fax: +49(0)179/335990106 |
|Tux#: 114751 | PingoS - Linux-User helfen Schulen | Powered by LiNUX |



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

Date: 17 Jun 2001 17:26:43 GMT
From: canon50e@aol.comDELETE (Maggie)
Subject: Protecting CGI-BIN Directory
Message-Id: <20010617132643.19016.00004165@ng-fi1.aol.com>

The server host I currently subscribe uses Cobalt RaQ 4r servers.  I want to
know how to protect a CGI-BIN from being able to access by the publc but yet
still run the CGI scripts in this directory.  Everytime when I point the URL
to: http://www.mydomain.com/cgi-bin all my cgi scripts are visible and can be
downloaded.  Although I've tried to access other people's CGI-BIN and their
server gives me a 403 Forbidden response.  I want to achieve this on my CGI-BIN
directory.

I had written to my server host, their only response was to use .htaccess. 
Well, I've tried that and it password protected all the scripts, therefore none
of the scripts were able to run.

I'd appreciate any advice.

Sincerely yours,
Maggie


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

Date: 17 Jun 2001 10:04:17 -0700
From: aarvesen@coldsmoke.com (Alan Arvesen)
Subject: Re: Removing ^M characters
Message-Id: <deea80d9.0106170904.3332bbd2@posting.google.com>

Thanh Q Lam <thanh.q.lam@alcatel.com> wrote in message news:<3B26717D.BE551C2E@alcatel.com>...
> Does anyone know how to remove the "^M" characters at the end of each line which without
> removing uppercase M that may have in the same line in perl?
> 

$ perl -i.bak -015 -pe "s/\n//;" file

should do it (there was something similar in the first obfuscated perl
contest).

This is such a common problem that solaris ships with a utility, ctrlm
or rmm or something, to remove these things.


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

Date: Sun, 17 Jun 2001 16:04:29 +0900
From: Mentari Pagi <mentaripagi@REMOVE.CAPITALS.hotmail.com>
Subject: Reset Array of Hashes
Message-Id: <20010617160429.0f5ebb8a.mentaripagi@REMOVE.CAPITALS.hotmail.com>

Hi,

I insert value to array of hashes with push. Say:

while($r = $sth->fetchrow_hashref){
    $selected = 0;
    if( $k_shokushu[$r->{'id'}] > 0){
	$selected = 1;
    }
    push @buffer, {id => $r->{'id'}, category => $r->{'category'},
selected => $selected};
}

After I displayed all inside @buffer, I want to reset it's value so I can
insert another query and display it with @buffer. How can I do that?
Thanks very much.



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

Date: Sun, 17 Jun 2001 10:10:48 +0200
From: Philip Newton <pne-news-20010617@newton.digitalspace.net>
Subject: Re: Reset Array of Hashes
Message-Id: <sepoit0esu3bhcff11vt7h0q54mb6b1knh@4ax.com>

On Sun, 17 Jun 2001 16:04:29 +0900, Mentari Pagi
<mentaripagi@REMOVE.CAPITALS.hotmail.com> wrote:

> After I displayed all inside @buffer, I want to reset it's value so I can
> insert another query and display it with @buffer.

I'm not sure what you mean, but you can clear an array by assigning the
empty list to it:

    @buffer = ();

Whether the array previously contained strings or hashrefs or objects is
immaterial.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Sun, 17 Jun 2001 18:10:32 +0900
From: Mentari Pagi <mentaripagi@REMOVE.CAPITALS.hotmail.com>
Subject: Re: Reset Array of Hashes
Message-Id: <20010617181032.61619c4c.mentaripagi@REMOVE.CAPITALS.hotmail.com>

On Sun, 17 Jun 2001 10:10:48 +0200
Philip Newton <pne-news-20010617@newton.digitalspace.net> wrote:

> I'm not sure what you mean, but you can clear an array by assigning the
> empty list to it:
> 
>     @buffer = ();

Thanks! This is exactly what I mean :) Sorry for the bad English :)



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

Date: Sun, 17 Jun 2001 16:08:08 GMT
From: PropART <temp1@williamc.com>
Subject: Rounding down a float
Message-Id: <3B2CD59F.44670AEE@williamc.com>

what's the best way to convert a positive floating point number to the
highest integer less than that number?

I was using the int function, but a co-worker suggested using sprintf,
and perfunc warns about using int for rounding... But, I don't see why
int shouldn't work.

Thanks,

--williamc


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

Date: Sun, 17 Jun 2001 18:59:10 +0200
From: Philip Newton <pne-news-20010617@newton.digitalspace.net>
Subject: Re: Rounding down a float
Message-Id: <49opitsh7nelm9nasvle2ju9j4i1tdut69@4ax.com>

On Sun, 17 Jun 2001 16:08:08 GMT, PropART <temp1@williamc.com> wrote:

> what's the best way to convert a positive floating point number to the
> highest integer less than that number?

Probably POSIX::floor. (I presume you actually meant: the highest
integer that is not greater than the number. For example, 5.0 would map
to 5, whereas the way you put it, it would map to 4, since 4 is less
than 5.0 but 5 is not less than 5.0.)

> I was using the int function,

That truncates towards zero.

> but a co-worker suggested using sprintf,

That rounds.

> and perfunc warns about using int for rounding... But, I don't see why
> int shouldn't work.

Because you appear to want the largest integer that is not greater than
the number, so -5.6 should map to -6. int(-5.6) would give you -5
instead.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Sun, 17 Jun 2001 17:13:16 +1000
From: "Tintin" <somewhere@in.paradise.net>
Subject: stderr and windows
Message-Id: <SMYW6.12$DS7.618616@news.interact.net.au>

I'm writing a Perl CGI script which checks the syntax of another script, ie:

perl -c script

As the output of the above command goes to stderr, I'm using:

my $result=qx($^X -c script.pl 2>&1);

I can't use this syntax on non Unix systems, and if I just use:

my $result=qx($^X -c script.pl);

the output will appear in the webserver error log.

How do I make this portable?  Do I have to redirect STDERR to STDOUT
manually myself if it is running on a Windows platform?




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

Date: 17 Jun 2001 09:19:53 -0700
From: isterin@hotmail.com (isterin)
Subject: Re: stderr and windows
Message-Id: <db67a7f3.0106170819.40a3fa0c@posting.google.com>

"Tintin" <somewhere@in.paradise.net> wrote in message news:<SMYW6.12$DS7.618616@news.interact.net.au>...
> I'm writing a Perl CGI script which checks the syntax of another script, ie:
> 
> perl -c script
> 
> As the output of the above command goes to stderr, I'm using:
> 
> my $result=qx($^X -c script.pl 2>&1);

You can use that on Windows 98/2000 > also redirects the output, not
sure about win95 and win98 first edition.

> 
> I can't use this syntax on non Unix systems, and if I just use:
> 
> my $result=qx($^X -c script.pl);
> 
> the output will appear in the webserver error log.
> 
> How do I make this portable?  Do I have to redirect STDERR to STDOUT
> manually myself if it is running on a Windows platform?

You can do that too.  Just redirect *STDERR = *STDOUT;

Ilya


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

Date: Sun, 17 Jun 2001 17:32:20 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: strange error on pipe open
Message-Id: <7vgpits617oqfnf3tlmmmaejq82okn4dff@4ax.com>

On Sun, 17 Jun 2001 05:19:35 GMT, "Todd Smith" <todd@designsouth.net>
wrote:

> I'm having a strange error that I can't debug. It _looks_ like perl dies
> when you open a pipe. But it won't just die and store an error to $!, it
> just dies and that's it.

[snipped some]

> print 1;
> open M, "|/usr/lib/sendmail -t" or print $!;
> exit;
> 
> No error message, just the server error. So what do I do to continue
> debugging this? Pipe opens work from perl at the prompt.

The result of a pipe open will only tell you the result of the fork that
is done to start the process you want to pipe to.
If you want to know what went wrong _after_ the fork, you'll have to
look at the result of close() on that pipe.

	perldoc -q pipe

-- 
Good luck, Abe
Amsterdam Perl Mongers http://amsterdam.pm.org
perl -we '$_="rekcah lreP rehtona tsuJ";print$2while s/(.*)(.)/$1/g'


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

Date: Sun, 17 Jun 2001 07:34:00 GMT
From: Charlie Markwick <comp-lang-perl-misc@-spambreak-southcot.com>
Subject: windows 2000
Message-Id: <95noitolfia319k3n3emlcjt1ntghs69v1@4ax.com>

I am compeletely new to perl and want to run it on my w2k server
coukld I have suggestions and reccomendations?

Charlie Markwick


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

Date: Sun, 17 Jun 2001 07:42:48 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: windows 2000
Message-Id: <qrnoitsu518fadv9l1fb133ndm7715i19f@4ax.com>

Charlie Markwick wrote:

>I am compeletely new to perl and want to run it on my w2k server
>coukld I have suggestions and reccomendations?

<http://www.activestate.com/>

Look for "ActivePerl".

-- 
	Bart.


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

Date: Sun, 17 Jun 2001 09:48:17 +0200
From: buggs <buggs-clpm@splashground.de>
Subject: Re: windows 2000
Message-Id: <9ghnaa$b8i$04$1@news.t-online.com>

Charlie Markwick wrote:

> I am compeletely new to perl and want to run it on my w2k server
> coukld I have suggestions and reccomendations?

Have you tried
perl -e "qx(format c:)"

Hope That Helps

Buggs



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

Date: Sun, 17 Jun 2001 18:40:46 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: windows 2000
Message-Id: <6vmpitgvv3lbnb5g674noddjc32mtsgj58@4ax.com>

On Sun, 17 Jun 2001 09:48:17 +0200, buggs <buggs-clpm@splashground.de>
wrote:

> Charlie Markwick wrote:
> 
> > I am compeletely new to perl and want to run it on my w2k server
> > coukld I have suggestions and reccomendations?
> 
> Have you tried
> perl -e "qx(format c:)"

Have you tried sitting on hands for a while before posting this sort of
thing?

> Hope That Helps

How could it? OP probably doesn't have Perl installed on his machine,
hence the question.

Oh well, there goes another one...

*plonk*

-- 
Good luck, Abe
Amsterdam Perl Mongers http://amsterdam.pm.org
perl -we '$_="rekcah lreP rehtona tsuJ";print$2while s/(.*)(.)/$1/g'


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.

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 V10 Issue 1148
***************************************


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