[10681] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4273 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 22 10:07:23 1998

Date: Sun, 22 Nov 98 07:00:44 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 22 Nov 1998     Volume: 8 Number: 4273

Today's topics:
        Alarm not working with network calls, LWP <amy@emsh.calarts.edu>
    Re: ascending toffie@my-dejanews.com
    Re: ascending <ours@casema.net>
    Re: CGI security -- help!!!!!! (Shawn O'Donnell)
    Re: CGI security -- help!!!!!! <ebohlman@netcom.com>
    Re: chmod <gellyfish@btinternet.com>
        Current module, line and file from within perl?  HOW? <burton@digex.net>
    Re: Current module, line and file from within perl?  HO (Ronald J Kimball)
    Re: Current module, line and file from within perl?  HO <ebohlman@netcom.com>
    Re: Current module, line and file from within perl?  HO (Martin Vorlaender)
    Re: detecting hard drives <gellyfish@btinternet.com>
        File attached via sendmail in Perl? (Beginner) (Lai Wah)
        FTP'ing within a perl script (Gary Morton)
    Re: help with a new game <gellyfish@btinternet.com>
    Re: Hey all i am looking (Clay Irving)
        How do I exit child process w/o invoking packages' dest <yuval.buchner@intel.com>
    Re: I download ActiveState but don't understand how to  <Arved_37@chebucto.ns.ca>
        Installed Module List (Parabola)
        Is there a case function in PERL? <squid666@geocities.com>
    Re: Is there a case function in PERL? <J.D.Gilbey@qmw.ac.uk>
    Re: Is there a case function in PERL? (Alastair)
        Link Exchange script... <jado@nospam.jado.org>
    Re: Matt's SSI image help <amy@emsh.calarts.edu>
    Re: mode_perl and cgi confusion <gellyfish@btinternet.com>
    Re: NT perl and mail <gellyfish@btinternet.com>
    Re: Perl Experts Needed <gellyfish@btinternet.com>
        perl: warning: Setting locale failed. <dkennedy@acm.org>
    Re: PerlScript-Cookies??? <gellyfish@btinternet.com>
        print  " Location:  problem "  (Bob)
    Re: print  " Location:  problem " <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: print  " Location:  problem " <amy@emsh.calarts.edu>
    Re: Quick Perl prob. (Ronald J Kimball)
    Re: Recommend Perl books? <sberg1@tampabay.rr.com>
    Re: Recommend Perl books? (Clay Irving)
    Re: Regular Expression <r_larsen@image.dk>
    Re: Regular Expression <gellyfish@btinternet.com>
    Re: Strange Failure <gellyfish@btinternet.com>
    Re: upper to lowercase <zohars@amdocs.com>
    Re: Why doesn't something work? <uri@sysarch.com>
    Re: Win16 DLL access (on NT) Help!!! <gellyfish@btinternet.com>
    Re: XS_unpack_charPtrPtr ?? <Arved_37@chebucto.ns.ca>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Sun, 22 Nov 1998 04:29:39 -0800
From: Amy Alexander <amy@emsh.calarts.edu>
Subject: Alarm not working with network calls, LWP
Message-Id: <365803B2.5F8DC924@emsh.calarts.edu>

I've read some posts on this group in the recent past about problems
with gethostbyaddr not
responding to signals from "alarm". I'm having similar problems with
various LWP calls; that is, the
command in question hangs, but alarm doesn't interrupt it. As a test,
I've tried a piece of code
with an LWP::Simple "get" call, and then the same code with just an
infinite "while" loop. Alarm
succesfully interrupted the while loop, but did not interrupt the LWP
call. So I'm wondering - is there
something that prevents alarm (or SIG{ALRM}) from communicating with
network processes? Or, is
there another way to specify a timeout when trying to get a head or
content of an HTML document
with LWP? Or, has anyone  had success with using the alarm function?

Here is my sample code:

use LWP::Simple;
 eval {
    local $SIG{ALRM} = sub { die "timeouthead\n" };
    alarm 5 ;   # if getting stuck, bail...
    $text = get ('http://perl.org');    #change to a servername that
isn't currently responding
    #while (1) {}  #if you uncomment this and comment out the line
above, it will run the "while loop" version.
    alarm 0 ;
    };
    if ($@) {
        if ($@ =~ /timeouthead/)  {
           print "what is this, an infinite loop?\n";
        }
        else {
           alarm 0 ;        #clear the stillpending alarm
           die "something really weird happened\n"; #propagate
unexpected exception
        }
    }

thanks,
-amy alexander





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

Date: Sun, 22 Nov 1998 10:44:31 GMT
From: toffie@my-dejanews.com
Subject: Re: ascending
Message-Id: <738pue$h3k$1@nnrp1.dejanews.com>

In article <7343r7$lsa$1@sun4000.casema.net>,
  "Casema" <ours@casema.net> wrote:
> Hi group,
>
> $SQL = "SELECT * FROM news";
> what would be a valid statement to get the output ascending /
> descending?????
> Oh, by the way, I am using WIN32::ODBC, so this is Perl Related
>
try the ORDER BY clause with the statement:
 $SQL = "SELECT * FROM news order by <columnname> [,<columnname>, ...]";
I think the default is ascending but you can define descending sorting via:
 $SQL = "SELECT * FROM news order by <columnname> DESC";
This can be found explained in more detail in ANSI SQL guides..

Toffie.


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


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

Date: Sun, 22 Nov 1998 13:41:16 +0100
From: "Casema" <ours@casema.net>
Subject: Re: ascending
Message-Id: <7390sq$96d$1@sun4000.casema.net>

Thanks for providing the answer, I do like to be pointed in right
directions, but I only request answers when not found one myself.
so, thanks,

Michel
toffie@my-dejanews.com wrote in message <738pue$h3k$1@nnrp1.dejanews.com>...
>In article <7343r7$lsa$1@sun4000.casema.net>,
>  "Casema" <ours@casema.net> wrote:
>> Hi group,
>>
>> $SQL = "SELECT * FROM news";
>> what would be a valid statement to get the output ascending /
>> descending?????
>> Oh, by the way, I am using WIN32::ODBC, so this is Perl Related
>>
>try the ORDER BY clause with the statement:
> $SQL = "SELECT * FROM news order by <columnname> [,<columnname>, ...]";
>I think the default is ascending but you can define descending sorting via:
> $SQL = "SELECT * FROM news order by <columnname> DESC";
>This can be found explained in more detail in ANSI SQL guides..
>
>Toffie.
>
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own




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

Date: Sun, 22 Nov 1998 00:45:24 -0500
From: shawn@ultranet.com (Shawn O'Donnell)
Subject: Re: CGI security -- help!!!!!!
Message-Id: <shawn-2211980045260001@d197.dial-4.cmb.ma.ultra.net>

In article <comdog-ya02408000R2111981555160001@news.panix.com>,
comdog@computerdog.com (brian d foy) wrote:
> see the URL in the .sig.
> CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>

Great resource!  

If you like the WWW Security FAQ, try Lincoln Stein's book, "Web Security:
A Step-By-Step Reference Guide."  There's a good chance you'll want to be
using cgi.pm, in which case you'd like his "Official Guide to Programming
With Cgi.Pm"

N.B. you'll get better reception to detailed CGI questions in
comp.infosystems.www.authoring.cgi

--Shawn


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

Date: Sun, 22 Nov 1998 07:01:53 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: CGI security -- help!!!!!!
Message-Id: <ebohlmanF2tA75.3uH@netcom.com>

Tad McClellan <tadmc@flash.net> wrote:
: Kumar Sundaram (softsci@eagle.ca) wrote:

: : Also, I would like to know, if user enters the his/her name in the name
: : field I want only letters and maybe a ,(comma) .  


:    print "only letters, spaces and commas are allowed in the name field\n"
:       unless $name =~ /^[a-zA-Z, ]+]$/;

Assuming that the second ']' is a typo, I can think of some names that 
consist of only letters, but that will be rejected by that test...

Howzabout:

unless $name =~ /^([^\W\d_]|[, ])+$/;

which lets the current locale define what constitutes a letter.



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

Date: 21 Nov 1998 20:44:49 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: chmod
Message-Id: <7378o1$up$1@gellyfish.btinternet.com>

On Fri, 20 Nov 1998 16:41:20 -0500 PERL ROCKS! <emills@harris.com> wrote:
> Sorry to bother everyone - but I just had a question on my own response (does that make this a recursive
> post)?
> 
> Why   doesn't
> 
>    $cnt = chmod 0777, 'file1', 'file2';
> 
> have to have "("'s around the list, as in:
> 
>    $cnt = chmod 0777, ('file1', 'file2');
> 
> My llama book says that lists are surrounded by parens..
> 

The arguments to a subroutine are passed as a list anyhow so as long as the
list is the last argument there is no problem - if on the other hand you
want to pass more than one list it requires other methods to achieve it.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: Sun, 22 Nov 1998 04:48:56 GMT
From: Kevin Burton <burton@digex.net>
Subject: Current module, line and file from within perl?  HOW?
Message-Id: <365797B6.3020B23@digex.net>

Is it possible for me to determine what my module, line number, and file
is from within Perl?

I don't want to have to write my own debugger to do this even though it
seems easy.

Basically if I call a sub inside my own module I want the module to
print debug info to a file if it encounters an error and on what line.

So I want it to say:

Directory not found in module setup on line 1897 in file setup.pm.

I also don't want to call die because this would terminate execution and
I want it to keep going.

Thanks for your help.

Kevin A. Burton, MCSE+Internet
NT Operations Engineer
Digex, West Coast Facility




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

Date: Sun, 22 Nov 1998 01:44:41 -0500
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Current module, line and file from within perl?  HOW?
Message-Id: <1divfim.1kh62itktgjk2N@bos-ip-1-84.ziplink.net>

Kevin Burton <burton@digex.net> wrote:

> Basically if I call a sub inside my own module I want the module to
> print debug info to a file if it encounters an error and on what line.
> 
> So I want it to say:
> 
> Directory not found in module setup on line 1897 in file setup.pm.
> 
> I also don't want to call die because this would terminate execution and
> I want it to keep going.

Have you tried using warn instead?


Here's something you might find interesting...

>From perldata:

  Three special literals are __FILE__, __LINE__, and __PACKAGE__, which
  represent the current filename, line number, and package name at that
  point in your program.  They may be used only as separate tokens; they
  will not be interpolated into strings.  If there is no current package
  (due to a C<package;> directive), __PACKAGE__ is the undefined value.


Thus:

warn 'Directory not found in module ', __PACKAGE__,
     ' on line ', __LINE__, ' in file ', __FILE__, "\n";

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


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

Date: Sun, 22 Nov 1998 07:14:24 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Current module, line and file from within perl?  HOW?
Message-Id: <ebohlmanF2tAs0.4BD@netcom.com>

Kevin Burton <burton@digex.net> wrote:
: Is it possible for me to determine what my module, line number, and file
: is from within Perl?

Yep.

: I don't want to have to write my own debugger to do this even though it
: seems easy.

: Basically if I call a sub inside my own module I want the module to
: print debug info to a file if it encounters an error and on what line.

: So I want it to say:

: Directory not found in module setup on line 1897 in file setup.pm.

: I also don't want to call die because this would terminate execution and
: I want it to keep going.

You can get the information you want from the caller() function, but 
before trying to re-invent the wheel, take a look at the Carp module 
which has a function (named, rather suprisingly, carp()) that will 
probably do exactly what you want all by itself.


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

Date: Sun, 22 Nov 1998 08:21:04 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Current module, line and file from within perl?  HOW?
Message-Id: <3657bb60.524144494f47414741@radiogaga.harz.de>

Kevin Burton (burton@digex.net) wrote:
: Is it possible for me to determine what my module, line number, and file
: is from within Perl?

Have a look at the caller() function.

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


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

Date: 22 Nov 1998 14:17:14 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: detecting hard drives
Message-Id: <7396da$1a2$1@gellyfish.btinternet.com>

On Fri, 20 Nov 1998 13:59:21 +1000 Jye Tucker <jye@buckconsultants.com.au> wrote:
> Hi there,
> 
> I'm trying to write a perl script to be put onto a FreeBSD boot floppy and
> used in a number of different machines with no guarantees of consistant
> hardware. 
> 

Are you sure you're going to get Perl onto a boot floppy ?

> What I am trying to do is to ask the script to detect what hard drives are
> connected to the machine so that I can use the mount system command to
> mount them. 
> 
> Has anyone heard of any modules or techniques for detecting hardware or am
> I just going to have to grep through the output of dmesg?
> 
Actually I dont think even grepping dmesg is going to help because that is
only going to tell you what physical drives are present and not the
indiviadual filesystems therein.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: Sun, 22 Nov 1998 06:55:13 GMT
From: alw@pd.jaring.my (Lai Wah)
Subject: File attached via sendmail in Perl? (Beginner)
Message-Id: <3657b465.136607@news.jaring.my>

Hi,
   I am beginner in Perl. I know that a Perl program can writes data
to a file and also can sends data through email.
   My question: 

   Can a Perl program writes data to a file and sends the file as
attachment using the sendmail?


  Any help will be appreciated. Thank you.


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

Date: 22 Nov 1998 08:04:45 GMT
From: mortong@iea.com (Gary Morton)
Subject: FTP'ing within a perl script
Message-Id: <738git$m0p$1@supernews.com>

I am a perl newbie (never heard of perl until 2 weeks ago.) Nonetheless, I've 
managed to write a CGI script for ESD that (so far) works properly. However, 
I'd like feedback from the http server that a download successfully completed, 
so that I don't bill the customer for a DL that was interrupted for some 
reason. After checking for credit info etc., my script currently executes a

print "Location: http:// . . . ."

instruction to deliver the file. But I don't get any feedback this way. Is 
there another way?

Thanks to all the experts!
   



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

Date: 22 Nov 1998 13:57:17 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: help with a new game
Message-Id: <73957t$18o$1@gellyfish.btinternet.com>

On Fri, 20 Nov 1998 17:02:37 -0500 (EST) dragonelf@webtv.net wrote:
> 
> --WebTV-Mail-1045780578-6229

  Is this a first ?

> Content-Type: Text/Plain; Charset=US-ASCII
> Content-Transfer-Encoding: 7Bit
>

However if you cant fix WebTV not to behave in this inappropriate manner I
would go back to posting from your Gameboy or whatever ;-}
 
> what would be better to use to build a text multiplayer game? perl, c++,
> basic? any responses please
> 

You dont really expect a considered respnse to this question from this 
group now really did you ?

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: 22 Nov 1998 06:02:23 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Hey all i am looking
Message-Id: <738qvv$nhb@panix.com>

In <4086-36577B55-21@newsd-198.iap.bryant.webtv.net> JJ353@webtv.net (J. J. Goodrich) writes:

>Hey all im looking for a script that will
>allow me to set a cookie when a person logs in and if tehy dont ahve the
>cookie then they cant visit the pages.... I would like to make it tow
>here if they dont login in then they cant access any of my pages that im
>trying to protect without first going to the login and getting the
>cookie is this possible if so could someone direct me to the script that
>will allow me to do this im a newbie so go light on the technical talk

Use the CGI.pm module:

  CGI.pm - a Perl5 CGI Library
  http://stein.cshl.org/WWW/software/CGI/cgi_docs.html

Cookies:

  http://stein.cshl.org/WWW/software/CGI/cgi_docs.html#cookies

-- 
Clay Irving
clay@panix.com


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

Date: Sun, 22 Nov 1998 11:02:34 +0200
From: "Yuval Buchner" <yuval.buchner@intel.com>
Subject: How do I exit child process w/o invoking packages' destructors
Message-Id: <7383cl$plg$1@scnews.sc.intel.com>

Hi all,

I need your help on the following issue:

I have a perl program that uses several packages.
The packages have destructors (END blocks) which are invoked when the perl
script finish.

I need to use fork in my program.

When the child completes its job it exits and invokes the END blocks
of all the packages. This is not a desired action since the father
didn't finish its job.

One solution is to use dummy exec call at the end of the child
action (what I mean is to use exec for executing a doing nothing
program). When I use exec, the current child process exits w/o
calling the packages' destructors.

Another solution is to control by variable the END section of each
package.

Do u have another solution which is internally supported by perl ?

Thx,
Yuval Buchner





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

Date: Sun, 22 Nov 1998 10:40:11 -0400
From: Arved Sandstrom <Arved_37@chebucto.ns.ca>
Subject: Re: I download ActiveState but don't understand how to install it on Win98
Message-Id: <Pine.GSO.3.95.iB1.0.981122103152.5982B-100000@halifax.chebucto.ns.ca>

I'm guessing (just guessing, mind you) that maybe "install" as used here
refers to figuring out how to use the thing, as opposed to just
double-clicking the initial .exe. The reason I say that is, we're getting
into a pretty large user base (in the PC world) of people who don't grok
command-line. So they run the Installer, and then they can't find anything
to double-click to run a script, if you get my drift.

So the answer here may be just to say: double-click the initial downloaded
 .exe. Follow all instructions. Once you've finished re-booting about 3 or
4 times (if you're doing the DCOM thing), and the dust has settled, start
a command prompt window (MSDOS prompt, if you like), check your PATH to
at the command line to see if there's a pulse.

On 20 Nov 1998, Rich wrote:

> On Thu, 19 Nov 1998 20:55:38 -0500, Sylvain Lavigne <proband@cam.org> wrote:
> >I download ActiveState but don't understand how to install it on Win98.
> >I supposed I have to play around with the registries but don't know
> >exacly how to doit to make it work.
> >So, what is the best procedure and fastest procedure to make it work.
> >
>    Well, you could try the bold step of running the file you
> downloaded...
> 
> - Rich



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

Date: Sun, 22 Nov 1998 11:51:54 GMT
From: parab0la@my-dejanews.com (Parabola)
Subject: Installed Module List
Message-Id: <3657fa05.17905473@news.tig.com.au>

Hi all!

Is there any way to list out all the installed PERL modules?
Preferably in a nice shell / interface like CPAN.

Thx!
:Parabola
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Intelligence is merely the accumulation of experience...
 ..
Parabola - the famous curve.
Email:     mailto:parab0la@my-dejanews.com
URL:       http://parabola.home.ml.org/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++


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

Date: Sun, 22 Nov 1998 04:40:31 -0500
From: "Timothy C. Pelham" <squid666@geocities.com>
Subject: Is there a case function in PERL?
Message-Id: <3657DC0F.4C63@geocities.com>

Is there a function in PERL that does the same thing as the CASE
function in C and if so what is it? If anyone knows please let me know
at squid666@geocities.com. thanks


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

Date: Sun, 22 Nov 1998 10:10:35 +0000
From: Julian Gilbey <J.D.Gilbey@qmw.ac.uk>
Subject: Re: Is there a case function in PERL?
Message-Id: <3657E31B.28731F3B@qmw.ac.uk>

Timothy C. Pelham wrote:
> 
> Is there a function in PERL that does the same thing as the CASE
> function in C and if so what is it? If anyone knows please let me know
> at squid666@geocities.com. thanks

C doesn't have a CASE function.  Are you thinking of a switch?
I don't believe Perl has an equivalent of a switch, but the paradigm

if ($var == 1) { ...}
elsif ($var ==2 ) { ... }

etc. should be OK.

   Julian

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

            Julian Gilbey             Email: J.D.Gilbey@qmw.ac.uk
       Dept of Mathematical Sciences, Queen Mary & Westfield College,
                  Mile End Road, London E1 4NS, ENGLAND
      -*- Finger jdg@goedel.maths.qmw.ac.uk for my PGP public key. -*-


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

Date: Sun, 22 Nov 1998 11:39:06 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Is there a case function in PERL?
Message-Id: <slrn75fttm.7t.alastair@calliope.demon.co.uk>

Timothy C. Pelham <squid666@geocities.com> wrote:
>Is there a function in PERL that does the same thing as the CASE
>function in C and if so what is it? If anyone knows please let me know
>at squid666@geocities.com. thanks

Check out ;

http://www.perl.com/CPAN-local/doc/FMTEYEWTK/switch_statements

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: Sun, 22 Nov 1998 01:22:05 -0000
From: "Jado" <jado@nospam.jado.org>
Subject: Link Exchange script...
Message-Id: <737ord$cm1$1@nclient3-gui.server.virgin.net>

Hi all,

    Anyone know of a good ratio-based link exchange script? I'm hoping
someone can let me know of a good one and save me from any more pain and
anguish :)

Thanks a lot,
Jado.




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

Date: Sun, 22 Nov 1998 03:59:40 -0800
From: Amy Alexander <amy@emsh.calarts.edu>
Subject: Re: Matt's SSI image help
Message-Id: <3657FCAB.FEB6E971@emsh.calarts.edu>

"J.Billingsley" wrote:

> the code once the .shtml page loads is still calling the script
> ie. instead of it writing in the image to the page it still looks like
> this: <IMG SRC="http://www.myserver.com/cgi-bin/ssi.pl">
>

did you remember: ?
<!--#exec cgi="nameofscript.pl" -->
in your .shtml page

print "Content-type: text/html\n\n";
in the script that outputs the <IMG SRC = "whatever"> line

make sure your  web server knows how to deal with .shtml and .pl files,
or change the extensions....

-amy




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

Date: 22 Nov 1998 13:48:30 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: mode_perl and cgi confusion
Message-Id: <7394nf$18k$1@gellyfish.btinternet.com>

On Sat, 21 Nov 1998 15:32:22 +0800 Ron <mkshanx@uxmail.ust.hk> wrote:
> HI, 
> 
> I am a bit confused by the distinction/relation between mod_perl and
> cgi...i read apache.org's FAQ about this, but that tells me nothing much
> about it~
> 
> If I am using mod_perl, can I still use CGI.pm on it? (Because my book
> teaches me CGI programming and mod_perl seems to be entirely
> different..will I now need a new book? :))
> 

Yes.  Later versions of CGI.pm are aware of mod_perl and adjust things
accordingly - so largely things will run unchanged with some caveats.  If you
look at the code for CGI.pm you will see the kind of things it does.

However mod_perl *is* entirely different but it emulates CGI through the
Apache::Registry module which is largely transparent to users of CGI.pm

One area which you are likely to run into trouble is if you are using
modules or external programs that print directly to STDOUT - Apache.pm
overrides the print builtin() (and CGI.pm make allowance for this to happen)
in order that it appears to work as an Apache (not Perl) module - this will
not happen for most other modules and all external programs and thus you will
get no output.  This only occurred to me recently when I made a program that
used pod2html to display Module documentation (posted here a week or so back)
and discovered that it produced no output when run under mod_perl.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: 22 Nov 1998 14:04:48 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: NT perl and mail
Message-Id: <7395m0$199$1@gellyfish.btinternet.com>

On Fri, 20 Nov 1998 18:03:16 GMT mcnay@my-dejanews.com wrote:
> I know how to do mail from unix perl scripts. (sendmail)
> 
> Is there a way, or module to do mail from NT perl scripts.  If so, sample
> please, and what needs to be set up on the machine running the perl.
> 
> I have a script that is looking at database issues and needs to notify a
> person if there is problems, since they won't take the time to read the log
> on the machine.
> 

You might look at perlfaq9 which discusses the use of modules available from
CPAN for this purpose.

You will probably be interested at looking at DejaNews to review some of the
occasional turf wars that break out over the various approaches.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: 22 Nov 1998 14:42:14 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Perl Experts Needed
Message-Id: <7397s6$1a9$1@gellyfish.btinternet.com>

On Thu, 19 Nov 1998 01:46:34 GMT rohan666@my-dejanews.com wrote:
> I have a problem.... I need to GET users input from a shopping cart web site
> done in JavaScript, and take their selection to another domain where a secure
> server can process the order. (JScript will NOT allow cookies to be
> transmitted off the original domain.) I am working on a Perl Script that can
> redirect those selected items to another domain, but I have no clue how to
> correctly code the PerlScript on grabbing variables from a JavaScript.
> AAARRRGGGHHH!!! If you think you have a plan of action, pleeezz let me
> know... You can see the site in question at
> http://www.wholesalerestaurant.com Just view source to see the scripts.
> 

For the Perl element you will want to use a module such as CGI.pm that has
documentation as regards these things.

Try using the CGI.pm module and if you have any further problems with the
Perl elements of this then (after you have read the Docs and FAQs on Perl
and searched DejaNews and not found an answer) please post back a small
example of the code that you are having difficulty with.

For the general CGI,HTML and Javascript elements you will want to post a
more appropriate newsgroup (after having checked the FAQs relating to those
groups of course).

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: Sat, 21 Nov 1998 23:40:53 -0800
From: "David Kennedy" <dkennedy@acm.org>
Subject: perl: warning: Setting locale failed.
Message-Id: <738fah$8p8$1@discovery.intergate.bc.ca>

Can someone explain how to correct the following.  I've tried to decipher
the perllocale man page without much success.

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
 LC_ALL = "default",
 LANG = (unset)
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

Thank you
David Kennedy
dkennedy@acm.org






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

Date: 22 Nov 1998 14:50:02 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: PerlScript-Cookies???
Message-Id: <7398aq$1af$1@gellyfish.btinternet.com>

On Thu, 19 Nov 1998 01:39:55 GMT rohan666@my-dejanews.com wrote:
> I have a problem.... 

Please dont post the same message twice (using DejaNews is no excuse).
I have answered your other post.

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: Sun, 22 Nov 1998 05:56:31 GMT
From: wcd@aquik.net (Bob)
Subject: print  " Location:  problem " 
Message-Id: <3657a66a.17716119@news>


 I have been working on a perl script that will send the user to a
specific url if certain conditions are met.. 

But I can not for the life of me figure out why the line 

  print "Location: http://www.mysite.com/target.shtml\n\n";

does not work !   the script doesn't force the viewing browser to 
the url specified  by Location , but prints  the text ... 

 Location:  http://www.hotstart.com/pbook.shtml\n\n";

What is happening ?





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

Date: 22 Nov 1998 13:40:57 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: print  " Location:  problem "
Message-Id: <83k90nx5ly.fsf@vcpc.univie.ac.at>

Re: print  " Location:  problem " , Bob <wcd@aquik.net>
said:

Bob> But I can not for the life of me figure out why the
Bob> line

Bob>   print "Location: http://www.mysite.com/target.shtml\n\n";

Bob> does not work !  the script doesn't force the viewing
Bob> browser to the url specified by Location , but prints
Bob> the text ...

Bob>  Location: http://www.hotstart.com/pbook.shtml\n\n";

Try it off-line.  Then you will probably discover that you
are already outputting a text/html or text/plain stream and
this subsequent "Location" information then is just part of
the body of the stream.

The best way to do it off-line is to use CGI.pm and use the
redirect() method.

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien,  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Sun, 22 Nov 1998 05:07:30 -0800
From: Amy Alexander <amy@emsh.calarts.edu>
Subject: Re: print  " Location:  problem "
Message-Id: <36580C92.593EF0EF@emsh.calarts.edu>

Bob wrote:

>
>   print "Location: http://www.mysite.com/target.shtml\n\n";
>
> does not work !   the script doesn't force the viewing browser to
> the url specified  by Location , but prints  the text ...
>
>  Location:  http://www.hotstart.com/pbook.shtml\n\n";
>
> What is happening ?

It seems to me this happened to me once, but I forget the specifics. I
think it was while
working on a server push, so I probably had the header or Content-type
screwed up. Are
you doing anything else in your header?

-amy





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

Date: Sun, 22 Nov 1998 01:44:42 -0500
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Quick Perl prob.
Message-Id: <1divg46.p5t54y8qfbheN@bos-ip-1-84.ziplink.net>

Antony <amcnulty@nortel.co.uk> wrote:

> My script needs to be run a subroutine every time the timestamp of a certain
> file is altered.

Which part(s) of this are you having trouble with?

Does your script do other things while it's waiting, or does it just
have to monitor this specific file?

> I tried a couple of ideas but most seem to impractical and too memory
> consuming.

What have you tried so far?  How would you implement this that would
make it consume excess memory??

The only thing I can think of is to check the timestamp periodically
while your script is running, and if the timestamp changes call the
subroutine.


P.S.  Your subject header stinks.  Please read the following for
information on how to choose a good subject line:
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

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


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

Date: Sun, 22 Nov 1998 09:20:31 -0500
From: "Shawn Berg" <sberg1@tampabay.rr.com>
Subject: Re: Recommend Perl books?
Message-Id: <G7V52.3737$QO1.8157142@newse2.tampabay.rr.com>

>All are published by O'Reilly & Associates -- you should be able to find 
>them in any decent computer bookstore, or order them online at ora.com
>or amazon.com (or, no doubt, other online bookstores).  

Is the Regular Expression book worth buying?



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

Date: 22 Nov 1998 09:52:07 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Recommend Perl books?
Message-Id: <7398en$a4i@panix.com>

In <G7V52.3737$QO1.8157142@newse2.tampabay.rr.com> "Shawn Berg" <sberg1@tampabay.rr.com> writes:

>>All are published by O'Reilly & Associates -- you should be able to find 
>>them in any decent computer bookstore, or order them online at ora.com
>>or amazon.com (or, no doubt, other online bookstores).  

>Is the Regular Expression book worth buying?

Absopositively!

-- 
Clay Irving
clay@panix.com


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

Date: Sun, 22 Nov 1998 09:11:00 +0100
From: R. A. Larsen <r_larsen@image.dk>
Subject: Re: Regular Expression
Message-Id: <VA.00000089.0022bb8c@octo>

"Shawn Berg" <sberg1@tampabay.rr.com> wrote:
> 
> This is a multi-part message in MIME format.

Don't. Please turn it off. Some people won't reply to (or even see) your 
message if it contains HTML.

>     I was trying to write a some code that takes segments of a path  
> (from the environment and the command line) and build a complete valid  
> path.  I wanted to make it flexible so that the user would not have to  
> be concerned with the exact format of the segments (i.e., whether or not  
> to end with a '/').  @mydir contains each of the parts.  I eventually  
> got this code to work, but I'm curious to see some other methods.

It doesn't work (see below).

>          
>         my ($path) = "";  
>         my (@mydir) = ("/data", "foo/", "bar");
>         foreach (@mydir) {
>             s/([^\/])$/$1\//;
>             $path = $path . $_;  
>         }
>         print "$path\n";                    
>       
>     Output:
>         /data/foo/bar/
> 

Try replacing your second line with:
    my (@mydir) = ("/data", "/foo/", "bar");
and see the results ;).

I would problably do it like this:
    my @mydir = ("/data", "foo/", "bar");
    my $path = join '/', @mydir, '/';
    $path =~ s|/{2,}|/|g;
    print "$path\n";

But remember, TIMTOWTDI :)

By the way, you can use ' instead af " around a string unless you want perl 
to interpret the content of the string.

> --
> Cheers,
> Shawn Berg

I hope this helps.

Reni
-- 
Using Virtual Access
http://www.vamail.com



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

Date: 22 Nov 1998 13:59:48 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Regular Expression
Message-Id: <7395ck$18r$1@gellyfish.btinternet.com>

On Fri, 20 Nov 1998 20:51:42 -0500 Shawn Berg <sberg1@tampabay.rr.com> wrote:
> --
> Cheers,
> Shawn Berg
> 
Some might argue that an absence of content is in itself a regular expression
but in a Perl context I think not :-P

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: 22 Nov 1998 14:23:38 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Strange Failure
Message-Id: <7396pa$1a5$1@gellyfish.btinternet.com>

On Thu, 19 Nov 1998 17:28:07 -0500 I R A Aggie <fl_aggie@thepentagon.com> wrote:
> In article <sarsoffbbmx.fsf@camel.fastserv.com>, Uri Guttman
> <uri@fastengines.com> wrote:
> 
> + down boy! down! quick someone get the harness and let's tie randal down!
> + hurry, he is about to explode! help!! help!!!!
> 
> Let him explode. Sure, it'll be messy, but it'll be entertaining, too.
> 
As long as someone can capture it as an mpeg and post it to CPAN, sure - 

bring on the ever so wafer-thin after dinner mints please.


/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: 22 Nov 1998 07:39:42 GMT
From: "Zohar Sacks" <zohars@amdocs.com>
Subject: Re: upper to lowercase
Message-Id: <01be15f3$8262ecb0$630de00a@pchelp2nt>

use this string
tr/A-ZDE/a-zde/;
add what ever symbols you need (you can not use rang here),

_cim_ <cim@online.ee> wrote in article
<3650510f.15423434@news.online.ee>...
> I use this:
> 
> $text =~ tr/A-Z/a-z/;
> 
> to make the text lowercase, but it doesn't work with v d u | (and some
> other strange ones) - leaves them as they are.
> 
> help!
> 


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

Date: 22 Nov 1998 00:19:25 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Why doesn't something work?
Message-Id: <x77lwo2tk2.fsf@sysarch.com>

>>>>> "AY" == Alan Young <alany@2021.com> writes:

  AY> I'm having a problem understanding why something will work one way and
  AY> not another.  Here's the code snippet (look for ---> ):
  AY>       $totals_info{$1} = $2;
  AY> #---> Why doesn't %totals_info = ( $1 => $2 ) work?

  AY> If I try the code as indicated above I get *one* entry in totals_info.
  AY> Can anyone shed any light on this for me?

they are two different operations. 

%hash = ( 'a' => 2 ) ;

assigns the full list to the hash, erasing any previously stored
data. it is just like any other scalar or list assignment.

$hash{ 'a' } = 2 ;

assigns the value 2 to the key 'a' in %hash. so it doesn't affect
anything in %hash but 'a'.

hth,

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: 22 Nov 1998 14:48:16 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Win16 DLL access (on NT) Help!!!
Message-Id: <73987g$1ac$1@gellyfish.btinternet.com>

On Thu, 19 Nov 1998 23:12:13 -0800 Andrey L. Abramov <abramoa@leland.stanford.edu> wrote:
> Nope. I tried. Very hard. It does not load 16bit libraries.
> Or do I miss something?
> 

Thunking hell ;-}

It is possible but I fear that you might have to create your own 32 bit stub
DLL that will then call the 16 Bit one but that is way off topic for this
group. It will also require a 32bit C compiler.  You will get more info on
this from a MS-Windows programming group (or its FAQ).

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>


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

Date: Sun, 22 Nov 1998 10:23:28 -0400
From: Arved Sandstrom <Arved_37@chebucto.ns.ca>
To: Hong Yuan <hongy@bear.cs.ucla.edu>
Subject: Re: XS_unpack_charPtrPtr ??
Message-Id: <Pine.GSO.3.95.iB1.0.981122100723.5982A-100000@halifax.chebucto.ns.ca>

You must be using less type-checking than me when you compile... :-)

Seriously, I thought this was interesting and took a look, and I get
essentially the same results. I think this is one of those cases where the
typemap is not going to do all the work for you - if you look at it char
** is certainly there in TYPEMAP, featured as a T_PACKED, and in the INPUT
and OUTPUT sections of the typemap T_PACKED is associated with
translations of form XS_pack_* and XS_unpack_*.

After doing a batch search on every file in the Perl sources, I'm
reasonably sure that these beasts - in particular, XS_unpack_charPtrPtr -
don't exist.

Why are they there? I'd like some expert input/commentary on this myself.
I can only guess that they're suggestions to write some of your own code
to make an intelligent conversion of a Perl input variable to a char ** in
an XSUB.

In connection with this, you'd be calling (presumably) a Perl subroutine
foo() as

$some_int = foo($another_int, $something_that_looks_like_charPtrPtr);

I've been racking my brain to figure out how you'd generate the last
variable. A Perl scalar, let's say a string, is going to be char * in the
XSUB. A list of strings isn't appearing as a single item anyhow. A
reference to a scalar containing a string is showing up as an RV * inside
the XSUB, again not as a char **.

So, just as a suggestion, maybe you could post the other part - an example
of how you would be wanting to call this sub in *Perl*. It may well be
that you don't need char **.

But for me, I'd still like to get some expert input on this whole business
of char ** in the typemap.

On 20 Nov 1998, Hong Yuan wrote:

> Hi,
> 
> I'm learning XS.  I have in xs file this:
>     
> int
> foo(a, b)
>    int    a;
>    char**  b;
> 
> It compiled OK.  When I tried to call foo, I got:
> Unresolved symbol: XS_unpack_charPtrPtr
>             
> Where's XS_unpack_charPtrPtr?



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

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


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 4273
**************************************

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