[19192] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1387 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 26 18:08:09 2001

Date: Thu, 26 Jul 2001 15:05:14 -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: <996185114-v10-i1387@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 26 Jul 2001     Volume: 10 Number: 1387

Today's topics:
        \nhelp <jtjohnston@courrier.usherb.ca>
        Apache and mod_perl? <a@b.c>
        argv or getopt on Windows 2000 pro (Stephen Uitti)
        CGI:standard <greenbd@u.washington.edu>
    Re: CGI:standard <tinamue@zedat.fu-berlin.de>
        chess in perl (Sean Mintz)
    Re: emacs etags default in cperl mode <badarik@yahoo.com>
    Re: emacs etags default in cperl mode <nospam-abuse@ilyaz.org>
    Re: Extract the relative sorting of items from multiple <ren@tivoli.com>
    Re: Extract the relative sorting of items from multiple <bart.lateur@skynet.be>
        FAQ: How do I unescape a string? <faq@denver.pm.org>
    Re: Finding a word in a sorted list. <pne-news-20010726@newton.digitalspace.net>
    Re: Finding a word in a sorted list. <bart.lateur@skynet.be>
        Godzilla - Hot air, no substance. (was Re: Regular expr slash@dot.c.o.m.org
    Re: How to loop over files whose names are listed in a  (Ronald Blaschke)
        HTTP Error 405 - newbie question (Tghtgh)
    Re: HTTP Error 405 - newbie question (Steven M. O'Neill)
    Re: HTTP Error 405 - newbie question <godzilla@stomp.stomp.tokyo>
        HTTP Question Marks? (L Hopkins)
        invalid page fault in MSHTML <nick@cheesypeas.demon.co.uk>
    Re: invalid page fault in MSHTML <ilya@martynov.org>
        log file to html <subscriber@novastar.dtdns.net>
    Re: Match/capture question <godzilla@stomp.stomp.tokyo>
        Perl/MS Access/IIS (bigbinc)
    Re: problem with File::Find::name? <ren@tivoli.com>
    Re: Problem/bug/oddity with void context?? <tinamue@zedat.fu-berlin.de>
    Re: Problem/bug/oddity with void context?? <bernie@fantasyfarm.com>
    Re: Problem/bug/oddity with void context?? <bart.lateur@skynet.be>
    Re: Regexp help - ??? (Tracy Gentry)
        se CGI qw(:standard); <todd@mrnoitall.com>
    Re: se CGI qw(:standard); <flavell@mail.cern.ch>
    Re: se CGI qw(:standard); <bart.lateur@skynet.be>
        Search script prob - help a newbie? (Jeff Williams)
        using a mail program to work on Windows NT servers (Steve)
    Re: What's the idiomatic way for this? (Craig Berry)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 26 Jul 2001 21:38:14 GMT
From: jtjohnston <jtjohnston@courrier.usherb.ca>
Subject: \nhelp
Message-Id: <3B608E68.B9EAD097@courrier.usherb.ca>

Hi,
I have a text file I use as a database. I have many instances of lines
starting with "&&4;" Can someone show me how to re-attach the "&&4;" to
the previous line?

See following example:

---snip---
Record1¶field2¶field3¶field4¶field5¶field6¶field7¶
Record2¶field2¶field3¶
&&4; field4¶field5¶field6¶field7¶
Record3¶field2¶field3¶field4¶field5¶field6¶field7¶
---snip---

Becomes:

----snip---
Record1¶field2¶field3¶field4¶field5¶field6¶field7¶
Record2¶field2¶field3¶&&4; field4¶field5¶field6¶field7¶
Record3¶field2¶field3¶field4¶field5¶field6¶field7¶
----snip---


What do I do here?

    if ( ! open(INPUT1,"<$file1") ) {
        die("Can't open file \"$file1\" : $!\n");
    }
#$buffer1 = <INPUT1>
#$ = ~s///g;

    close INPUT1;
}


Thanks,

john
(An email post and reply would be helpful.)



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

Date: Thu, 26 Jul 2001 14:40:37 -0700
From: BCC <a@b.c>
Subject: Apache and mod_perl?
Message-Id: <3B608E55.D3ABAF89@b.c>

Hi, which newsgroups are best to use to ask questions about:
1. Configuring Apache with mod_perl
2. How to write/convert perl scripts to use mod_perl?

I have been reading perl.apache.org/guide/ and every other document I
can find, but I still have questions...
for example how do I convert this basic script to work with mod_perl?

#!/usr/bin/perl -w

use CGI qw(:standard);
use CGI::Carp 'fatalsToBrowser';
use strict;

my $query = new CGI;

my $element1 = param("formElement1");
my $element2 = param("formElement2");

$element1 = "" if !$element1;
$element2 = "" if !$element2;

print header();
print start_html();
print "CGI Test page!";
print end_html();

Is it simply a matter of placing it in the right /perl dir after
configuring apache?  I dont think so, but Im not clear on what I need to
do.

Thanks,
Bryan


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

Date: 26 Jul 2001 13:44:00 -0700
From: suitti@yahoo.com (Stephen Uitti)
Subject: argv or getopt on Windows 2000 pro
Message-Id: <6f9c7a55.0107261244.314ac7e9@posting.google.com>

First, I read all the related articles from 1997 on by searching google.
I tried:

FTYPE tst.pl=perl.exe %1 %*
FTYPE tst.pl=perl.exe "%1" %*
PerlScript=perl.exe %1 %*
Perl=c:\perl\nsPerl5.005_03\nsperl.exe "%1" %*

and even dorked around with RegEdit.

etc., to no avail.  (At least things aren't worse).

Under Linux, this script works:

#!/usr/bin/perl
use Getopt::Long;
my $cnt = 10;			# Default # of files.
GetOptions("cnt=i" => \$cnt);
print "$cnt\n";

% tst.pl --c=12
12

But under Windows 2000 Pro, from the cmd prompt (they're not calling it DOS,
I guess), I get:

C:\>tst.pl --c=12
10

I've tried looking at ARGV[0] directly (there's nothing there under Windows,
even though the exact same code works under Linux.)

This is NOT CGI, just the command line.

OK, I admit it.  Though I've used Unix for 19 years, and
perl was my primary language for more than two years, this
is my first perl forray on any Windows.  Most things work.  For example,
DirHandle
File::stat
File::copy
Net::FTP
Mail::Sendmail
all work great.

The other upcoming problem: Can Perl be used to read/move email
messages in Outlook?  A vbs script appears to be using a MAPI
session... really ugly strings used as IDs...
Perhaps there's a better way.

Any help is appreciated.
Stephen.


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

Date: Thu, 26 Jul 2001 12:19:54 -0700
From: "Brian D. Green" <greenbd@u.washington.edu>
Subject: CGI:standard
Message-Id: <Pine.A41.4.33.0107261204510.118800-100000@dante38.u.washington.edu>

Hello,

I'm trying to print all of a form's data into a file, with each item
separated by a pipe. I looked up the CGI documentation at perldoc.com, but
I'm still having trouble. In the shell, the script just prints the header
and hangs. In a browser, my HTML response (not shown here) appears, but
no data are written anywhere. Please help me!

#!/usr/local/bin/perl -w
use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser);
print header;

$query = new CGI(\*STDIN);

@items = $query->param;
$netid = $ENV{'REMOTE_USER'};
open(SAVE, ">>$netid.out") || die("Can't open $netid.out for writing: $!\n");
foreach $item (@items) {
	chomp ($item);
	print "$item|";
}
print "\n";

close(SAVE);

Thanks much,
Brian Green			http://students.washington.edu/greenbd/

O-----------------------------------------------------------------------O
|"I am not ashamed of the gospel, because it is the power of God for the|
|  salvation of everyone who believes: first for the Jew, then for the  |
|    Gentile."					 --Romans 1:16, NIV     |
O-----------------------------------------------------------------------O



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

Date: 26 Jul 2001 19:48:09 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: CGI:standard
Message-Id: <9jps5p$11v62$2@fu-berlin.de>

Brian D. Green <greenbd@u.washington.edu> wrote:

> I'm trying to print all of a form's data into a file, with each item
> separated by a pipe. I looked up the CGI documentation at perldoc.com, but
> I'm still having trouble. In the shell, the script just prints the header
> and hangs. In a browser, my HTML response (not shown here) appears, but
> no data are written anywhere. Please help me!

> #!/usr/local/bin/perl -w
> use CGI qw/:standard/;

here you are creating a new CGI object which you can access
via the methods which are imported via :standard, like
param("test"), header(), ...

> use CGI::Carp qw(fatalsToBrowser);
> print header;

> $query = new CGI(\*STDIN);

here you are creating a new CGI object, but as the STDIN is
read already, the program waits for the next STDIN.
just do
$query = new CGI;

regards,
tina

-- 
http://www.tinita.de \  enter__| |__the___ _ _ ___
tina's moviedatabase  \     / _` / _ \/ _ \ '_(_-< of
search & add comments  \    \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanks


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

Date: 26 Jul 2001 11:06:42 -0700
From: stmintz@yahoo.com (Sean Mintz)
Subject: chess in perl
Message-Id: <abf786a.0107261006.3b9708c0@posting.google.com>

Hi,

I've been working for the past few months on a chess playing program
in Perl. It's gone through many complete rewrites and neverending
modifications.

I even have it playing on FICS ( the Free Internet Chess Server )
under the handle "Goober". ( the version playing on FICS is
old,slow,bad )

The version I'm working on now can generate pseudo legal moves,
including castling and en passant. Here's an example of what you can
do:

   use strict;
   use Goober;

   my $fen = new(); # if you want to use a first move setup board
                    # otherwise just feed it any FEN you want

   my %pos = fen_to_full($fen); # position it likes to use on the
inside

   display(%pos); # see the nice board..

   my @moves = generate_moves(%pos);
   print "found " , $#moves+1 , " moves -> @moves\n";

I have had prior versions check legality of moves (is the king in
check?), but even this is slow.

The code is at http://www.coe.uh.edu/~smintz/goober/new/Goober.pm

Please help me! Speed is -very- important and I don't know what else
to do to make it faster.

I haven't even done make_move and generate_legal - those will make it
take even longer!

Any ideas you may have to speeding this up in any area would be
greatly appreciated. If you have any interest in actually working on
this with me, that would be even better.

Please post or email me back!


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

Date: Thu, 26 Jul 2001 11:11:39 -0700
From: Badari Kakumani <badarik@yahoo.com>
Subject: Re: emacs etags default in cperl mode
Message-Id: <3B605D5A.D813CF42@yahoo.com>



Ilya Zakharevich wrote:

> [A complimentary Cc of this posting was sent to
> Badari Kakumani
> <badarik@yahoo.com>], who wrote in article <3B5E0259.E3348BC5@yahoo.com>:
> > folks,
> >
> > i use emacs cperl mode for writing the perl code.
> > i am starting to use etags facility. when i search
> > for a tag using M-. (find-tag) command in emacs, the default
> > appears to be the word at which the cursor is
> > located. typical perl function calls we have
> > are of the form <package>::<function> and that is
> > selected as the default. but etags needs only <function>
> > to find the tag.
>
> You have broken tag files.  Tag files constructed by CPerl contains
> tags for both forms.
>

wow! did not realize that you are the author ofthe wonderful cperl mode. perl
community is greately
indebted to you.

when i used 'etags' directory, it created tags
WITHOUT the package prefix. when i created
tags with emacs menu item Perl->Tools->Tags->Create_xxx
i got the tag created just with the package-prefix.
any reason that you can think of that is preventing
creation of tags both with and without package prefix?

cperl mode appears to provide lot of features that
i am starting to learn. apart from the file
cperl-mode.el, is there any info-file/html documentation
for cperl mode?

thanks,
-badari


> Ilya





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

Date: Thu, 26 Jul 2001 20:33:22 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: emacs etags default in cperl mode
Message-Id: <9jpuqi$qg1$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Badari Kakumani 
<badarik@yahoo.com>], who wrote in article <3B605D5A.D813CF42@yahoo.com>:
> Ilya Zakharevich wrote:
> > You have broken tag files.  Tag files constructed by CPerl contains
> > tags for both forms.

> wow! did not realize that you are the author ofthe wonderful cperl mode. perl
> community is greately
> indebted to you.

Then do not send "Blind Cc"s.  If you copy your postings by mail, mark
it as such (see above for an example).

> when i used 'etags' directory, it created tags
> WITHOUT the package prefix. when i created
> tags with emacs menu item Perl->Tools->Tags->Create_xxx
> i got the tag created just with the package-prefix.

Then this is an oversight of CPerl.  Looks like later I realized that
*both* forms are needed, but did not update CPerl (I updated others
tag-generating tools I use).

The "bare" form is not strictly needed, Emacs will find it anyway.
But withoug it it may provide the choices in a less-than-optimal order
(I mean C-u M-. cycling).


Ilya


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

Date: 26 Jul 2001 15:19:47 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Extract the relative sorting of items from multiple lists
Message-Id: <m3u1zzl9y4.fsf@dhcp9-161.support.tivoli.com>

On Fri, 27 Jul 2001, test@localhost.localdomain wrote:

[snipped Bart's problem description because though it is highly relevant, I
couldn't find a suitably short portion to include.]

> If I correctly understand the problem, then:

I don't think you have.  Though your code works on the original data,
that is just a coincidence of the fact that the original data happens
to use an ordering that matches with Perl's default sort order.
Switching to your second data produces:

# 1 A B E F H I M P Q S T W Y

This is just the regular sorted data with duplicates removed.  It
could be generated more directly with something like:

print join(" ", sort do { my %u; @u{map { @$_ } @list} = (); keys %u }), "\n";

or, if you loathe that combination of join, " " and "\n" as much as I
do, you can use:

print "@{[ sort do { my %u; @u{map { @$_ } @list} = (); keys %u } ]}\n";

[code snipped -- it just seemed more balanced that way after snipping
the problem :)]

As to an algorithm to solve the original problem, that is more tricky.
My first pass is to build a graph of the elements and then remove
short-cuts.  If you want to be able to handle bad data, then you'll
have to include loop detection.

-- 
Ren Maddox
ren@tivoli.com


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

Date: Thu, 26 Jul 2001 21:52:47 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Extract the relative sorting of items from multiple lists
Message-Id: <us31mtk8ei801j63am4us4r47pkudr0vma@4ax.com>

Ren Maddox wrote:

>> If I correctly understand the problem, then:
>
>I don't think you have.  Though your code works on the original data,
>that is just a coincidence of the fact that the original data happens
>to use an ordering that matches with Perl's default sort order.

Indeed. The strings I used, and their ordering, were chosen for ease of
not constantly having to look up what order was asked for. Of course, in
such a case, it's easy to cheat in order to get the desired result, as
this person did. But, the strings themselves are irrelevant.

>As to an algorithm to solve the original problem, that is more tricky.
>My first pass is to build a graph of the elements and then remove
>short-cuts.  If you want to be able to handle bad data, then you'll
>have to include loop detection.

A graph, huh? I'm thinking of pools of currently equivalent items (a
hash?),in an array, that get split up as more gets known about them. But
I'm still contemplating the details.

-- 
	Bart.


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

Date: Thu, 26 Jul 2001 18:17:20 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How do I unescape a string?
Message-Id: <Q8Z77.81$os9.170972672@news.frii.net>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.

+
  How do I unescape a string?

    It depends just what you mean by ``escape''. URL escapes are dealt with
    in the perlfaq9 manpage. Shell escapes with the backslash ("\")
    character are removed with

        s/\\(.)/$1/g;

    This won't expand ""\n"" or ""\t"" or any other special escapes.

- 

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to

    news:news.answers

or to the many thousands of other useful Usenet news groups.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-1999 Tom Christiansen and Nathan
    Torkington.  All rights reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.

                                                           04.18
-- 
    This space intentionally left blank


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

Date: Thu, 26 Jul 2001 21:00:05 +0200
From: Philip Newton <pne-news-20010726@newton.digitalspace.net>
Subject: Re: Finding a word in a sorted list.
Message-Id: <q0q0mtouhv6bvdaih16rv4s3i0farc3bgm@4ax.com>

On 25 Jul 2001 16:08:19 -0700, mariorizzuti@yahoo.com (Mario Rizzuti)
wrote:

> my @stats = stat "user.ind";
> my $max = $stats[7] / 18;     # how many records

As an aside, if you're not using @stats for anything else, you could
write this as

    my $max = (stat "user.ind")[7] / 18;

, but better in this case would probably be

    my $max = (-s "user.ind") / 18;

 .

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: Thu, 26 Jul 2001 21:35:21 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Finding a word in a sorted list.
Message-Id: <bb31mt8lcbcgn41u6ebb4iemkfsqhbnkup@4ax.com>

Mario Rizzuti wrote:

>I have a fixed-length-records file where:
>
>* each record is 18 bytes made by an username (12 bytes) and a number
>(6 bytes).
>* the records are sorted alphabetically.
>
>I am wondering what is the fastest possible way to find the associated
>numbers of a given list of usernames?

Theoretically: binary search. I would think.

-- 
	Bart.


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

Date: Thu, 26 Jul 2001 19:12:30 GMT
From: slash@dot.c.o.m.org
Subject: Godzilla - Hot air, no substance. (was Re: Regular expression question.)
Message-Id: <3b606b99.2929031@news.freeserve.co.uk>

On Thu, 26 Jul 2001 08:41:04 -0700, "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:

>Randal L. Schwartz wrote:
> 
>> >>>>> Godzilla! wrote:
>
>
>(snipped, topic: use of \1 and eval for a regex substitution)
>
>
>> Godzilla!> True Perl programmers know what they can do and,
>> Godzilla!> what they cannot do.
> 
>> You can do what you want.
>
>Darn tootin' I can! It is annoying to read these Sissified Geeks
>posting dictates in the vain of,
>
>  "Never do that."
>  "You can never do that."
>  "Always use strict."
>  "Always use || die."

I'll add a few to that:

"Don't stick your head out of a train window."
"Don't eat strange looking mushrooms."
"Don't jump out of a plane with an unsafe parachute."
"Don't stick your face in a fan."

Give them a go, then come back later to tell us all of your findings...

>This is mindless dribble. An appropriate response would be
>along the lines of,
>
>"Be careful about using this syntax. You might experience
> some problems. Here is a reference source explanation...."
>
>
>> We're just warning you that you're using....
>
>> Do what you want in the privacy of your own cubicle, Kira.
>
>I would think by now you would realize I cannot be confined
>to neither a cubicle nor a cage, much less gagged and bound.

I bet you're fat. No doubt it's impossible to shoe-horn you into a cubicle, and no
zoos would take a non-earner. As for being gagged and bound, we're talking serious
quantities of rope, and who on earth would wish to get that close to your mouth
anyway? After all, it constantly spews crap, so it's not going to be "gargle fresh"
is it?

>> But let the manual dictate how Perl was intended to be used.
> 
>I have issued no dictates. Others have and routinely do.

Begin paste:======================================================================

In Message-ID: <3B50FBE8.E9F4A1E9@stomp.stomp.tokyo>
Godzilla! wrote:

> All of my 'standard' webpages are *.shtml using SSI. 
> This is great in that I can have a standard template
> file for header, navigation menu and footer of
> my pages by using the...

This is untrue. You cannot include one file and
create both a header and a footer with whatever
included between those two.

End paste:========================================================================

[[wrong]]

Could include javascript to generate content on the fly or CSS
positioned block elements on a page.


Begin paste:======================================================================

In Message-ID: <3B547117.400259DF@stomp.stomp.tokyo>
Godzilla! wrote:

Headers are either correct or incorrect; no randomness involved.

End paste:========================================================================

[[wrong]]

Depends upon the content of the fields within the header. You try to
send http-cookies down with data including line-feeds and see what happens.


Begin paste:======================================================================

In Message-ID: <3B54A97F.9E65671C@stomp.stomp.tokyo>
Godzilla! wrote:

Your code contains three fatal syntax errors. Your use
of fopen / fclose is intended for POSIX, PerlIO, ANSI C,
early Hewlett-Packard systems, VMS and a few other obscure
circumstances. Use open () and close () for standard
Perl usage.

End paste:========================================================================

etc,etc,etc,etc,etc,etc

Isn't usenet wonderful?


>This is highly objectionable and is contrary to the
>spirit of programming;

Maybe that should be your entry in the new Oxford dictionary...

>Returning to \1 syntax, this is syntax I do not use.

Could you try to write a bit "gooder"?

>  "It is irresponsible and unethical to play Petty Dictator in Life."

And our word for today is "Irony"...

It's sad to see you wobbling around in here like some punch-drunk boxer; being proven
wrong time and time again, yet still coming back for more. Don't you have any self
respect? Why is your hubby letting you make a fool of yourself in public?



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

Date: 26 Jul 2001 19:03:33 GMT
From: TGVCDPVNTLMI@spammotel.com (Ronald Blaschke)
Subject: Re: How to loop over files whose names are listed in a file
Message-Id: <9jppi5$1003b$1@ID-57488.news.dfncis.de>

On 26 Jul 2001 09:11:54 -0700, Francois Boury <fboury@lequipe.fr> wrote:
> Sorry if my question is obvious but I do not use Perl often an I just
> able to modify existing code.
> 
> So I have a file (files_list.txt fro instance) that contains some file
> names.
> 
> How to replace my actual piece of code that is :
> while(<*.html>)
> {
> 	my $fichier_out=$fichier . ".tmp";
> 	remplacerBreves($_,$fichier_out);
> }
> 
> by the same thing for all the files listed in files_list.txt ?

Assuming file_list.txt contains one file name per line, I would
say something like:

my $filelist = "$file_list.txt";
open IN, "<$filelist" or die "Unable to open $filelist: $!";
my @files = map {chomp;$_} <IN>;
close IN or die "Unable to close $filelist: $!";

foreach (@files)
{
   ## do what you did before
   my $fichier_out=$fichier . ".tmp";
   remplacerBreves($_,$fichier_out);
}

-- 


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

Date: 26 Jul 2001 18:26:10 GMT
From: tghtgh@aol.com (Tghtgh)
Subject: HTTP Error 405 - newbie question
Message-Id: <20010726142610.07770.00000840@ng-xa1.aol.com>

I have my perl script in the cgi-bin directory but i get this error:

HTTP Error 405
405 Method Not Allowed

The method specified in the Request Line is not allowed for the resource
identified by the request. Please ensure that you have the proper MIME type set
up for the resource you are requesting.

Please contact the server's administrator if this problem persists.

any help would be appreciated

thanks


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

Date: 26 Jul 2001 18:35:40 GMT
From: steveo@panix.com (Steven M. O'Neill)
Subject: Re: HTTP Error 405 - newbie question
Message-Id: <9jpnts$g5m$3@news.panix.com>

Tghtgh <tghtgh@aol.com> wrote:
>I have my perl script in the cgi-bin directory but i get this error:
>
>HTTP Error 405
>405 Method Not Allowed
>
>The method specified in the Request Line is not allowed for the resource
>identified by the request. Please ensure that you have the proper MIME type set
>up for the resource you are requesting.
>
>Please contact the server's administrator if this problem persists.
>
>any help would be appreciated

http://groups.google.com/groups?q=405+Method+Not+Allowed
-- 
Steven O'Neill                                          steveo@panix.com
                                                       www.cars-suck.org


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

Date: Thu, 26 Jul 2001 11:44:50 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: HTTP Error 405 - newbie question
Message-Id: <3B606522.83D4216F@stomp.stomp.tokyo>

Tghtgh wrote:
 
> I have my perl script in the cgi-bin directory but i get this error:
 
> HTTP Error 405
> 405 Method Not Allowed
 

You must be a very busy boy to not have time to
research and read about this error message.

http://www.checkupdown.com/status/E405.html

Why have you not included what method you
are attempting to employ?


Godzilla!


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

Date: 26 Jul 2001 12:35:16 -0700
From: hopkins@syndesis.com (L Hopkins)
Subject: HTTP Question Marks?
Message-Id: <65fbefdb.0107261135.17515c50@posting.google.com>

I apologize in advance, however I can't seem to find an http
newsgroup.

I need to create a mailto, and as the syntax goes, '?' is the first
character if a blank mailto.  My problem is that I need a '?' in the
subject, for example I need the subject to look like the following:

?subject=test&body=http://localhost/page.cgi?id=456

This works correctly for Netscape's mail client, however Outlook just
chokes on everything past the second question mark.  Is there an
escape character that works for both mail clients?

Thanks in advance.


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

Date: Thu, 26 Jul 2001 20:42:57 +0100
From: Nick Robinson <nick@cheesypeas.demon.co.uk>
Subject: invalid page fault in MSHTML
Message-Id: <3L4AcAABLHY7EwDl@cheesypeas.demon.co.uk>

Hi - I'm working on a shopping cart script with a variety of form submit
options - IE 5 keeps crashing with the massage "invalid page fault in
MSHTML". Is there anything obvious I should look for?
 
all the best, 
  
Nick Robinson

Pre-1960's Ladybird books always wanted!


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

Date: 26 Jul 2001 23:55:45 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: invalid page fault in MSHTML
Message-Id: <87r8v34g8u.fsf@abra.ru>


NR> Hi - I'm working on a shopping cart script with a variety of form submit
NR> options - IE 5 keeps crashing with the massage "invalid page fault in
NR> MSHTML". Is there anything obvious I should look for?

Look for IE patch :)

Seriously try to check with HTML validator if HTML code of shopping
cart is correct. Probably bad HTML code crashes IE.
-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: Thu, 26 Jul 2001 22:51:24 +0300
From: "novastar" <subscriber@novastar.dtdns.net>
Subject: log file to html
Message-Id: <9jps9e$lis$1@usenet.otenet.gr>

I have a perl program that generates a really big log file ( printed to
screen also ) . I thought that it would me more intresting for the users
watching the log file entries  to Internet Explorer at real time . So I
created a framed page . The bottom is the log file with a refresh period of
one second, but this is not smooth ( blocks of text every 1 sec ) . Can you
help me ?




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

Date: Thu, 26 Jul 2001 12:18:16 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Match/capture question
Message-Id: <3B606CF8.960DD08E@stomp.stomp.tokyo>

Mark Riehl wrote:
 
> I've got a data file that has the following format:
 
> T0623DP00,...
> T0624DS00,...
> ...
 
> I'm interested only in the number portion w/o the leading 0.

(snipped)

Very poorly stated parameters. A presumption is made
you are working with a data file and, your "..." indicates
more records of the same format. You do not indicate
if there is a space after each comma or the beginning
of the next record or whatever. Because your parameters
are unclear, I have included a space after each comma
simply for clarity. You will need to adjust my numbers
if this is not the case.

This test code below my signature can be wrapped in a
while loop if you are reading line-by-line. It is a
guessing game on what you are actually doing based on
both your unclear parameters and unclear code sample.

Nonetheless, there is no need for a split created array
and no need for a regex. You will discover substr ()
to be exceptionally efficient for what you appear
to be doing.

In the future, work towards providing clear and concise
parameters, work towards providing equally clear and
concise code samples and, most important, word your
articles in a manner which can be readily understood.
Doing this will benefit both you and the reader.


Godzilla!
--
TEST SCRIPT:
____________


#!perl

print "Content-type: text/plain\n\n";

$data = "T0623DP00, T0624DS00, T0623DP00, T0624DS00";

$start = 2;

do
 {
  print substr ($data, $start, 3), "\n";
  $start = $start + 11;
 }
until ($start > length ($data));

exit;


PRINTED RESULTS:
________________

623
624
623
624


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

Date: 26 Jul 2001 12:28:13 -0700
From: bigbinc@hotmail.com (bigbinc)
Subject: Perl/MS Access/IIS
Message-Id: <d1b33313.0107261128.2b0e226a@posting.google.com>

I am trying to a implement a relatively simple database using access
or perl through our NT server.  The only thing is what is the best
solution.  I have
an expanding directory of files that are stored on our web site. 
Files are constantly being added to the web server drive.  Our
solution thus far is to have the files just sit in the directory and
people just access the site and there is a long list of files totally
about 4000 files.  I need to sort these files and have them indexed by
the information in the files.  I would also like to search for
specific key words in the files.  And also this should be done on
the website.  I am thinking that perl is the best way to solve this
problem because it can search through text files(the files I am adding
are text).  But it seems like access would be the easiest.  Another
problem, how would I get data from these 4000 html based files into an
access database?  SQL would solve everything, but we are not running a
sql server.  And then to interface with the web page, do I use asp,
perl, vbscripting.. hmmm
I know perl the best, but asp, vbscripting, and access aren't hard to
learn.

any ideas?


Berlin Brown
bigbinc@hotmail.com


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

Date: 26 Jul 2001 14:37:03 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: problem with File::Find::name?
Message-Id: <m3y9pblbxc.fsf@dhcp9-161.support.tivoli.com>

On Thu, 26 Jul 2001, kirbyr@ucar.edu wrote:

> Bart Lateur wrote:
>> 
>> Rob Kirby wrote:
>> 
>> >And I notice that when I have a filename that contains spaces,the
>> >$File::Find::name locks up the find.
>> 
>> It can't be $File::find::name itself. What OS+perl are you on?
> 
> I was able to fix the find lockup on filenames containing spaces by
> quoting the $File::Find::name like this:
> 
> print TMPFILE "$atime $ino '$File::Find::name'\n";

Sounds like TMPFILE is a pipe and the receiving program couldn't
handle the spaces.  Adding those quotes would have no effect on the
execution of the Perl script, but it could certainly affect any
external interaction.

-- 
Ren Maddox
ren@tivoli.com


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

Date: 26 Jul 2001 19:34:19 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: Problem/bug/oddity with void context??
Message-Id: <9jprbr$11v62$1@fu-berlin.de>

Bernard Cosell <bernie@fantasyfarm.com> wrote:
> I've been going nuts and I've isolated the problem down to something
> VERY strange having to do with null context.    This all with:

> This is perl, v5.6.1 built for i686-linux

> What I'm trying to do is lock a file.  In a file I "require" into this
> program, I do:

> ====================
> use Fcntl ;
> use FileHandle ;

> sub lockfile
> {
>     my $FH = new FileHandle $_[0], "+<" ;
>     warn("Error opening $_[0]: $!"), return undef unless $FH ;
>     return undef unless lockit($FH) ;
>     return $FH ;
> }

> sub lockit
> {
>     my $handle = $_[0] ;
>     flock ($handle, 2) ;
>     return 1;
> }
> ====================================

> Now, I have a program that does:

> =====================
> my $FH ;
> # $FH = lockfile("/tmp/lock.me") or die "Couldn't lock!" ;
> lockfile("/tmp/lock.me") or die "Couldn't lock!" ;

here you throw away the return value, which is the filehandle.

> print "Say when --- " ;
> <STDIN> ;
> exit ;
> =====================

> And I run two copies of it [from two different telnet sessions to the
> same host].

> Notice the two lines with the call to lockfile.  In the way the
> program is above, the two instances do NOT block each other: I look
> and it just says "Say when.." in both terminal windows.   BUT: if I
> change the comment, and make it "$FH = ... or die" and comment out the
> other, then it works perfectly, and the second instance waits for the
> first just as it has.

> I can't figure out what should be different about the two-level-deep
> call to "lockit" depending on whether the original call was an
> assignment or just a 'null' function call...  Any insights about
> what's going on here would be appreciated...

i guess perl recognizes that there is no reference to the filehandle
any more, because you defined it in the sub lockfile().
if a filehandle goes out of scope, it's automatically
closed/unlocked. that's at least what i think what's happening here...
so if you run one instance, it's locked and then unlocked again, then
you start the next instance.
HTH,
tina

-- 
http://www.tinita.de \  enter__| |__the___ _ _ ___
tina's moviedatabase  \     / _` / _ \/ _ \ '_(_-< of
search & add comments  \    \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanks


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

Date: Thu, 26 Jul 2001 15:39:00 -0400
From: Bernard Cosell <bernie@fantasyfarm.com>
Subject: Re: Problem/bug/oddity with void context??
Message-Id: <rnr0mtk6ko6oj1bnc0cqpqpn13idlbb0dc@4ax.com>

On Thu, 26 Jul 2001 15:10:45 -0400, Bernard Cosell
<bernie@fantasyfarm.com> wrote:

sigh.... **NEVERMIND*** ... sigh...

} use Fcntl ;
} use FileHandle ;
} 
} sub lockfile
} {
}     return $FH ;
} }
==========================
} # $FH = lockfile("/tmp/lock.me") or die "Couldn't lock!" ;
} lockfile("/tmp/lock.me") or die "Couldn't lock!" ;
==========================

DUH!!!  I've done too many years of Perl programming with
   "open (FH, ...) or die"
and have only recently begun playing around with "use FileHandle", so
I managed to overlook the obvious.

With open, the file stays open until closed or the program exits.  So
the version of this little program that did:
   open (FH, ....) or die ;
   flock (FH, 2)
worked perfectly.  When I moved the locking machinery into a
subroutine I changed the code to use 'FileHandle' and obviously didn't
carefully enough think through the implications of returning FH's and
having to keep them in-scope for as long as I want the file to be
open/locked....

  /Bernie\
-- 
Bernie Cosell                        mailto:bernie@rev.net
Roanoke Electronic Village


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

Date: Thu, 26 Jul 2001 21:59:50 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Problem/bug/oddity with void context??
Message-Id: <4j41mtoqbbpni2ba16ic56aj37e3nlel3i@4ax.com>

Bernard Cosell wrote:

>DUH!!!  I've done too many years of Perl programming with
>   "open (FH, ...) or die"
>and have only recently begun playing around with "use FileHandle", so
>I managed to overlook the obvious.

Perhaps, using 5.6 or later, you should also reconsider trying out:

	{
	    open my $FH, '+<', shift;
	    return $FH;
	}

which also returns the filehandle.

-- 
	Bart.


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

Date: 26 Jul 2001 12:08:28 -0700
From: tracy_gentry@yahoo.com (Tracy Gentry)
Subject: Re: Regexp help - ???
Message-Id: <9d356f64.0107261108.123157e7@posting.google.com>

"Tom Melly" <tom.melly@ccl.com> wrote in message news:<3b602d71$0$3755$ed9e5944@reading.news.pipex.net>...
> "Tracy Gentry" <tracy_gentry@yahoo.com> wrote in message
> news:9d356f64.0107260448.52d34b66@posting.google.com...
> 
> >
> > ...|"(0{0,1}2/29/20[02468][48]{0,1})|"|...
> >
> > This line validates a subset of the valid leap years for this century.
> > As coded, 02/29/200 and 02/29/2004 will match, but 02/29/20 won't and
> > I want it to. Is there a way to denote a character as optional if no
> > other characters appear after it, but required if more characters
> > follow? Or maybe some sort of grouping?
> 
> Hmm, well there's a lot of ways to do it, but a quick fix would be:
> 
>  ...|"(0{0,1}2/29/20($|[02468][48]{0,1}))|"|...
> 
> ... however this assumes that "$" would match the end of your input date and
> that you don't mind grabbing it.
> 
> This is probably more thorough:
> 
>  ...|"(0{0,1}2/29/20((?=$|\D)|([02468][48]{0,1})))|"|...
> 
> The (?=foo) is a 0-width look-ahead.

Thanks! That did the trick.

Tracy


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

Date: Thu, 26 Jul 2001 14:14:24 -0600
From: Todd Anderson <todd@mrnoitall.com>
Subject: se CGI qw(:standard);
Message-Id: <3B607A1A.D2837E38@mrnoitall.com>

Dear Hackers,
I am using "use CGI qw(:standard);"
In the past when using cgi-lib.pl ...
I could do this... $form_data{'pagename'} = $form_data('glockenspider');

When I try it with "CGI" ... param('pagename') = param('glockenspider');

it doesn't work... Any ideas are appreciated.
Thanks in advance
for your help





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

Date: Thu, 26 Jul 2001 22:23:04 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: se CGI qw(:standard);
Message-Id: <Pine.LNX.4.30.0107262212200.3769-100000@lxplus023.cern.ch>

On Jul 26, Todd Anderson delicately tapped the keys:

> Dear Hackers,

not a promising start, and the Subject line needs to be given the
attention that its importance deserves.

> I am using "use CGI qw(:standard);"
> In the past when using cgi-lib.pl ...
> I could do this... $form_data{'pagename'} = $form_data('glockenspider');

You asked this three days ago, and got two answers that seemed to have
understood better than many of us did what it is that you might have
been attempting.

In general I'd counsel you not to ask (or at least, not _merely_ to
ask) 'here's my old solution' (to some unstated requirement) 'how
should I do it now'.  Better to explain what you're trying to achieve.

Perhaps you're trying to compose a new form with some values taken
from the previous form submission.  Or maybe something else.  We just
don't know until you tell us.

If you weren't satisfied with the answers you got, then try to think
out why.  Post a followup and explain your misgivings.  If you haven't
seen any answers, maybe the news server was bad, or maybe nobody
understood your problem.  It's rude to simply plonk down the same
question over again without any comment about the fact that it's a
repeat.

> it doesn't work...

That's an absolute killer.

This group, I have found, can be very helpful to those who give an
impression of trying to help themselves.



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

Date: Thu, 26 Jul 2001 21:43:13 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: se CGI qw(:standard);
Message-Id: <jg31mtsjdjp698jg82krgscmta2l8c5los@4ax.com>

Todd Anderson wrote:

>In the past when using cgi-lib.pl ...
>I could do this... $form_data{'pagename'} = $form_data('glockenspider');
>
>When I try it with "CGI" ... param('pagename') = param('glockenspider');

Perhaps:

	param('pagename', param('glockenspider'));

I don't really use CGI.pm, but I do know that extra parameters may be
used to alter a value. (If this one doesn't work, then try the
$query->param syntax.)

-- 
	Bart.


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

Date: 26 Jul 2001 12:13:54 -0700
From: basscadet75@yahoo.com (Jeff Williams)
Subject: Search script prob - help a newbie?
Message-Id: <7a2c8267.0107261113.1ef6aef4@posting.google.com>

Hello all,

I'm not a perl programmer, but I'm sort of trying to learn as I go
along - I downloaded a perl search script (yes, I've tried emailing
the creators for help) and it does work but I'm having a problem which
seems like it should be a simple fix if I could just figure out
*where* the problem's coming from.  Take a look at my site:
http://www.channel3games.com, and do a search for a common phrase on
my site - try Atari 2600, for example.  The search results display
fine but try to move to the second page of results and you'll see my
problem.  The results are there if you manually alter the url, but
somehow the search object is not being defined properly in the links
going to the next page.  I've defined all my urls and paths properly
in my cgi files.

The script I'm using is ksearch, from kscripts.com.  It's a great
script when it works...

I know it's a longshot, but as I said this *looks* like it'd be an
easy fix for someone who knows perl so maybe it's something someone
out there will be able to identify just by doing a search on my site. 
I hope, anyway... otherwise I'll be in the market for another script,
I guess.

TIA,

// Jeff Williams
// http://www.channel3games.com


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

Date: 26 Jul 2001 13:56:56 -0700
From: Distortedrainbow@aol.com (Steve)
Subject: using a mail program to work on Windows NT servers
Message-Id: <e248867d.0107261256.11ea408c@posting.google.com>

Hi,
I've been reviewing a great many threads regarding sending email on on
NT boxes, but hardly ever in layman's terms.

I've downloaded and installed net::smtp.  I'd like to use that in my
scripts.  Now, one web site i'm working on is on an NT server.  I
assume if I'm calling on net::smtp in a script, then that module must
be uploaded to the cgi-bin directory on the server, is that correct? 
Is it also supposed to be in a particular path on my machine?  If so,
what's the proper path on my machine?

I've once uploaded smtp to my server, but am I supposed to set
permissions for it?

In executing one of these scripts on an NT server, I got a message
something like "Cannot locate net::smtp..." and it gave me locations
and mentioned something about @INC.  I really didn't understand the
message very well.

The bottom line is:  once the module is downloaded, where should it be
installed into and how can I get it to execute in a script?  I've read
the FAQ pages that came with Perl, but they were vague.

Any help would be greatly appreciated.

Thanks
Steve


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

Date: Thu, 26 Jul 2001 19:25:34 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: What's the idiomatic way for this?
Message-Id: <tm0rlel56usnf4@corp.supernews.com>

Alex (samara_biz@hotmail.com) wrote:
: I wrote this code for printing days in a calendar. The way it works is
: I have @grid array, which always has 42 elements. (Since maximum
: number of weeks is 6, 6*7 = 42). What I do I just print it 7 elements
: in a row.
: 
: for( my $i = 1; $i < 7; $i++ ){
:    print("<tr align=\"right\">\n");
:    my $s_ind = ($i - 1) * 7;
:    my $e_ind = $s_ind + 6;
:    foreach (@grid[$s_ind..$e_ind]){
:       print("<td>" . ($_ == 0 ? '&nbsp;' : $_ ) . "</td>\n");
:    } #foreach
:    print("<td width=\"20%\" align=\"right\">\&lt;$i</td>\n");
:    print("</tr>\n");
: } #for

I'd write it like this:

  foreach my $i (1..6) {
    print qq!<tr align="right">\n!;
    foreach (@grid[($i-1) * 7 .. ($i-1) * 7 + 6]) {
      printf "<td>%s</td>\n", $_ || '&nbsp;';
    }
    print qq!<td width="20%" align="right">&lt;$i</td>\n</tr>\n!;
  }

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Brute force done fast enough looks slick."
   |             - William Purves


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

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


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