[16037] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3449 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 22 03:24:10 2000

Date: Thu, 22 Jun 2000 00:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <961657513-v9-i3449@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 22 Jun 2000     Volume: 9 Number: 3449

Today's topics:
    Re: And now, The Forehead Smack... (Craig Berry)
    Re: Directory spaces causing problems? <tina@streetmail.com>
        Do any of you know how to do this? <psychoNOpsSPAM@pcpatches.com.invalid>
    Re: Do any of you know how to do this? (Brandon Metcalf)
    Re: Error checking with Getopts (Johan Vromans)
        Help needed building Perl 5.6 on AIX <tom.williams@diversifiedsoftware.com>
        Know of any good perl books? (David Bell)
    Re: Know of any good perl books? <filipe@reichardt.ch>
        Make perl-5.6.0 on AIX4.2.1.0 <dentalsales@gunz.com.au>
    Re: Newbie question about subroutines... <dan@tuatha.sidhe.org>
    Re: Perl 5.6 says 'syntax error', Perl 5.005_03 does no <persicom@acedsl.com>
    Re: perl for automated scp (Rafael Garcia-Suarez)
    Re: perl reference challenge: <persicom@acedsl.com>
    Re: Perl use DBI memory error <jhelman@wsb.com>
        Problem installing CPAN Date::Calc aphiny6592@my-deja.com
    Re: Programming Question <blumbjNOblSPAM@hotmail.com.invalid>
    Re: simple array question <ils@gil.com.au>
    Re: simple array question <ils@gil.com.au>
    Re: simple array question <ils@gil.com.au>
    Re: using cgi.pm for radio buttons <jhelman@wsb.com>
    Re: Where is @INC in ActiveState Perl for Win32 ??????? <jhelman@wsb.com>
    Re: Why cant a cgi and module use the same library? <jhelman@wsb.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 22 Jun 2000 04:20:32 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: And now, The Forehead Smack...
Message-Id: <sl350g4fe7f172@corp.supernews.com>

Mark Badolato (mbadolato@cybernox.com) wrote:
: The submitted bios were edited, reworded, reduced etc, by someone who 
: apparently Just Doesn't Get It.  Today we were sent the bio sheet to 
: review for mistakes etc.  Mine contained this edited-down gem:
: 
: "He was the first one to create and release modifications and 
: enhancements on Perl scripts."

No, no, *you* don't get it.  Before you came along with your blundering
disregard for Perl beauty, no scripts had ever been modified or enhanced; 
each was, at its birth, a perfect and complete gem, which could only be
marred by any change.  You were the first whose scripts could be improved
through rework. 

: Wow. Apparently I'm a pioneer.  Just out of curiosity, what the hell 
: were you guys doing between 1987 and 1996?  Just leaving scripts as-is, 
: or writing completely new ones??  Sheesh....  =8-)

You little knew how right you were here, hm?

: Needless to say, I made sure to submit corrections before catching crap 
: from my co-workers.  =)

I'm glad this sort of thing doesn't only happen at my company.

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Beauty and strength, leaping laughter and delicious
   |   languor, force and fire, are of us." - Liber AL II:20


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

Date: 22 Jun 2000 03:29:55 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Directory spaces causing problems?
Message-Id: <8is17j$5ce1j$1@fu-berlin.de>

hi,

Tom Phoenix <rootbeer@redcat.com> wrote:
> On Tue, 2 May 2000, Tina Mueller wrote:

>> maybe you have to put in a backslash to escape the
>> whitespace:
>> $file = "School\ Trips";

> There's no backslash in that string; see the perlop manpage for more
> information. Cheers!

hm, probably i'm a little bit late with this, but why
does this work then? for me it works. there *should*
be no backslash, that's right. have you read the 
actual question?
let's say I have a directory "test dir".
with a file "file" in it. then the following code:

tina@syracus:~ > perl -e'
$file = "test\ dir";
opendir DIR, $file or die $!;
@array=readdir DIR;
print "@array\n";'

prints:
 . .. file


tina


-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \ _,_\ __/\ __/_| /__/ perception
"The Software required Win98 or better, so I installed Linux."


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

Date: Wed, 21 Jun 2000 22:45:12 -0700
From: psycho <psychoNOpsSPAM@pcpatches.com.invalid>
Subject: Do any of you know how to do this?
Message-Id: <1e7399d4.53d828e5@usw-ex0104-026.remarq.com>

does any one know how to do something like this? <img
src="cgi_file.cgi"> and then the cgi shows an image.


thanks,
 psycho

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



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

Date: 22 Jun 2000 06:30:08 GMT
From: bmetcalf@baynetworks.com (Brandon Metcalf)
Subject: Re: Do any of you know how to do this?
Message-Id: <8isbpg$h2b$1@bcrkh13.ca.nortel.com>

psychoNOpsSPAM@pcpatches.com.invalid writes:

 > does any one know how to do something like this? <img
 > src="cgi_file.cgi"> and then the cgi shows an image.

And your Perl question is?

Brandon


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

Date: 22 Jun 2000 08:18:14 +0200
From: JVromans@Squirrel.nl (Johan Vromans)
Subject: Re: Error checking with Getopts
Message-Id: <wl3hfam5jdl.fsf@plume.nl.compuware.com>

pmacadam@my-deja.com writes:

> getopts("u:p:", \%opts);
> 
> However, if they type myprog.pl -u -p xxx, then $opts{'u'} equals -p,
> and $opts{'p'} never gets set.

That's because you asked for it. -u requires an argument, so it takes
whatever follows.

You can use Getopt::Long (also standard with Perl) that is a little
more complex to use, but provides precise control. 

  use Getopt::Long;
  GetOptions (\%opts, "u:s", "p=s");

This will _require_ a value for the -p option, but _allow_ a value for -u.
In other words, myprog.pl -u -p xxx will store an empty string in
$opts{'u'} and 'xxx' in $opts{'p'}.

-- Johan


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

Date: Thu, 22 Jun 2000 01:34:39 GMT
From: Tom Williams <tom.williams@diversifiedsoftware.com>
Subject: Help needed building Perl 5.6 on AIX
Message-Id: <8irqff$4d6$1@nnrp1.deja.com>

Hi!  I'm trying to build Perl 5.6 from source on AIX 4.3.1 and the
Configure script hangs because I don't have any man pages installed in
source form.

Is there a way to get around this (besides installing the man pages in
source form)?

Thanks in advance for your time!

Peace....

Tom


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 22 Jun 2000 05:00:29 GMT
From: db7654321@aol.comspamsux (David Bell)
Subject: Know of any good perl books?
Message-Id: <20000622010029.02920.00002923@ng-cg1.aol.com>

Hello!  I'm looking for a good Perl book.  I've got 'Learning Perl' from
O'Reilly, and it's great, but I'd like something a bit more in-depth.  ...And
with more CGI info.  I was thinking about getting 'Programming Perl', is this
one good?  ...Does it also have CGI info?  ...If not, any recommendations for a
good CGI book?  :) I'm running Perl on a Linux machine, so Windoze oriented
books are not preferred.  Thanks!

-------------------------
David Bell - Otherwise known as DB7654321

Remember to remove nospam, notrash or anything odd looking from my email
address. :)


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

Date: Thu, 22 Jun 2000 08:24:55 +0200
From: Filipe Luis <filipe@reichardt.ch>
Subject: Re: Know of any good perl books?
Message-Id: <3951B137.2C1C8673@reichardt.ch>

> good CGI book?  :) I'm running Perl on a Linux machine, so Windoze 

CGI Programming with Perl, 2nd Edition
By Scott Guelich, Shishir Gundavaram, and Gunther Birznieks
2nd Edition July 2000
ISBN: 1-56592-419-3
470 pages, $34.95
O'Reilly

for further information look up:

http://www.oreilly.com/catalog/cgi2/noframes.html


bye Filipe


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

Date: Thu, 22 Jun 2000 13:26:24 +1000
From: "Neil Lunn" <dentalsales@gunz.com.au>
Subject: Make perl-5.6.0 on AIX4.2.1.0
Message-Id: <JIf45.20339$N4.796680@ozemail.com.au>

Help,

I get this strange line when trying to run make.
cc: file path prefix `/usr/local/lib/gcc-lib/E:perl.exp/2.95.1/' never used

How is this line being picked up. I assume it's looking for the C library
which it finds earlier in the build
/usr/local/lib/gcc-lib/rs6000-ibm-aix4.2.0.0/2.95.1/

Something that should be passed during Configure?

Neil

-- buildlog.log --
AutoSplitting ../../lib/DynaLoader.pm (../../lib/auto/DynaLoader)
        ../../miniperl "-I../../lib" "-I../../lib" -e 'use
ExtUtils::Mksymlists;
  Mksymlists("NAME" => "DynaLoader", "DL_FUNCS" => {  }, "FUNCLIST" => [],
"DL_V
ARS" => []);'
        rm -f DynaLoader.xs
        cp dl_aix.xs DynaLoader.xs
        ../../miniperl -I../../lib -I../../lib
 ../../lib/ExtUtils/xsubpp -noprot
otypes -typemap ../../lib/ExtUtils/typemap DynaLoader.xs > DynaLoader.xsc &&
mv
DynaLoader.xsc DynaLoader.c




    cc -c  -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=16384 -fn
o-strict-aliasing -I/usr/local/include -O      -DVERSION=\"1.04\"  -DXS_VERS
ION=
\"1.04\"  -I../.. -DPERL_CORE -DLIBC="" DynaLoader.c
        rm -rf ../../lib/auto/DynaLoader/DynaLoader.a
        /usr/bin/ar cr ../../lib/auto/DynaLoader/DynaLoader.a DynaLoader.o
&& :
 ../../lib/auto/DynaLoader/DynaLoader.a
        chmod 755 ../../lib/auto/DynaLoader/DynaLoader.a
        ./miniperl makedef.pl PLATFORM=aix | sort -u | sort -f >
perl.exp.tmp
        sh mv-if-diff perl.exp.tmp perl.exp
          cc  -L/usr/local/lib -bE:perl.exp -o perl perlmain.o
lib/auto/DynaLoad
er/DynaLoader.a  libperl.a `cat
ext.libs` -lnsl -ldbm -ldl -lld -lm -lc -lbsd -l
PW -liconv


-- buildlog.log.err --

make: 1254-004 The error code from the last command is 1.
make: 1254-005 Ignored error code 1 from last command.
          CCCMD =
 cc -DPERL_CORE -c -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOU
RCE -qmaxmem=16384 -fno-strict-aliasing -I/usr/local/include -O
cc: unrecognized option `-qmaxmem=16384'
cc: unrecognized option `-qmaxmem=16384'
In file included from DynaLoader.xs:39:
/usr/local/lib/gcc-lib/rs6000-ibm-aix4.2.0.0/2.95.1/include/ldfcn.h:166:
warning
: `FREAD' redefined
/usr/include/fcntl.h:218: warning: this is the location of the previous
definiti
on
/usr/local/lib/gcc-lib/rs6000-ibm-aix4.2.0.0/2.95.1/include/ldfcn.h:169:
warning
: `FWRITE' redefined
/usr/include/fcntl.h:219: warning: this is the location of the previous
definiti
on
ld: 0706-005 Cannot find or open file: libgcc.a
        ld:open(): A file or directory in the path name does not exist.
ld: 0706-005 Cannot find or open file: libgcc.a
        ld:open(): A file or directory in the path name does not exist.
cc: file path prefix `/usr/local/lib/gcc-lib/E:perl.exp/2.95.1/' never used
make: 1254-004 The error code from the last command is 1.


Stop.





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

Date: Thu, 22 Jun 2000 03:01:30 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Newbie question about subroutines...
Message-Id: <ekf45.7314$Zg4.24945@news1.rdc1.ct.home.com>

Vlasis Hatzistavrou <vhatz@ccf.auth.gr> wrote:
> What I meant was if there is a way to:

> call sub 1
> call sub 2
> call sub 3

> and all 3 subroutines running at the same time.

Then what you want is threads. Or to spawn off a bunch of child processes
to do it, one child per sub, though that only works if the children don't
affect one another or the parent except for the data they return.

> I want to launch them together because I want to make a metasearch engine
> andthe searches in the different engines must happen at the same time because
> otherwise it would take a lot of time to wait for one engine to finish, then
> launch the other etc.

What you _also_ need is permission. Most of the major search engines want
you to at least ask before you do this. If you're making a public
interface then some (possibly all, though you must check) require
licensing of some sort, too. The engines get their revenues from
advertising, and since a meta-engine strips that out you're basically
using someone's resources without paying, which isn't too polite.

				Dan


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

Date: Thu, 22 Jun 2000 01:12:27 GMT
From: Matthew O. Persico <persicom@acedsl.com>
Subject: Re: Perl 5.6 says 'syntax error', Perl 5.005_03 does not
Message-Id: <8irp5i$3jk$1@nnrp1.deja.com>

In article
<Pine.GSO.4.10.10006211333240.4312-100000@user2.teleport.com>,
  Tom Phoenix <rootbeer@redcat.com> wrote:

> I suspect that the DWIMmer in 5.6.0 is confused and thinks that you
> want { 1, $_ } to be an anonymous hashref.

I'd call it more like BORKEN [sic] than confused. I cannot think of a
time where that would ever want to be a hash ref. Can you?

--
Matthew O. Persico
'user' is a four-letter word.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 22 Jun 2000 06:48:58 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: perl for automated scp
Message-Id: <slrn8l3duf.9or.garcia_suarez@rafael.kazibao.net>

arandachristian@hotmail.com wrote in comp.lang.perl.misc:
>All,
>
>I am writing a perl cgi script that will hopefully be used in the
>following way:
>
>1) it will use secure copy to copy a file to a predetermined
>destination server.
>
>2) it will allow users to enter a source host and filename
>
>3) it will use RSA authentication
>
>The script is running as nobody when it executes on the web server.
>This is what I believe poses the problem.  When running as nobody, I
>receive the following error:
>
>Could not create directory '//.ssh'.
>The authenticity of host 'me.myco.com' can't be established.
>Key fingerprint is [fingerprint here].
>Are you sure you want to continue connecting (yes/no)?

scp tries to create a .ssh directory in the home directory of the
invoking user -- and the home directory of nobody is '/' on your
platform. More precisely, it tries to create /.ssh/known_hosts, that
contains host keys. Obviously, nobody can't write into /.

>If I am logged in as myself and chmod +s scriptname and run it as
>nobody I get the same results.

SUID doesn't work on scripts on decent OSes.

>Security isn't the main concern here since the servers are internal.  I
>understand that it's possible using RSA and CGI that the security could
>be compromised.

So you have a limited list of servers, you can collect their host keys
into /etc/ssh_known_hosts. So scp will stop complain.

Note that scp will prompt for a password unless you use some other
mechanism (e.g. a file /etc/shosts.equiv).

Read the man pages for ssh(1) and sshd(8). Understand them, and try to
figure out the better sshd configuration for your problem.

-- 
Rafael Garcia-Suarez


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

Date: Thu, 22 Jun 2000 01:24:39 GMT
From: Matthew O. Persico <persicom@acedsl.com>
Subject: Re: perl reference challenge:
Message-Id: <8irpsb$40q$1@nnrp1.deja.com>

In article <8irhhu$u79$1@nnrp1.deja.com>,
  mark_f_edwards@my-deja.com wrote:
> hello all -
>
> the following reference works from, from the www.perl.com webpage:
>
> perl -e  ' $ref = \"howdy";   print $$ref;   '
> howdy
>
> and so does the following example:
>
> perl -e  ' @x = (1,2,3,4) ; $i=\@x ; print $i->[1] ; '
> 2
>
> so can anyone please tell me why the following gives no output:
>
> perl -e  ' $i=\@{(1,2,3,4)} ; print $i->[1] ; '

Try this first:

perl -we  'use strict; my $i=\@{(1,2,3,4)} ; print $i->[1] ; '

and see what kind of errors spew out. Lookup the -w flag and 'use
strict' in the docs to see what they do.

Then read this :-)

What you have tried to do is take a list (), cast it to a list with @{}
and take the reference of the what you finally get. But you can't cast a
list to a list: that's nonsense. In true PerlSpeak, you tried to
dereference with @{} something that was not a reference, ie, the list.

You cannot dereference a list. You can deref an array and a hash.

"Ah", you say, "but I thought a list was an array?"

No it is not. And I'll prove it.

This is a list: ( 1,2,3,4)

This is an array : @x

This is a hash: %y.

I can copy the list to the array: @x = (1,2,3,4).

I can initialize the hash: %y = ( 1=> 2, 3=> 4).

But that => is the same as a comma. So I can also so this:

%y = ( 1,2,3,4).

So if (1,2,3,4) is an array, it's also a hash. Since it cannot be both,
it is neither. It is a list. Period.

A list is not a 'variable' like scalar ($), array (@), hash(%), typeglob
(*). It has no location (or address) that you can get at. Therefore, you
cannot take a ref.

Hope that makes things clearer.

--
Matthew O. Persico
'user' is a four-letter word.

--
Matthew O. Persico
'user' is a four-letter word.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 22 Jun 2000 02:06:56 GMT
From: Jeff Helman <jhelman@wsb.com>
Subject: Re: Perl use DBI memory error
Message-Id: <3951751C.2C3EF76B@wsb.com>

Tom Phoenix wrote:
> 
> On Wed, 21 Jun 2000 christykelly@my-deja.com wrote:
> 
> > i am getting a fatal memory error. I know this is
> > really stupid, but i am running out of ideas on
> > what is wrong.
> 
> Almost certainly, either the module or your perl installation is messed
> up. If that's not it, it's either your OS or - surprise! - your memory.
> You may need to have your hardware checked or improved. But I'd start with
> reinstalling the module, and go on from there.

I second everything that Tom wrote.  You also might want to check you
ODBC installation to make sure it isn't the problem.  One other idea
would be to use the Win32::ODBC module (comes standard in 5.6 and
possibly earlier).  Oh, and while I think of it...are you running
Activestate 5.6?  And if so, did you first do an uninstall of your
previous perl version?  For some unknown reason (though possibly having
to do with Activestate's relationship with Microsoft :) ), Activestate
5.6 does not install cleanly over a previous version and that leads to
all sorts of chaos.  Worst case, backup your C:\Perl directory somewhere
and then erase it.  Then do a clean install of Perl and see if this
fixes the problem.

Hope this helps.
JH


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

Date: Thu, 22 Jun 2000 01:44:17 GMT
From: aphiny6592@my-deja.com
Subject: Problem installing CPAN Date::Calc
Message-Id: <8irr1f$4p7$1@nnrp1.deja.com>

When I input the first command "perl makefile.pl" to generate the
makefile.  I get the following errors:

Bad command or file name
Bad command or file name
Bad command or file name
Unable to find a perl 5 (by these names: C:\Perl\bin\Perl.exe miniperl
perl perl5 perl5.6.0, in these dirs: C:\PERL\BIN C:\PERL\BIN
C:\MATLAB\BIN C:\WINDOWS C:\WINDOWS C:\WINDOWS\COMMAND C:\Perl\bin)
Writing Makefile for Date::Calc

I am running Windows 98.
I have tested the module with my perl build on Solaris and it works
with no problems.

I have no idea what the problem is.  Any suggestions?

Thanks,
Yin


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 21 Jun 2000 19:18:28 -0700
From: Bob <blumbjNOblSPAM@hotmail.com.invalid>
Subject: Re: Programming Question
Message-Id: <15a1f77b.58fcd959@usw-ex0102-016.remarq.com>

Hi,

I'm the guy that sent the original question.  The code in the
form_processor.pl file that seems to write to the HTML file is
as follows:

sub write_form_info	{
open (FORM, ">>$form_info_path") || die ("I am sorry, but I was
unable to open the file $form_info_path");
foreach $sortedkeys (@sortedkeys)	{
$sortedkeys =~ s/^\d*\)\s*//;
$sortedkeys =~ s/required-//;
($name, $answer) = split (/\|/, $sortedkeys);
print FORM "$name -- $answer\n";
}
print FORM "\n";
close (FORM);
}


I'm not sure what to change to get the format I described in my
original message.  The form I am submitting to the
form_processor.pl file is as follows:

<form method="post" action="/cgi-bin/form_processor.pl">
              <blockquote>

<input type="hidden" name="admin" value="BobBlum@mail.com">
<input type="hidden"
name="subject" value="E-Mail Addresses of Study Group">
<input type="hidden" name="redirect" value="http://blum-
bob.tripod.com/cgi-bin/emaillist.html">

			 <p align="left"> <b>Enter your name</b>
(e.g., John Doe): </p>
                <p align="left">
                  <input type="text" name="01)name"
maxlength="40" size="40">
                </p>
                <p align="left"><b>Enter your e-mail address</b>
(e.g., jdoe@hotmail.com):</p>
                <p align="left">
                  <input type="text" name="02)email" size="40"
maxlength="40">
                </p>

Would really appreciate it if someone could tell me how to
modify this to get the output I want:

name -- Joe Smith
email -- smithj@somewhere.com

name -- Dave Jones
email -- djones@somewhere.com

         Many thanks,
            Bob


Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



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

Date: Thu, 22 Jun 2000 09:58:46 +1000
From: "Phil Sutcliffe" <ils@gil.com.au>
Subject: Re: simple array question
Message-Id: <3951673b_1@news.bne.gil.com.au>

"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:395697fb.5517985@news.skynet.be...
> You can put them in a hash.
>
> @data{@names} = @fields;
>

What if I need to put the elements back into @fields at some stage in strict
order?

I know you can still do this with a hash, but it's not as easy is it?

Phil.




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

Date: Thu, 22 Jun 2000 10:15:45 +1000
From: "Phil Sutcliffe" <ils@gil.com.au>
Subject: Re: simple array question
Message-Id: <3951673c_1@news.bne.gil.com.au>

"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:39559603.5014377@news.skynet.be...
> Programmers insisting so hard on using symrefs, like you do, ought to be
> fired, IMO. Honestly.

That's a bit harsh! At no stage have I "insisted on using symrefs", rather I
suggested that perhaps this could be done using symrefs.

I have "insisted" on finding a method of doing this without using a hash. Is
that such a crime?

"Phil Sutcliffe" <ils@gil.com.au> wrote in message
news:394d7274_1@news.bne.gil.com.au...
> Do you have any other suggestions?

Phil.




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

Date: Thu, 22 Jun 2000 10:33:21 +1000
From: "Phil Sutcliffe" <ils@gil.com.au>
Subject: Re: simple array question
Message-Id: <3951673d_1@news.bne.gil.com.au>


"Tad McClellan" <tadmc@metronet.com> wrote in message
news:slrn8l17df.r6.tadmc@maxim.metronet.com...
> You had already been told about how "Symbolic references" are
> bad, and given a way of doing it without them.
>
> But you were back insisting that we tell you how to use them.

When exactly did I "insist" on anyone telling me how to use symrefs. If I
insisted on anything, it was knowing how to do this without using a hash.

>But if the drunk knows where the keys are (in the "Symbolic
>references" section in perlref.pod) he can go get the keys
>himself and drive away anyway.

I had no idea there were "PERL Police" and that Tad was the chief (tongue
firmly placed in cheek). I still fail to see why this concerns you so much.
I know how to light a match too, but that doesn't mean I'm going to burn
down your house.

>
> { local $" = ',';
>    eval "(@names) = (@fields)";
> }

Thanks, but I had already figured this out and posted it a couple of days
ago (not quite so eloquently though).

I apologise for the earlier over-reaction.

Phil.




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

Date: Thu, 22 Jun 2000 01:43:24 GMT
From: Jeff Helman <jhelman@wsb.com>
Subject: Re: using cgi.pm for radio buttons
Message-Id: <39516F98.7E23B86D@wsb.com>

"D.W." wrote:
> 
> I've been trying to get the radio_group to work but it seems like my perl
> script is just completely ignoring it.  Here is exactly what I have:
> 
>         print radio_group(-name=>"DRIVER",
>                 -values=>["S", "T"],
>                 -default=>$driver,
>                 -labels{"S"=>"Solo", "T"=>"Team"});
> 
> Would someone tell me what I'm doing wrong with this?
> 
> Douglas

Certainly.  The radio_group method is looking for a hash to be passed to
it.  The last element:

-labels{"S"=>"Solo", "T"=>"Team"}

is not a key/value pair.  Put an arrow pointer in as follows:

-labels => {"S"=>"Solo", "T"=>"Team"}

And things will compile just fine.  Hope this helps.

JH


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

Date: Thu, 22 Jun 2000 02:29:35 GMT
From: Jeff Helman <jhelman@wsb.com>
Subject: Re: Where is @INC in ActiveState Perl for Win32 ???????
Message-Id: <39517A63.426AC9DE@wsb.com>

Nick Palmer wrote:
> 
> Nobody seems to know the answer to this question.

I do.  Open up a registry editor (regedit or regedt32).  Go to the Local
Machine structure.  Go to software and add the key "Perl".  Then, in the
"Perl" key, add a "lib" REG_SZ value that points to whatever directory
you want.  I use this on all of my servers to keep my modules separate
from the standard distribution.  Specifically, I have "lib" defined as
"c:/perl/wlib" on my servers.

Hope this helps.
JH
 
> I've had lots of "It's in the registry somewhere....", "I think it's....",
> but nobody knows!!!
> 
> One suggestion was that it was in the file "Perl\lib\Config.pm"
> 
> BUT:
> 
> If you delete the file altogether then Perl still knows  information where
> the debugger is (in the registry) and still knows about @INC (not in the
> registry)
> E.g. if I try to debug a program (with Config.pm deleted) I get this
> message:
> 
> -----
> 
> perl -d myprog.pl
> 
> Can't locate Config.pm in @INC (@INC contains: c:\progra~1\perl\lib
> C:/Program Files/Perl/lib C:/Program Files/Perl/site/lib .) at
> C:\PROGRA~1\ACTIVE~1\PerlDB.pl line 84.
> 
> BEGIN failed--compilation aborted.
> 
> -----
> 
> So it still keeps it's original values in @INC.
> 
> Incidentally, the entry in @INC reported above, i.e. "c:\progra~1\perl\lib"
> has been added by putting a value in the Registry
> 
> key HKEY_LOCAL_MACHINE\Software\Perl with the name "PERL5LIB" and value
> "c:\progra~1\perl\lib"
> 
> Come on, someone must know!
> 
> Yours Sincerely
> 
> Nick


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

Date: Thu, 22 Jun 2000 01:52:39 GMT
From: Jeff Helman <jhelman@wsb.com>
Subject: Re: Why cant a cgi and module use the same library?
Message-Id: <395171C3.32834DD3@wsb.com>

glchy wrote:
> 
> Hi,

Welcome.

> im baffled! Ive noticed thru testing that a library cannot (!)
> be called by both a cgi and module if the module is being called
> by the cgi.

That's because when you run your CGI, the subroutines and global
variable declarations and all other assorted goodies that are included
in lib.pl are imported into the current namespace, in this case, that of
"mod" (see the documentation about the differences between "use" and
"require").  When the compiler gets to the second require statement (in
A.cgi), it skips it since that file has already been loaded.

> A.cgi use mod.pm. Both A.cgi and mod.pm require lib.pl. But if
> lib.pl is converted into lib.pm, then thers no problem!
> 
> A.cgi
> =====
> use mod;
> require ("lib.pl");
> &subroutine_lib;
> 
> mod.pm
> ======
> package mod;
> require ("lib.pl");
> use strict;
> use vars qw(
> @ISA
> @EXPORT
> );
> @ISA = qw(Exporter);
> @EXPORT = qw(&subroutine_mod);
> &subroutine_lib;
> &subroutine_mod;
> sub subroutine_mod {
>   print "In subroutine_mod\n";
> }
> 1;
> 
> #perl A.cgi
> In subroutine_lib
> In subroutine_mod
> Undefined subroutine &main::subroutine_lib called at a.cgi line
> 5.
> 
> My situation is that some subroutines in a library are used in
> cgis while at the same time modules called by those cgis could
> be using the same or different subroutines in the same library
> file. Converting the libraries into modules is not an option
> however.

Really?  I know that a good bit of work might be required, but
modularizing most code will pay dividends later on.

> Any way out??

Use explicit package references in lib.pl.  For example:

sub Foo {          becomes
sub main::Foo {    and

$SomeVar = "Whatever";          becomes
$main::SomeVar = "Whatever";

Unfortunately, then you must make sure that any references to these
variables and/or subroutines that are called from outside the main
package explicitly specify main. (Thus &Foo() becomes &main::Foo() ). 
The amount of coding this might require may make you take a second look
at turning lib.pl into a nice clean module.

Hope this helps,
JH


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

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

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 3449
**************************************


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