[19567] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1762 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 17 18:05:33 2001

Date: Mon, 17 Sep 2001 15:05:11 -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: <1000764311-v10-i1762@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 17 Sep 2001     Volume: 10 Number: 1762

Today's topics:
    Re: debug CGI script (Joe Chung)
    Re: Difference between .pl, .cgi, and .pm File Extensio <jurgenex@hotmail.com>
    Re: Does Perl Support Multi-Byte Parsing and Comparisio <muchari@cisco.com>
        finding out working directory (Joachim Ziegler)
    Re: finding out working directory <e@nospam:[arix.com]>
    Re: finding out working directory <jurgenex@hotmail.com>
    Re: finding out working directory <ronh@iainc.com>
    Re: finding out working directory <ronh@iainc.com>
    Re: finding out working directory <ronh@iainc.com>
        help requested for simple CGI problem <av207@columbia.edu>
    Re: local() breaks with imported vars (Exporter bug?) (Malcolm Dew-Jones)
    Re: local() breaks with imported vars (Exporter bug?) <mjcarman@home.com>
    Re: Looking for Perl programers in Toronto <tsee@gmx.net>
    Re: Need help with this regex problem: <cdi4@mindspring.com>
        Numeric check on data with underscore (kiran dronamraju)
    Re: Numeric check on data with underscore <skuo@mtwhitney.nsc.com>
    Re: Peek and Poke on Perl? <gamtci1@mpinet.net>
        PERL and SNPP on AIX (sue)
        perl module (Joe Chung)
    Re: Simple CGI: how to set up downloads? <flavell@mail.cern.ch>
    Re: upgrading berkeley DB 1.85 to 3.3? <gnarinn@hotmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 17 Sep 2001 18:30:31 GMT
From: m_010@yahoo.com (Joe Chung)
Subject: Re: debug CGI script
Message-Id: <3ba64139.5535469@enews.newsguy.com>

I mean for HTTP POSTing

On Mon, 17 Sep 2001 09:29:16 GMT, Bart Lateur <bart.lateur@skynet.be>
wrote:

>Joe Chung wrote:
>
>>If I want to debug live from web server:
>>
>>#!/usr/bin/perl -d:ptkdb
>>
>>any way I can have the perl debugger GUI pop up when user request
>>comes in (on UNIX)?  I can't think of a way do that.
>
>If this works at all, it would pop up a debugging window on your
>*server*, not on your client.
>
>>In other word, any way I can debug CGI script POST from web client?  I
>>am telnet/ssh to a unix terminal. 
>
>You could try installing a local web server on your own computer.
>Perhaps then it would pop up on your own screen.
>
>Maybe the remote debugging tools available from ActiveState could help.
>Search their site for "Komodo". I've never actually even looked at it,
>so I'm not sure it really does what I think it does.
>
>I don't ever debug perl scripts that way, and most definitely not CGI
>scripts.



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

Date: Mon, 17 Sep 2001 14:31:30 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Difference between .pl, .cgi, and .pm File Extensions.
Message-Id: <3ba66bbc@news.microsoft.com>

"Trewth Seeker" <trewth_seeker@yahoo.com> wrote in message
news:d690a633.0109141629.1a2ebcf7@posting.google.com...
> damian@qimr.edu.au (Damian James) wrote in message
news:<slrn9pnqsr.o41.damian@puma.qimr.edu.au>...
> > Trewth Seeker chose 6 Sep 2001 18:44:55 -0700 to say this:
> > >"J?gen Exner" <jurgenex@hotmail.com> wrote in message
news:<3b8fcb68$1@news.microsoft.com>...
> > >> "Trewth Seeker" <trewth_seeker@yahoo.com> wrote in message
> > >> news:d690a633.0108302015.60293f45@posting.google.com...
> > >> > .pl and .cgi files also must be "installed onto a server" -- where
*else*
> > >> > do you expect them to be?
> > >>
> > >> Hmm, then I guess my computer is broken.
> > >> If I type "foobar.cgi" at the command line my computer will run the
program
> > >> "foobar.cgi". No server of whatever kind involved here.
> > >
> > >Your PC is a server of a kind.
>   The issue here is the meaning of "server"
>   in various contexts.  [...]

So far agreed.

> "server" means "HTTP server" only to ignoramuses.  Do you suppose
> a machine must have "perl installed" to run, say, an X server?
> Or a time-sharing server?  A PC is, as I said,
> "a server of a kind" -- it serves up execution of programs.

Well, ok, granted. As this is a rather uncommon (although not necessarily
wrong) definition of "server" I hope you don't mind if I don't quite follow
you.
For me the simple local execution of a program does not involve a server, at
least not in the context we are talking about here (if you go into the level
of OS architecture then matters change, of course).

jue

jue




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

Date: Mon, 17 Sep 2001 12:06:37 -0700
From: Murali Chari <muchari@cisco.com>
Subject: Re: Does Perl Support Multi-Byte Parsing and Comparision?
Message-Id: <3BA649BD.603E2C9E@cisco.com>

My bad. Is that why I haven't got any answers so far? :-)

-Murali

Tad McClellan wrote:

> Murali Chari <muchari@cisco.com> wrote:
>
> >Please email me to share your thoughts. (and code if you have any. ;-)
>         ^^^^^^^^
>
> Hoarding answers in not very community conscious.
>
> _Post_ your thoughts, let more than one person benefit.
>
> --
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas



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

Date: 17 Sep 2001 12:48:58 -0700
From: ziegler@algorilla.de (Joachim Ziegler)
Subject: finding out working directory
Message-Id: <93aad7d0.0109171148.2f09284d@posting.google.com>

with perl, how do i find out 
in which directory my script currently is?

greetings,
joachim


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

Date: Mon, 17 Sep 2001 21:23:41 GMT
From: "ekkis" <e@nospam:[arix.com]>
Subject: Re: finding out working directory
Message-Id: <xRtp7.3287$%B1.196332670@newssvr14.news.prodigy.com>

joachim, typically $0 will contain the path of your script.  if it has no
path information i.e. no slashes or just a "./" then use the current working
directory (you can get with `pwd`)

"Joachim Ziegler" <ziegler@algorilla.de> wrote in message
news:93aad7d0.0109171148.2f09284d@posting.google.com...
> with perl, how do i find out
> in which directory my script currently is?
>
> greetings,
> joachim




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

Date: Mon, 17 Sep 2001 14:32:48 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: finding out working directory
Message-Id: <3ba66c09$1@news.microsoft.com>

"Joachim Ziegler" <ziegler@algorilla.de> wrote in message
news:93aad7d0.0109171148.2f09284d@posting.google.com...
> with perl, how do i find out
> in which directory my script currently is?

perldoc -m cwd

jue




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

Date: Mon, 17 Sep 2001 21:35:15 GMT
From: "Ron Hartikka" <ronh@iainc.com>
Subject: Re: finding out working directory
Message-Id: <n0up7.80122$Hm.862558@typhoon.mw.mediaone.net>

# perldoc Win32,

# I tried...

use Win32;
print Win32::GetCwd(), "\n";

Win32::SetCwd('c:\ron');
print Win32::GetCwd(), "\n";

 .... it printed...

C:\Ron\perl\examples
c:\ron




"Joachim Ziegler" <ziegler@algorilla.de> wrote in message
news:93aad7d0.0109171148.2f09284d@posting.google.com...
> with perl, how do i find out
> in which directory my script currently is?
>
> greetings,
> joachim




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

Date: Mon, 17 Sep 2001 21:35:15 GMT
From: "Ron Hartikka" <ronh@iainc.com>
Subject: Re: finding out working directory
Message-Id: <n0up7.80123$Hm.862558@typhoon.mw.mediaone.net>

My other reply applies only, of course, to win32, where I happen to be now
:(

Otherwise I concur with ekkis: Do this:

$workdir = `pwd`;



"Joachim Ziegler" <ziegler@algorilla.de> wrote in message
news:93aad7d0.0109171148.2f09284d@posting.google.com...
> with perl, how do i find out
> in which directory my script currently is?
>
> greetings,
> joachim




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

Date: Mon, 17 Sep 2001 21:39:32 GMT
From: "Ron Hartikka" <ronh@iainc.com>
Subject: Re: finding out working directory
Message-Id: <o4up7.80125$Hm.862805@typhoon.mw.mediaone.net>

Jurgen has the best answer because it is portable.

`pwd` won't work on windows; Win32 won't work elsewhere.


"Joachim Ziegler" <ziegler@algorilla.de> wrote in message
news:93aad7d0.0109171148.2f09284d@posting.google.com...
> with perl, how do i find out
> in which directory my script currently is?
>
> greetings,
> joachim




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

Date: Mon, 17 Sep 2001 17:36:00 -0400
From: "Tony V" <av207@columbia.edu>
Subject: help requested for simple CGI problem
Message-Id: <9o5qbn$33k$1@newsmaster.cc.columbia.edu>

Hi, I've learned perl basically out of necessity -- for a web project.  I've
had no previous programing experience but have managed fairly well.  Except
for this one final problem that has been driving me nuts.  I've tried to
look this up in resources but apparently don't know where to look.  Please
be receptive and kind and help me out rather than condescending.

The following script attempts to retreive the values from HTML form inputs
that are numerically and sequentially named (ie. 1,2,3,4).  The total number
of inputs to be read varies.  PROBLEM: this script works fine when
$value{'total'} is below somewhere around 50.  Above this threshold, the
browser stalls and cannot complete the program.  I'm wondering if there is
some sort of upper limit to how many elements can be stored in a hash.  I
know this is a pretty stupid guess, but that's my level of expertise.

use CGI;
$cgiobject = new CGI;
print $cgiobject->header;

foreach (0..$value{'total'})         # the problems arise when this variable
is set too high
$value{$_} = $cgiobject->param("$_");
    if ($value{$_} ne "") {
        print "input name is $_";
        print "input value is $value{$_};
        print "<br>";
    }
}

So as you can see, this script iterates from 0 to the total number of
inputs.  It retreives the data of each input.  If the input is not blank it
spits back it's contents to HTML.  Through debugging the larger program that
this is a part of, I've been able to isolate the problem down to here.
Thanks for all of your help in advance.  It will be greatly appreciated.

--Tony




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

Date: 17 Sep 2001 11:25:23 -0800
From: yf110@victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: local() breaks with imported vars (Exporter bug?)
Message-Id: <3ba64013@news.victoria.tc.ca>

Michael Carman (mjcarman@home.com) wrote:

: While using Test.pm to develop test cases for a module, I tried to
: local()ize an imported variable and then call a subroutine which used
: that variable. (I wanted to give each group of tests it's own scope to
: eliminate interaction between sets.)

It looks to me like 'local' affects the symbol table, not the variable
itself.  If local _could_ affect the variable itself, then the following
would be possible

	my $var = 'value';
	{ local $var = 'another value';
	  print $var; 	# $var would be lexically scoped, but with 
			# a different value temporarily
	}

The above is not what perl does at all, but conceptually it makes sense
(to me).  Each var could actually be the top of a stack, and accessing the
var accesses the top item.

Instead, it is only the symbol table that works that way.  Localizing a
variable must squirrel away the symbol table entry and replace it with
another entry.  Therefore anything accessing that symbol table access the
alternate variable.  (And by the same token, accessing any other symbol
table does not access the alternate variable).  When the local scope is
over, perl pops the original entry back into the symbol table.

The effect can be seen if you take the reference to a variable.
Localizing the variable does not affect the reference, so you can still
access both variables - even though one is visible by name

	$_ = 'the original value';
	my $ref = \$_ ;
	{  local $_ = 'a different value';
	   s/modify the $_ variable/;
	   print "local \$_ is $_";
	   print "but the original \$_ is still here and is $$ref";
	}


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

Date: Mon, 17 Sep 2001 14:43:39 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: local() breaks with imported vars (Exporter bug?)
Message-Id: <3BA6526B.FDEAC97C@home.com>

Joe Schaefer wrote:
>
>  Michael Carman <mjcarman@home.com> writes:
> 
> > @ISA         = qw(Exporter);
> > @EXPORT      = qw($FOO foo_is);
> 
> I think you should export *FOO here instead.

No, I don't want to make any more of a mess of the importing namespace
than necessary. It wouldn't actually hurt anything, but... Besides, it's
only in the test case that I wanted to be able to say 'local $FOO' --
the real application has no such shenanigans.

> When you are aliasing, there is an important difference between
> 
>   *var = *FOO;  # *FOO and *var point to _same_ typeglob
>                 # same as *var = \*FOO ?
> 
> and something like
> 
>   *var = \$FOO; # *FOO and *var remain distinct, but the
>                 # scalar slot for *var is aliased to *FOO's.
>                 # All other slots in *var remain unaffected!

Interesting. I wasn't aware of the subtle distinction. Everything I've
seen seems to say that

    *var = *FOO;

is essentially just shorthand for

    *var = \$FOO;
    *var = \@FOO;
    *var = \%FOO;
    # etc.

This isn't quite true, though. "*var = *FOO" seems to bind more deeply,
such that the two glob names are truly synonymous. Where is this
documented?

> $main::FOO and $Foo::FOO are distinct Perl variables that (when
> aliased) share a common value.  Localizing $main::FOO breaks the
> alias [...]

Yeah, I came to the same conclusion after letting it soak in the back of
my head for a while.

Pay no attention to the man behind the curtain...

-mjc


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

Date: Mon, 17 Sep 2001 22:45:50 +0200
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: Looking for Perl programers in Toronto
Message-Id: <9o5n4h$q5s$06$1@news.t-online.com>

"hallaj.com" <wael@hallaj.com> schrieb im Newsbeitrag
news:orcp7.60560$j65.10376207@news4.rdc1.on.home.com...
> Hi
>
> I'm looking for perl programers in Toronto. Contact me if you know one.

jobs.perl.org


Steffen




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

Date: Mon, 17 Sep 2001 12:18:53 -0700
From: Cal Dunigan <cdi4@mindspring.com>
Subject: Re: Need help with this regex problem:
Message-Id: <3BA64C9D.6020005@mindspring.com>

Would something like this work for you?
   # First make sure the line is exactly 11 characters.
   if ($line =~ /^.{11}$/) {
       if ($line =~ /^ *\d+$/) { # check for spaces followed by digits

Batormaster666 wrote:

> Hi all,
> 
> Could somebody please help me with this regex problem I need to perform for
> syntax checking?
> I've got to check the syntax of a string that starts with a positive integer
> and is padded right by space characters up to a length of 11 characters.
> This is then followed by a \n.
> I 1st thought of this but it of course won't work:
> ^(\d+ *){11}\n$
> 
> Thanks,
> Batormaster666.
> 
> 
> 



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

Date: 17 Sep 2001 12:28:00 -0700
From: dronamk@yahoo.com (kiran dronamraju)
Subject: Numeric check on data with underscore
Message-Id: <9eca2bc5.0109171128.7c62e22@posting.google.com>

I'm having problems with numeric checks on data with underscore.
I am aware the numeric literals can have _ as a character as a
thousands separator. However, I'd want the data to be treated as
Non-Number.
Below is a sample depicting the problem.
Any help is appreciated and gladly accepted. Thanks.

#! (whence perl)
$x = 123_456_;
print $x."\n";
if ($x =~ /^(\d+)$/ ) {
#if ($x =~ /^[0-9]+$/ ) {
print "Number\n";
} else { print "Alphanumeric\n"; }

Prints values:
123456
Number


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

Date: Mon, 17 Sep 2001 13:15:12 -0700
From: Steven Kuo <skuo@mtwhitney.nsc.com>
Subject: Re: Numeric check on data with underscore
Message-Id: <Pine.GSO.4.21.0109171307460.20202-100000@mtwhitney.nsc.com>

On 17 Sep 2001, kiran dronamraju wrote:

> I'm having problems with numeric checks on data with underscore.
> I am aware the numeric literals can have _ as a character as a
> thousands separator. However, I'd want the data to be treated as
> Non-Number.
> Below is a sample depicting the problem.
> Any help is appreciated and gladly accepted. Thanks.
> 
> #! (whence perl)
> $x = 123_456_;
> print $x."\n";
> if ($x =~ /^(\d+)$/ ) {
> #if ($x =~ /^[0-9]+$/ ) {
> print "Number\n";
> } else { print "Alphanumeric\n"; }
> 
> Prints values:
> 123456
> Number
> 


Here's what compiler sees:

% perl -MO=Deparse mytest
my $x = 123456;
print $x . "\n";
if ($x =~ /^\d+$/) {
    print "Number\n";
}
else {
    print "Alphanumeric\n";
}
mytest syntax OK

$x is the same as if you had written: $x = 123456;


Perhaps you could try instead:

my $x = "123_456_";
print eval $x,"\n";
if ($x =~ /^\d+$/) { 
    print "Number\n";
} else { 
    print "Alphanumeric\n";
}



__ 
Cheers,
Steve



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

Date: Mon, 17 Sep 2001 18:41:05 GMT
From: Gary <gamtci1@mpinet.net>
Subject: Re: Peek and Poke on Perl?
Message-Id: <3BA64384.630F@mpinet.net>

Thank you. I realize standalone programs can be written to use 
STDOUT and STDIN. However, I need a faster access time in order to 
respond timely. I will consult the "XS" mechanism you mentioned.

Also, I understand one can write a C library and call it as a module,
however, my experience writing Windows programs is lacking (Since 
Windows I've kept my work in the embedded world). I had hoped someone 
would have already written a peek/poke and inp/outp module for Perl. 
It seems like a valuable extension.


remove the "1" to reply


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

Date: 17 Sep 2001 12:04:15 -0700
From: swraight@src-email.com (sue)
Subject: PERL and SNPP on AIX
Message-Id: <d8bf5143.0109171104.5f2faad@posting.google.com>

I am attempting to install a program called sendpage and it uses the
protocol SNPP. Well I didn't have it so I downloaded it and am
attempting to install it and I have absolutely no clue where it is
installing it. The Makefile.PL looks like this:
# This -*- perl -*- script makes the Makefile

use 5.005;
use ExtUtils::MakeMaker;

WriteMakefile(
  VERSION_FROM  => 'lib/Net/SNPP.pm',
  NAME          => 'Net::SNPP',
  PREREQ_PM     => { 'Net::Cmd' => 0.01 },
);

So I run "perl Makefile.PL". It creates a Makefile. So I run "make"
and it says this:

Target "makemakerdflt" is up to date.

I have no clue what that means. Then I run "make install" and it says
this:

Installing /ii/pa/perl-5.6.1/usr/local/man/man3/Net::SNPP.3
Writing /ii/pa/perl-5.6.1/usr/local/lib/perl5/site_perl/5.6.1/aix-thread/auto/Net/SNPP/.packlist
Appending installation info to
/ii/pa/perl-5.6.1/usr/local/lib/perl5/5.6.1/aix-thread/perllocal.pod
Target "install" is up to date.

I don't know what to do at this point. I don't know where the
installation is at and I have no clue how to execute it. Can someone
help me? I am running AIX 4.3.3 and have the latest perl. THANKS!
Sue


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

Date: Mon, 17 Sep 2001 21:05:47 GMT
From: m_010@yahoo.com (Joe Chung)
Subject: perl module
Message-Id: <3ba65a60.11974047@enews.newsguy.com>

does perl module all end with pm extension?  are they plain text file?
or binary file? do i need to recomplie my perl interperter to
integrate the module into perl?  or i just need to put xxxx.pm into
the perl interperter's path?

since i had read some article said i need to recompile perl
distribution to use some module.

thanks



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

Date: Mon, 17 Sep 2001 20:05:57 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Simple CGI: how to set up downloads?
Message-Id: <Pine.LNX.4.30.0109172000510.24825-100000@lxplus023.cern.ch>

On Sep 18, W K inscribed on the eternal scroll:

> > Where can I read more on implementing file downloads?
>
> Your information doesn't seem to say anything about perl or even CGI.

This isn't the only place that the original poster asked the question.
See also <9o54qa$8mg$1@panix3.panix.com> on c.i.w.servers.unix.




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

Date: Mon, 17 Sep 2001 18:12:15 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: upgrading berkeley DB 1.85 to 3.3?
Message-Id: <1000750335.325700107961893.gnarinn@hotmail.com>

In article <3BA4A4F8.C1F7A591@salford.ac.uk>,
mark grimshaw  <m.grimshaw@salford.ac.uk> wrote:
>Hi all,
>
>I'm currently in the process of transferring our web server from SGI
>IRIX to Linux.  All databases on IRIX used berkeley db 1.85 and ran with
>perl 5.005_02.  All files transferred have been transferred with
>original owner, group and permissions.
>
>LINUX: berkeley 3.3, DB_File (that comes with the 3.3 dist.) and perl
>5.6.1
>
>With all the above installed however, none of my perl scripts (unedited
>scripts that ran fine on IRIX) will tie() the 1.85 files that were
>transferred across from the IRIX box.  The readme files for berkeley 3.3
>mentioned possible problems with the perl dist (5.6.0) that comes with
>some linux distributions hence my reason for installing 5.6.1 (and then
>reinstalling 3.3 and DB_File).
>
>Has anyone had this problem and resolved it?  If so, what is the
>solution?
>

you should not trust the database files to be binary compatible when
moved across mystems and versions, especially when moving such a big
step as between 1.85 and 3.3

in the past i have just made a simple export/import script and
transferred the files as text. simple and foolproof.

gnari


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

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


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