[23501] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5711 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 25 14:06:17 2003

Date: Sat, 25 Oct 2003 11:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 25 Oct 2003     Volume: 10 Number: 5711

Today's topics:
    Re: Accessing C struct members via T_PTROBJ <tassilo.parseval@rwth-aachen.de>
        Cygwin and Microsoft SQL (John Call)
    Re: Cygwin and Microsoft SQL <jwillmore@remove.adelphia.net>
        exec() gives output?? <e02@removethis.toao.net>
    Re: exec() gives output?? <jurgenex@hotmail.com>
    Re: Further on Taint - exact code that has the problem <flavell@ph.gla.ac.uk>
        generating html from perl <nick@maproom.co.uk>
    Re: generating html from perl <noreply@gunnar.cc>
    Re: generating html from perl <nick@maproom.co.uk>
        how to do something <nospam@peng.nl>
    Re: how to do something <jwillmore@remove.adelphia.net>
        Is there a VAR to count the number of occurences of mat <member45680@dbforums.com>
    Re: Is there a VAR to count the number of occurences of <noreply@gunnar.cc>
    Re: Mason pipeline style <perl@my-header.org>
    Re: Mason pipeline style <perl@my-header.org>
        Outlook email headers <someone@somewhere.nl>
    Re: Outlook email headers <nospam@bigpond.com>
    Re: Outlook email headers <jwillmore@remove.adelphia.net>
    Re: Perl and IIS - script runs but 'The page cannot be  <barbr-en@online.no>
    Re: Perl and IIS - script runs but 'The page cannot be  <me@privacy.net>
    Re: Perl and IIS - script runs but 'The page cannot be  (Jay Tilton)
    Re: Perl and IIS - script runs but 'The page cannot be  <kuujinbo@hotmail.com>
        Portable @INC (Tielman de Villiers)
    Re: Portable @INC <invalid-email@rochester.rr.com>
    Re: while each hash, why not array (Greg Bacon)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 25 Oct 2003 10:05:56 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Accessing C struct members via T_PTROBJ
Message-Id: <bndhu4$cuq$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Mark Shelor:

> I recently wrote a Perl extension in which h2xs pretty much handled all 
> the XS details for me.  I now need to go back and access C struct 
> members from within Perl if possible.
> 
> The typemap file indicates that my struct pointer (SHA *) got mapped as 
> a T_PTROBJ.  Is there any way I can use this info to do reads and writes 
> on the various struct members?  Or, do I need to go back and write 
> accessor routines in C?

Usually, yes. This can be annoying for large structs but it's the price
you have to pay when speeding up Perl with a static language. Keep in
mind that there is no portable way to access members of a struct
dynamically in C so you always need to specify them literally. There are
some tricks to get at the byte offset of a member in a structure and
those could be used to read and set the values. But, as I said, those
are not portable. You'll find a demonstration of this technique in the
comp.lang.c FAQ.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: 25 Oct 2003 07:05:50 -0700
From: jcall@ellijay.com (John Call)
Subject: Cygwin and Microsoft SQL
Message-Id: <c2dc059.0310250605.1e81567b@posting.google.com>

Need to use Expect.pm on Win32. Read this is possible with Cygwin.
However, I need to interface with a Microsoft SQL database. Does
Cygwin create a virtual computer that doesn't know about windows or
should the perl in Cygwin be able to interface with the Microsoft SQL
using Win32::ODBC?

Thanks,

John


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

Date: Sat, 25 Oct 2003 17:39:08 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Cygwin and Microsoft SQL
Message-Id: <20031025133909.1739c92e.jwillmore@remove.adelphia.net>

On 25 Oct 2003 07:05:50 -0700
jcall@ellijay.com (John Call) wrote:
> Need to use Expect.pm on Win32. Read this is possible with Cygwin.
> However, I need to interface with a Microsoft SQL database. Does
> Cygwin create a virtual computer that doesn't know about windows or
> should the perl in Cygwin be able to interface with the Microsoft
> SQL using Win32::ODBC?

You should thinking about using the Win32::ODBC module -or- the DBI
module using the appropriate DBD module.

I'm not sure how Expect is suppose to factor into this - because both
Win32::ODBC and DBI (in this case) use the listening port on the
database server to connect.  Unless you're thinking about using Expect
to emulate a user - in which case I'm thinking you may need to
re-think you're thinking :-)

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
Talking much about oneself can also be a means to conceal
oneself.   -- Friedrich Nietzsche 


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

Date: Sat, 25 Oct 2003 17:36:40 GMT
From: "Experienced but Undocumented" <e02@removethis.toao.net>
Subject: exec() gives output??
Message-Id: <Iwymb.177405$pl3.89164@pd7tw3no>

Hi
I'd like to execute a command on the server from a PERL script.  This
particular command takes a long time to execute, so I would not like the
PERL script to wait for a response.  I was under the impression that exec()
would do the trick, but it doesn't...it seems to work the same as system().
Any suggestions?
Thanks!




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

Date: Sat, 25 Oct 2003 17:49:30 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: exec() gives output??
Message-Id: <KIymb.8624$AU.1638@nwrddc01.gnilink.net>

Experienced but Undocumented wrote:
> I'd like to execute a command on the server

What server? WAIS? NTFS? HTTP? FTP?

> from a PERL script.  This
> particular command takes a long time to execute, so I would not like
> the PERL script to wait for a response.  I was under the impression
> that exec() would do the trick, but it doesn't...

Well, it can't.
A successful call to exec() replaces the Perl script with whatever exec() is
calling. So there is nothing left that could possibly wait for a response
from exec().

> it seems to work the
> same as system().

That's not correct. As the manual clearly states:
    system LIST
    system PROGRAM LIST
            Does exactly the same thing as "exec LIST", except that a fork
            is done first, and the parent process waits for the child
            process to complete. [...]

Did you even bother to read even the first sentence of the documentation for
the functions you are using?

> Any suggestions?

Either start the external program from system() in the background (how to do
that depends on your OS and may not be possible on all OSes) or use fork().
Details please see the man page for fork.

jue




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

Date: Sat, 25 Oct 2003 13:49:04 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Further on Taint - exact code that has the problem
Message-Id: <Pine.LNX.4.53.0310251311450.15864@ppepc56.ph.gla.ac.uk>

On Wed, 22 Oct 2003, Ben wrote:

> <ASIDE> I find the perl documentation to be pretty poor in general...
> WAY too many assumptions made about what the reader knows, not enough
> example code and often, what example code you find there is pretty
> darned opaque.
[...]

My diagnosis here would be that you're keen to get your job done,
which is understandable, but not keen enough to take a moment to
familiarise yourself with what documentation is available and how best
to use it in your situation.

On the other hand if you really *can* do it better, then feel free to
step right up to the plate ;-)

(I've just needed to undertake a task in MS Excel, using its available
user documentation, after which the Perl documentation seems to be a
gift from Heaven.  And as for that demented paperclip... but I
digress...)

> Also, in perlsec, the following remark is found near the top:
>
> "Perl automatically enables a set of special security checks, called
> taint mode, when it detects its program running with differing real
> and effective user or group IDs."

Then bestir yourself to perldoc perlvar, where you will find the Perl
variables described which contain real and effective user and group
IDs; splice into your development copy of the script some code to
print these out at appropriate points, inspect them, and duly consider
the next move (if necessary, post here to tell us what you found).

> ...the implication seems to be that taint mode could get turned on
> very late, right at the point where the command is invoked, even if it
> wasn't on previously.

Fair comment

> That also leads me to think that taint might be
> screwing with things, even if the latest check prior to launch I can
> make clearly indicates it isn't.

"Might" be, but I'd be happier to see the results of a few simple
checks (such as noted above, plus my question - which you
side-stepped, but which I think may still be germane - to understand
better some important aspects of the environment - CGI? mod_perl?
setuid? - in which this server-side script is running) to help resolve
the situation.

I can't emphasise too strongly the benefits of stripping-down the
actual problem into a minimal testcase which exhibits the behaviour
of which you're complaining.  When you said:

| I apologize for any "woffling." I was attempting to provide all of
| the information I had.

I think the key point here was that a good problem description
contains *enough* *relevant* information: the point is well taken that
you may not yet know just exactly what is "enough" and what is
"relevant", but I was trying to hint that you had on the one hand
included too much extraneous detail (we needed to know that you wanted
to launch a long-running process and not wait for the result: all else
on that side was extraneous detail) while in the other hand missing
the detailed observations of what was happening.  OK, fair enough,
it's been clarified in the subsequent discussion as to why some of
that detail wasn't accessible to the invoking script, and I apologise
for initially missing that point.

And actually your report on the observed behaviour got muddled up with
your hunch as to why it was going wrong, which may well prove to be
right - but would be better kept apart until the hunch can be
confirmed or refuted.

I'm sorry that this isn't just a potted recipe to solve your problem,
but I think the above points were worth making, even though I don't
have that recipe on hand.  Good luck, and it would be useful to future
readers if you put on record how the issue got resolved.


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

Date: Sat, 25 Oct 2003 13:12:59 +0100
From: Nick Wedd <nick@maproom.co.uk>
Subject: generating html from perl
Message-Id: <UShm51ALjmm$EAGI@maproom.demon.co.uk>

I have an html page, which I want to generate from a cgi script.  I have 
tried to do this by putting the entire html into a script like this:


#!/usr/bin/perl -w

print <<Whole_file;

<html>
<head>
    .... all the rest of the html ....
</body>
</html>
Whole_file


This almost works.  But my html includes some javascript, which includes 
some escape sequences, some of which get expanded by this process.  It 
expands each "\n" in my javascript into "
", which I can live with.  But it also expands
     pattern = /\[([^)]+)/;
to
     pattern = /[([^)]+)/;
although it does not expand
     pattern = /\[([^(]*)\(([^)]*)\)([^]]*)/;


Is there a recommended way of getting round this?  Ideally, I would like 
it to leave all the html as it is.

Nick
-- 
Nick Wedd    nick@maproom.co.uk


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

Date: Sat, 25 Oct 2003 14:45:25 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: generating html from perl
Message-Id: <bndrls$10g83e$1@ID-184292.news.uni-berlin.de>

Nick Wedd wrote:
> I have an html page, which I want to generate from a cgi script.  I
> have tried to do this by putting the entire html into a script like
> this:
> 
> #!/usr/bin/perl -w
> 
> print <<Whole_file;
> 
> <html>
> <head>
>    .... all the rest of the html ....
> </body>
> </html>
> Whole_file
> 
> This almost works.  But my html includes some javascript, which
> includes some escape sequences, some of which get expanded by this
> process.  It expands each "\n" in my javascript into "
> ", which I can live with.  But it also expands
>     pattern = /\[([^)]+)/;
> to
>     pattern = /[([^)]+)/;
> although it does not expand
>     pattern = /\[([^(]*)\(([^)]*)\)([^]]*)/;
> 
> Is there a recommended way of getting round this?  Ideally, I would
> like it to leave all the html as it is.

If you want to use the here-document syntax, you can do:

     print <<'Whole_file';
------------^----------^

See http://www.perldoc.com/perl5.8.0/pod/perlop.html#%3c%3cEOF

Another approach is to keep the HTML page in a separate file, open and 
read it into a variable, and print that variable.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Sat, 25 Oct 2003 17:39:07 +0100
From: Nick Wedd <nick@maproom.co.uk>
Subject: Re: generating html from perl
Message-Id: <feZk6nDrcqm$EAmC@maproom.demon.co.uk>

In message <bndrls$10g83e$1@ID-184292.news.uni-berlin.de>, Gunnar 
Hjalmarsson <noreply@gunnar.cc> writes
>Nick Wedd wrote:
>> I have an html page, which I want to generate from a cgi script.  I
>> have tried to do this by putting the entire html into a script like
>> this:
>>  #!/usr/bin/perl -w
>>  print <<Whole_file;
>>  <html>
>> <head>
>>    .... all the rest of the html ....
>> </body>
>> </html>
>> Whole_file
>>  This almost works.  But my html includes some javascript, which
>> includes some escape sequences, some of which get expanded by this
>> process.  It expands each "\n" in my javascript into "
>> ", which I can live with.  But it also expands
>>     pattern = /\[([^)]+)/;
>> to
>>     pattern = /[([^)]+)/;
>> although it does not expand
>>     pattern = /\[([^(]*)\(([^)]*)\)([^]]*)/;
>>  Is there a recommended way of getting round this?  Ideally, I would
>> like it to leave all the html as it is.
>
>If you want to use the here-document syntax, you can do:
>
>    print <<'Whole_file';
>------------^----------^
>
>See http://www.perldoc.com/perl5.8.0/pod/perlop.html#%3c%3cEOF

Thank you.  I now have the script working.

>Another approach is to keep the HTML page in a separate file, open and 
>read it into a variable, and print that variable.
>

Nick
-- 
Nick Wedd    nick@maproom.co.uk


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

Date: Sat, 25 Oct 2003 18:39:59 +0100
From: "Lex" <nospam@peng.nl>
Subject: how to do something
Message-Id: <tFymb.26696$nQ4.623972@news-reader.eresmas.com>

Hi,

I've got two subroutines, one is saying 'do the other x times'. The other is
checking records from a database and prints the x latest records. However,
when a record matches something, it should be skipped. It all works,
however, what happens is that the results are x - 1. So in the example
underneath I normally get 3 results, except when $vergelijker = jep, than
the I only get 2 results, although I'd prefer 3. I tried this but it doesn't
work:

subroutine 1:

my $i = 2;

for (0 .. $i) {
&html_recordheadline (&array_to_hash($_, @results));
}


subroutine 2: (sub html_recordheadline )

if ($vergelijker ne "jep") {
        print qq|
        blablabla
        |;
    }

else { $i++; }

Any help is appreciated,
Lex




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

Date: Sat, 25 Oct 2003 17:50:25 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: how to do something
Message-Id: <20031025135026.4493045e.jwillmore@remove.adelphia.net>

On Sat, 25 Oct 2003 18:39:59 +0100
"Lex" <nospam@peng.nl> wrote:
> I've got two subroutines, one is saying 'do the other x times'. The
> other is checking records from a database and prints the x latest
> records. However, when a record matches something, it should be
> skipped. It all works, however, what happens is that the results are
> x - 1. So in the example underneath I normally get 3 results, except
> when $vergelijker = jep, than the I only get 2 results, although I'd
> prefer 3. I tried this but it doesn't work:
> 
> subroutine 1:
> 
> my $i = 2;

Where is ^^^ this line being declared?  Inside subroutine 1 or
globally?  If it's inside subroutine 1, then that's where I _think_
you're issue is - the variable's scope (or where it's life exists). 
If $i is supposed to be accessed in _both_ subroutines, then declare
it _outside_ of the subroutines (aka globally).

Or did I miss what you were after?

HTH

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
Hand, n.:  A singular instrument worn at the end of a human arm
<and commonly thrust into somebody's pocket.   -- Ambrose Bierce,
"The Devil's Dictionary" 


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

Date: Sat, 25 Oct 2003 09:59:28 -0400
From: shrek11001 <member45680@dbforums.com>
Subject: Is there a VAR to count the number of occurences of matching
Message-Id: <3522595.1067090368@dbforums.com>


e.g.



        $x =~ /A/g;



This var would provide the number of occurences of A in $x ...



Does it exist ? (according to perlvar, no, but ...)





- - -



I have that otherwise...



        $x =~ s/[^A]//g;



        $nocc = length($x);





but there shld be better...


--
Posted via http://dbforums.com


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

Date: Sat, 25 Oct 2003 16:09:02 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Is there a VAR to count the number of occurences of matching
Message-Id: <bne0is$10cgnv$1@ID-184292.news.uni-berlin.de>

shrek11001 wrote:
> e.g.
> 
>         $x =~ /A/g;
> 
> This var would provide the number of occurences of A in $x ...
> 
> Does it exist ? (according to perlvar, no, but ...)

You are asking a FAQ

     perldoc -q count

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Sat, 25 Oct 2003 15:28:27 +0200
From: Matija Papec <perl@my-header.org>
Subject: Re: Mason pipeline style
Message-Id: <a1ukpvcrcbmm85i8bqu36j68n2qo6b675h@4ax.com>

X-Ftn-To: ko 

kuujinbo@hotmail.com (ko) wrote:
>> with Mason? Or should I consider Template Toolkit? :) 
>> tia!
>
>Don't know if you already know about this site, but have you looked here? 
>
>http://www.masonbook.com/

Yes, didn't read whole book yet but did some examples,
http://www.masonbook.com/source/



-- 
Matija


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

Date: Sat, 25 Oct 2003 15:28:29 +0200
From: Matija Papec <perl@my-header.org>
Subject: Re: Mason pipeline style
Message-Id: <r3ukpvgq53sbah3d3mqnj4p7nqv5i6ll7c@4ax.com>

X-Ftn-To: Bob X 

"Bob X" <bobx@linuxmail.org> wrote:
>> (templates are strictly separated from code). Can someone show such
>examples
>> with Mason? Or should I consider Template Toolkit? :)
>> tia!
>
>Look at HTML::Template as well. CGI::Application is great as well.

Tnx, I'm in position to pick one templating framework and then stick to it
(there should be no regrets after such decision :)) Mason looks good as it
promises scalability for building large sites but I would like to stay away
from perl_interlaced_with_html nightmare. Can your combination handle well
large projects?


-- 
Matija


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

Date: Sat, 25 Oct 2003 13:32:37 +0200
From: "Stefan" <someone@somewhere.nl>
Subject: Outlook email headers
Message-Id: <3f9a5f57$0$20990$e4fe514c@dreader12.news.xs4all.nl>

Hay,

Does anybody know how to access MS-Outlook email headers using Perl ?  I
tried using Win32::OLE but that doesn't give me the raw internet headers.
Same thing when exporting emails to file. Perhaps, someone knows a different
method ?  I'm using (Active)Perl, v5.6.1 built for MSWin32-x86-multi-thread.

Stefan





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

Date: Sat, 25 Oct 2003 22:17:51 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Outlook email headers
Message-Id: <2141060.WFXr5it3Uq@gregs-web-hosting-and-pickle-farming>

It was a dark and stormy night, and Stefan managed to scribble:

> Hay,
> 
> Does anybody know how to access MS-Outlook email headers using Perl ?  I
> tried using Win32::OLE but that doesn't give me the raw internet headers.
> Same thing when exporting emails to file. Perhaps, someone knows a
> different
> method ?  

My different method is to use http://expressarchiver.com/

gtoomey



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

Date: Sat, 25 Oct 2003 17:33:44 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Outlook email headers
Message-Id: <20031025133346.11211c95.jwillmore@remove.adelphia.net>

On Sat, 25 Oct 2003 13:32:37 +0200
"Stefan" <someone@somewhere.nl> wrote:
> Does anybody know how to access MS-Outlook email headers using Perl
> ?  I tried using Win32::OLE but that doesn't give me the raw
> internet headers. Same thing when exporting emails to file. Perhaps,
> someone knows a different method ?  I'm using (Active)Perl, v5.6.1
> built for MSWin32-x86-multi-thread.
> 

I found the following module that _may_ aid in this task: 
Mail::Transport::Dbx 
(http://search.cpan.org/~vparseval/Mail-Transport-Dbx-0.04/Dbx.pm)

Since it can be used (according to the documentation) to extract
messages, I'm thinking that gives one the ability to parse the message
- including headers.  That's the good news.  Bad news is it depends
upon a library that you _may_ have to compile.  However, I'll leave
the exercise of further research up to you :-)

HTH

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
The human animal differs from the lesser primates in his passion 
for lists of "Ten Best".   -- H. Allen Smith 


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

Date: Sat, 25 Oct 2003 12:22:45 +0200
From: Kåre Olai Lindbach <barbr-en@online.no>
Subject: Re: Perl and IIS - script runs but 'The page cannot be displayed'
Message-Id: <k1jkpv08f54854l334e1r3tcjoe0ni9lc8@4ax.com>

On 25 Oct 2003 03:04:47 -0700, stewart@webslave.dircon.co.uk (stew
dean) wrote:

>Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us> wrote in message news:<t84dnb.jgm.ln@goaway.wombat.san-francisco.ca.us>...

>> Anyway, stew asked about CGI: the long answer is to perldoc CGI.  The
>> short answer is that CGI helps immeasurably in parsing query strings and
>> POST parameters, and if you're not using it you're almost surely missing
>> something that'll bite you in the behind sooner or later.
>
>Looked this up. There's some useful stuff here although it might make
>my work more complicated if I used all it's features. The form related
>handling is about the only bit I might use. Thanks for the suggestion.

But there is also a lot of functionality in CGI.pm you don't see  you
will also take advantage of. Ex. _correct_ POST and GET parsing.
Params that contains more than one scalar value etc etc. Just the
parsing and param-getting/setting is worth CGI.pm using.

You don't need to use all features. You might still do all HTML-code
by hand. Sometimes I _need_ to do it. It's the main CGI-protocol-part
you don't need to tingle with, unnecessary.
 
-- 
mvh/Regards
Kåre Olai Lindbach


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

Date: Sat, 25 Oct 2003 23:23:39 +1300
From: "Tintin" <me@privacy.net>
Subject: Re: Perl and IIS - script runs but 'The page cannot be displayed'
Message-Id: <bndj0q$u62pf$1@ID-172104.news.uni-berlin.de>


"stew dean" <stewart@webslave.dircon.co.uk> wrote in message
news:2b68957a.0310241707.3ad7fc65@posting.google.com...
> ko <kuujinbo@hotmail.com> wrote in message
news:<bn8nea$am6$1@pin3.tky.plala.or.jp>...
> > use CGI;
>
> Don't use this as I write all my HTML by hand instead - just a person
> choice thing. If it does anything more than write HTML please correct
> me.

Although the CGI module can generate HTML, the overwhelming reason people
use it is that it handles...wait for it....CGI.




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

Date: Sat, 25 Oct 2003 15:17:40 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Perl and IIS - script runs but 'The page cannot be displayed'
Message-Id: <3f9a7adf.97883630@news.erols.com>

stewart@webslave.dircon.co.uk (stew dean) wrote:

: tiltonj@erols.com (Jay Tilton) wrote in message news:<3f99c0b7.50221376@news.erols.com>...
: >     1. Look at the server's error log.
: 
: Not applicable.

Why is that not applicable?  The server's error log is where all
messages that would go to STDERR end up.  Those pages of messages you
saw when running the program from the command prompt would be in the
error log.

If IIS has no error log, then it is an inexcusable obstacle to
productivity.  Life is too short to use bad tools.

: >     4. Run the script from a command prompt so you can see 
: >        errors and warnings as they happen.
: 
: This is the bit of advice I followed and it worked, only after I got
: shit for asking why I should use the command line.

That advice showed up early and it showed up often.  By the time you
asked why, readers had become exasperated.

: >     6. see "perldoc -q 500"
: 
: This came up late in the discussion. It's essential RTFM. In this case
: the manual is of no use.

The FAQ answer points to brian d foy's CGI "Troubleshooting Perl CGI
scripts" guide.  That guide parrots much of the advice given in this
thread, but has additional discussion on the significance of each step.
Did you read it?

In Message-ID: <2b68957a.0310241614.336307f8@posting.google.com>, you
mentioned,

    It wasnt useful. It took me to a document that was for 
    unix users.

We must not be looking at the same document.  The only Unix-centricity
in brian's guide has to do with file permissions.  The rest is
remarkably OS-generic.

: It did tell me I would have been better off
: in a CGI newsgroup and you lot get a bit shirty around here

Blame the technical mind for the shirtiness.  The hacker enjoys a
challenge and loathes time-waste.  The only challenge presented in this
thread was how to prod you into trying some basic diagnostic steps, and
that rapidly devolved into a perceived waste of time.

: guess I know that now. Some of you guys really need to chill out.

Past campaigns of clpm social reform have failed.  You are free to
ignore those group participants you find abrasive, or you can seek help
in a gentler place.

: Think of it this way - if I never used the command line before (except
: to install modules) then why would I know what perldoc means?
 
You could have asked.

: > There's no evidence you've tried any of those things.  Your only
: > response to each arsehole has been "the script works."
: 
: Because the script outputs no errors in the browser.

That is typically true of any program, Perl or otherwise, that is run in
a CGI environment.  The end-user doesn't need to be exposed to detailed
error and warning messages.  The developer does need those messages, but
he has the server logs on his side.

: Using the command
: line - as I've stated before, it gave me the errors. This allowed me
: to fix the script. Now I want the errors that showed up in the command
: line to display in the browser as at the moment I have to maintain two
: scripts - one with relative links and one absolute. There is a
: problem.

That is what the error log is for.  Find it and use it.



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

Date: Sun, 26 Oct 2003 00:31:48 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: Perl and IIS - script runs but 'The page cannot be displayed'
Message-Id: <bne50q$f9j$1@pin3.tky.plala.or.jp>

stew dean wrote:

[snip]

> Some have their own ways of working and often it is suggested to use x
> or y solution because that is how they do it - not because it will
> give me any more answers. Now I know that the command line gives me
> errors not seen in the browser - and I want these errors to show up in
> the browser.

I'm still not sure why you're so set against using the shell (not 
asking/looking for an explanation) to see what's wrong with the script, 
but try this:

use strict;
use warnings;

use CGI;
use CGI::Carp 'fatalsToBrowser';

my $cgi = CGI->new;
print $cgi->header;

# this is the new/relevant part
$SIG{__WARN__} = sub { print "$_<br />\n" foreach @_ };

print $cgi->start_html('test page');
my $test_string;
print $test_string;

print $cgi->end_html;
__END__

If you run the script from the shell, you'll get a 'Use of uninitialized 
value in print...' warning. The '$SIG{__WARN__}' allows warnings to be 
redirected to the browser.

And this is *really* ironic because the idea came from this post (long 
link follows):

http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&frame=right&th=ccbf1c3c6303ec13&seekm=bnarpb%248o0%241%40mamenchi.zrz.TU-Berlin.DE#link2

If for some strange reason the link doesn't work, guess who's the author 
of above message?? Yes, its that 'arsehole' Tad :)  Point being that 
maybe you need to chill out - the time and energy spent antagonizing 
people in the group would definitely be better spent on reading/scanning 
all of the good advice that is available here. That post is only a 
couple of days old...

keith



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

Date: 25 Oct 2003 07:19:30 -0700
From: tjdevil@netbuilder.eu.com (Tielman de Villiers)
Subject: Portable @INC
Message-Id: <37331a55.0310250619.526319b3@posting.google.com>

I want to compile a "portable perl" which will live in users' ~/usr
directory.
I tried to achieve this by:
 ./Configure -Dprefix=\$HOME/usr -des 
and then
make install DESTDIR=/home/auser
By typing
/home/auser/usr/bin/perl -V
@INC displays what I want:
====
Characteristics of this binary (from libperl):
  Compile-time options: USE_LARGE_FILES
  Built under linux
  Compiled at Oct 25 2003 14:10:07
  @INC:
    /home/auser/usr/lib/perl5/5.8.1/i686-linux
    /home/auser/usr/lib/perl5/5.8.1
    $HOME/usr/lib/perl5/site_perl/5.8.1/i686-linux
    $HOME/usr/lib/perl5/site_perl/5.8.1
    $HOME/usr/lib/perl5/site_perl
====
BUT these "compiled in" @INC links do not work. 
Is there a way around it?
(Without using "use lib" or /home/auser/usr/bin/perl
-I$HOME/usr/lib/perl5/site_perl)


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

Date: Sat, 25 Oct 2003 17:11:56 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: Portable @INC
Message-Id: <3F9AAED8.7010205@rochester.rr.com>

Tielman de Villiers wrote:

> I want to compile a "portable perl" which will live in users' ~/usr
> directory.
> I tried to achieve this by:
> ./Configure -Dprefix=\$HOME/usr -des 
> and then
> make install DESTDIR=/home/auser
> By typing
> /home/auser/usr/bin/perl -V
> @INC displays what I want:
> ====
> Characteristics of this binary (from libperl):
>   Compile-time options: USE_LARGE_FILES
>   Built under linux
>   Compiled at Oct 25 2003 14:10:07
>   @INC:
>     /home/auser/usr/lib/perl5/5.8.1/i686-linux
>     /home/auser/usr/lib/perl5/5.8.1
>     $HOME/usr/lib/perl5/site_perl/5.8.1/i686-linux
>     $HOME/usr/lib/perl5/site_perl/5.8.1
>     $HOME/usr/lib/perl5/site_perl
> ====
> BUT these "compiled in" @INC links do not work. 
> Is there a way around it?
> (Without using "use lib" or /home/auser/usr/bin/perl
> -I$HOME/usr/lib/perl5/site_perl)
> 

Hmmmmm...It isn't very clear to me what you are trying to accomplish. 
You are compiling a copy of Perl for each luser's home directory.  OK -- 
no problem -- not sure why or anything -- but just go ahead and do it, 
and don't escape the $ in $HOME from the shell in the ./Configure, and 
everything should go smoothly.  The reason things "do not work" above is 
that the literal $HOME (which is supposed to be a shell variable 
reference) is getting into Perl's internal stuff, like @INC, and it 
never sees a shell from there.  Perl then looks for the literal 
directory '$HOME/usr/...' and doesn't find a directory by that name.  If 
you wouldn't have escaped the $ from the shell, the expansion 
/home/asuer would be there instead, and everything would be fine.

Or am I totally misunderstanding what you are trying to do?
-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl



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

Date: Sat, 25 Oct 2003 11:47:53 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: while each hash, why not array
Message-Id: <vpkon9ekefjf77@corp.supernews.com>

In article <bn8phl$152$1@mamenchi.zrz.TU-Berlin.DE>,
    Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:

: [...]
: Not bloody likely, I know.  I wonder how Perl 6 will behave in that
: respect.

Thus sayeth Exegesis 6:

    . . . Instead, we have to consider both the index and the value of
    each data element.

    To do that we use the @data array's .kv method. Just as calling
    the .kv method on a hash returns key, value, key, value, key,
    value, etc., so too calling the .kv method on an array returns
    index, value, index, value, index, value, etc. Then we just use a
    parameterized block as our for block, specifying that it has two
    arguments. That causes the for to grab two elements of the list
    its iterating (i.e. one index and one value) on each iteration.

    Then we simply test to see if the current index is any of those
    specified in $is_sheep's array and, if so, we push the
    corresponding value:

      for @data.kv -> $index, $value {
          if $index == any(@$is_sheep) { push %herd{$sheep}, $value }
          else                         { push %herd{$goats}, $value }
      }

See http://www.perl.com/pub/a/2003/07/29/exegesis6.html?page=8

Greg
-- 
Procrastinators, of which I'm one of the worst, are routinely cruel to
their future selves.
    -- Charley Hardman


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

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


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