[13391] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 803 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 15 12:17:21 1999

Date: Wed, 15 Sep 1999 09:15:37 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 15 Sep 1999     Volume: 9 Number: 803

Today's topics:
        How to validate a URL? <couton@bigfoot.com>
    Re: How to validate a URL? <Mark@Mark.Com>
        IIS 3.0 - CGI - @INC - problem finding libraries <wessie@xs4all.nl>
    Re: IIS 3.0 - CGI - @INC - problem finding libraries (Kragen Sitaker)
    Re: IIS 3.0 - CGI - @INC - problem finding libraries <wessie@xs4all.nl>
    Re: is this object a child of this class? <rootbeer@redcat.com>
        lwp-mirror jajacek@my-deja.com
        message passing in socket comm. <matilda@crt.se>
    Re: message passing in socket comm. (Kragen Sitaker)
    Re: NDBM_File problem. (Joseph A. DiVerdi)
    Re: Newbe question on Substitution <wih@ncgr.org>
    Re: output of backticks <yunus000@england.com>
    Re: output of backticks (Anno Siegel)
        Parsing Tab Delimited File brian_fredette@vnet.ibm.com
    Re: Parsing Tab Delimited File (Larry Rosler)
    Re: Parsing Tab Delimited File <rootbeer@redcat.com>
        passing array to xsub as char ** <xaa+news_comp.lang.perl.misc@hellyeah.xaa.iae.nl>
    Re: passing array to xsub as char ** (Arved Sandstrom)
        perl Ad <One.Bored.Guru........@p0.f1.n30.z30.fidonet.org>
        Perl Apache Win95 <tokaev@triniti.troitsk.ru>
    Re: Perl Apache Win95 <gellyfish@gellyfish.com>
    Re: Perl build on SCO Openserver 5.0.5 <gellyfish@gellyfish.com>
    Re: Perl Y2k (Bart Lateur)
    Re: Perl Y2k (Chris Nandor)
    Re: PLEASE HELP! - Symbolic References makau@multimania.com
    Re: PLEASE HELP! - Symbolic References (Kragen Sitaker)
        Problems with PUSHi() in XS code <dhd@eradicator.dhis.org>
        Procedure result inheritance <krajzewicz@inx.de>
    Re: Question with 'require' and 'import' <rick.delaney@home.com>
    Re: rand questions (Ron Grunwald-Computer Programmer PGS Tensor Perth)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Wed, 15 Sep 1999 15:04:33 +0100
From: "Paul Carter" <couton@bigfoot.com>
Subject: How to validate a URL?
Message-Id: <xMND3.25$68.352@news2-hme0>

Hi,

I am a newbie to PERL, and have been writing a few scripts.
I have now come across a problem!

I found out that to validate an e-mail address I can use
    if ($user_email =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(,)/ ) { #invalid
character entered }

But, I am not 100% sure what it is doing
So, can somebody please point me in the direction of "=~" and "!~"????

The main problem is that I am unable to validate a URL
As far as I can see, the requirements for a WWW URL would be a "http://" and
a "." (period)

Thanks in Advance

Paul Carter

webmaster @ http://www.thefreewww.com




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

Date: Wed, 15 Sep 1999 16:53:22 +0100
From: Mark <Mark@Mark.Com>
Subject: Re: How to validate a URL?
Message-Id: <37DFC0F1.53FAA564@Mark.Com>



Paul Carter wrote:

> Hi,
>
> I am a newbie to PERL, and have been writing a few scripts.
> I have now come across a problem!
>
> I found out that to validate an e-mail address I can use
>     if ($user_email =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(,)/ ) { #invalid
> character entered }
>
> But, I am not 100% sure what it is doing

What it is is a series of alternative RE's. The logic is that the email must
match none of them if it is OK.
(@.*@)    - @ followed by any num of any chars followed by @ =>
fred@jim@bill.com
(\.\.)        - Two periods => fred@bill..com
(@\.)        @ followed by . => fred@.bill.com

etc, etc

Not sure how good it is tho'

    @ is OK
    .    is OK
    @f.    is OK




>
> So, can somebody please point me in the direction of "=~" and "!~"????
>
> The main problem is that I am unable to validate a URL
> As far as I can see, the requirements for a WWW URL would be a "http://" and
> a "." (period)

No. There is a lot more to URL's. For a start they can have lots of different
schemes http:, ftp:, etc). Next, they don't have to have a period. http://fred
is perfectly valid.

What you need is RFC 1738 and 1808 (http://cie.motor.ru/RFC/1738/
http://cie.motor.ru/RFC/1808) give you a good start.

Your best bet is to split the URL up into its parts. The RFC's will tell you
what those parts ae. Look for the URL BNF .

You should do the same for the email , Don't know what the SMTP syntax is.

Hope this helps,

Mark

>
>
> Thanks in Advance
>
> Paul Carter
>
> webmaster @ http://www.thefreewww.com



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

Date: Wed, 15 Sep 1999 14:21:58 +0200
From: "Wessel van Alphen" <wessie@xs4all.nl>
Subject: IIS 3.0 - CGI - @INC - problem finding libraries
Message-Id: <7ro33d$e4e$1@news1.xs4all.nl>

Beginners question :

At first, I builded an intranet on a winnt client with apache webserver,
using Perl 5.0 for CGI scripts and everything worked fine.
These scripts are freeware scripts, modified to my needs.
I have very little Perl-experience.

Now I'v installed the whole thing on our companies server and
I have to use Winnt IIS server (3.0).
Whenever I try to execute a script, I get the message that
my own libraries can't be found in the @INC path, even if I
use the absolute pathname, e.g. http//pathname/faq.pl.
@INC only contains the paths that were created during
the installation of Perl. (d:/perl/lib and d:/perl).
Where is @INC build and how do I append my own directories to @INC ?
(And why did it worked fine on my on p.c.?)

Thanks,

    Wessel.





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

Date: Wed, 15 Sep 1999 13:48:02 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: IIS 3.0 - CGI - @INC - problem finding libraries
Message-Id: <msND3.12460$N77.926835@typ11.nn.bcandid.com>

In article <7ro33d$e4e$1@news1.xs4all.nl>,
Wessel van Alphen <wessie@xs4all.nl> wrote:
>Whenever I try to execute a script, I get the message that
>my own libraries can't be found in the @INC path, even if I
>use the absolute pathname, e.g. http//pathname/faq.pl.

If it begins with http:, it's not an absolute pathname -- it's a URL.
d:/wessel/lib/faq.pl is an absolute pathname.

>@INC only contains the paths that were created during
>the installation of Perl. (d:/perl/lib and d:/perl).
>Where is @INC build and how do I append my own directories to @INC ?

@INC is set up during the Perl build.  You can append your own
directories to it with use lib $dirname; if you like.

>(And why did it worked fine on my on p.c.?)

Maybe @INC included your library directory there?  perl -V will tell you.

Kragen
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Sep 14 1999
55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Wed, 15 Sep 1999 16:54:06 +0200
From: "Wessel van Alphen" <wessie@xs4all.nl>
Subject: Re: IIS 3.0 - CGI - @INC - problem finding libraries
Message-Id: <7rocrj$mtg$1@news1.xs4all.nl>

<<SNIP>>

>>(And why did it worked fine on my on p.c.?)
>
>Maybe @INC included your library directory there?  perl -V will tell you.
>
>Kragen

Actually, when I do a 'perl -V' on both my p.c. and
the server, @INC only contains pathnames to
the perl-directories created during installation,
so I'm starting to believe it has something to
do with the combination Perl and IIS, but what ?

    Wessel.




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

Date: Wed, 15 Sep 1999 05:50:43 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: is this object a child of this class?
Message-Id: <Pine.GSO.4.10.9909150548350.25903-100000@user2.teleport.com>

On Tue, 14 Sep 1999 mike@yawp.com wrote:

> 	sub isa {

Not only unnecessary....

> 		my $self = shift;
> 		my $type = shift;
> 
> 		my $isa  = (grep {/$type/} @ISA) ? 1 : 0;

 ...but also incorrect! Unless you think Tonya ISA Tony....

> 		return ($isa);
> 	}

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 15 Sep 1999 13:57:40 GMT
From: jajacek@my-deja.com
Subject: lwp-mirror
Message-Id: <7ro8kd$e0f$1@nnrp1.deja.com>

Wenn I use lwp-mirror  with option -t (timeout) I get error.

#>lwp-mirror -t 10s http://www.somewhere.com file.html

Can't call method "timeout" on an undefined value at
/usr/bin/lwp-mirror  line 86.

Anybody knows why?

I have libwww-perl version 5.44.

Jacek


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 15 Sep 1999 11:59:23 +0200
From: Matilda Dahlqvist <matilda@crt.se>
Subject: message passing in socket comm.
Message-Id: <Pine.GSO.4.10.9909151155140.11298-100000@spitfire.crt.se>

I want to do a server-client communication and I am using 

send SOCKET, MSG, FLAGS

in order to send messages from the client to the server.

What do I need to do if I want to declare the length of the message, for
example 40 bytes? The message might only be "hello" but I still want it to
be 40 bytes long



	Matilda

Don't criticize a man until you've walked a mile in his shoes, 
that way when you criticize him you're a mile away
and have his shoes. 



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

Date: Wed, 15 Sep 1999 13:40:41 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: message passing in socket comm.
Message-Id: <tlND3.12446$N77.925281@typ11.nn.bcandid.com>

In article <Pine.GSO.4.10.9909151155140.11298-100000@spitfire.crt.se>,
Matilda Dahlqvist  <matilda@crt.se> wrote:
>What do I need to do if I want to declare the length of the message, for
>example 40 bytes? The message might only be "hello" but I still want it to
>be 40 bytes long

"hello" is only 5 bytes long.  To make it 40 bytes long, you need to
add 35 more bytes to it.  What those bytes should be is up to you; the
protocol you're trying to implement may specify.  If it were up to me,
I'd allow variable-length packets :)

So you can do:
my $len = length $msg;
if ($len > 40) {
	die "bloody message too long <$msg>";
} else {
	$msg .= "\0" x (40 - $len);
}

Kragen
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Sep 14 1999
55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Wed, 15 Sep 1999 00:19:38 -0600
From: diverdi@XTRsystems.com (Joseph A. DiVerdi)
Subject: Re: NDBM_File problem.
Message-Id: <diverdi-1509990019380001@lulu.xtrsystems.com>

In article <Pine.OSF.4.05.9909142053350.13794-100000@mail.med.upenn.edu>, Nico Zigouras <zigouras@mail.med.upenn.edu> wrote:

>Hi:
>
>I have some databases that need NDBM_File module to access them but the
>version of Perl that came with RH Linux 6.0 doesn't seem to have it or let
>my CGI access it.
>I am trying to install a new Perl but getting errors when trying to load
>NDBM_File.
>
>Has anyone had problems with this module and have any suggestions?
>
>Thanks in advance, please also respond to my email.

I hav experienced the same problem with v6.0 in accessing NDBM files.

I use DBM authentication with an Apache web server and also use the data contained in the password files (in NDBM format) for other operations. Prior to my ISP's upgrading to v6.0 the scripts operated correctly. After the update, the scripts fail indicating that the NDBM file that is being accessed "doesn't exist".

My ISP's sys admin is currently looking into the problem, has verified it, but cannot explain the change in support. I believe that the immediate explanation is that NDBM was removed because of conflicts in namespace with SQL support.

Interestingly, your note is the first other report of this problem that I have read. I am surprised that others have not experienced it also.

Best regards,
Joseph

-- 
Joseph A. DiVerdi, Ph.D.                     
<diverdi@XTRsystems.com>                    970.221.3982 (voice)
<http://www.XTRsystems.com>                 970.224.3723 (fax)


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

Date: Wed, 15 Sep 1999 09:33:44 -0600
From: Wen Huang <wih@ncgr.org>
Subject: Re: Newbe question on Substitution
Message-Id: <37DFBC57.A74E0002@ncgr.org>

oops! I totally misread your question.  Too little sleep can do that =)  Sorry
about that...

Martien Verbruggen wrote:

> In article <37DED5CE.AED570DC@ncgr.org>,
>         wih <wih@ncgr.org> writes:
> > Mike wrote:
> >
> >>    $test = "Test string with path= c:\\path\\sub1\\sub2\\file.exe";
> >>    $lookfor = "c:\\path\\sub1\\sub2";
> >>    $subwith = "c:\\testpath";
> >>
> >>    $test=~s/$lookfor/$subwith/;
> >>
> >>    print $test;
> >>
> >> which outputs: Test string with path= c:\path\sub1\sub2\file.exe
> >
> > It's substituting just fine.
>
> No, it's actually not. It's not substituting anything, because it
> can't match anything.
>
> > In your case, when you print out the string contained in $test.  The
> > interpreter actually sees the string $test as: Test string with path=
> > c:\\path\\sub1\\sub2\\file.exe
>
> You are correctly identifying that the problem lies with the
> backwhacks, but you seem to be misunderstanding why and where.
>
> After the assignment to $test, $test actually contains
>
> Test string with path= c:\path\sub1\sub2\file.exe
>
> (which, incidentally, is exactly what print will spit out)
>
> The double backwhacks have been replaced by singles because of the
> double quotes. That's why they had to be double in the first place.
>
> The same goes for $lookfor and $subwith.
>
> If the original code had used single quotes, there would not have been
> a need for doubling of backwhacks at all.
>
> > with the correct number of backslashes.  BUT since you've fed the $test to a
> > print statement, it will interpret the \\ to mean print a single \ ...
>
> Again: wrong. print does not do anything with backwhacks. Double
> quotes and double-quotish operators do. And so do regular expressions.
> And that is where the problem lies. Not in the print statement.
>
> # perldoc perlop
> # perldoc perlre
> # perldoc -f print
>
> Martien
> --
> Martien Verbruggen                  |
> Interactive Media Division          | Think of the average person. Half of
> Commercial Dynamics Pty. Ltd.       | the people out there are dumber.
> NSW, Australia                      |



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

Date: Wed, 15 Sep 1999 10:08:04 +0100
From: Y <yunus000@england.com>
Subject: Re: output of backticks
Message-Id: <37DF61F4.D4589DAC@england.com>

Abigail wrote:
> 
> Uri Guttman (uri@sysarch.com) wrote on MMCCV September MCMXCIII in
> <URL:news:x7906akyab.fsf@home.sysarch.com>:
> ;; >>>>> "A" == Abigail  <abigail@delanet.com> writes:
> ;;
> ;;   A> Since my knowledge of Perl internals is less than my knowledge of
> ;;   A> the sexlive of antartic sparrows, there are other ways to get the
> ;;   A> knowledge to do such tricks.
> ;;
> ;; so what is the mean carrying weight for a horny antarctic sparrow?
> 
> During winter or summer?
> 

Sounds like a snippet from Monty Python to me.

African or European?


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

Date: 15 Sep 1999 12:12:25 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: output of backticks
Message-Id: <7ro2f9$i9c$1@lublin.zrz.tu-berlin.de>

Abigail <abigail@delanet.com> wrote in comp.lang.perl.misc:
>David Cassell (cassell@mail.cor.epa.gov) wrote on MMCCIV September
>MCMXCIII in <URL:news:37DD86B9.3C58666B@mail.cor.epa.gov>:

[perl -lne '$x++ if !/^\s*$/;}{print $x' netlog.txt]

>// This is a cute trick I learned by studying the nefarious works
>// of Abigail.  Note that I *should* have learned it by studying
>// the Perl internals, but...
>
>
>Since my knowledge of Perl internals is less than my knowledge of
>the sexlive of antartic sparrows, there are other ways to get the
>knowledge to do such tricks.
>
>TPJ comes in mind.

Or even a creative reading of perldoc perlrun:

       -n   causes Perl to assume the following loop around your
            script, which makes it iterate over filename
            arguments somewhat like sed -n or awk:

                while (<>) {
                    ...             # your script goes here
                }

Anno


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

Date: Wed, 15 Sep 1999 13:46:10 GMT
From: brian_fredette@vnet.ibm.com
Subject: Parsing Tab Delimited File
Message-Id: <7ro7uu$dge$1@nnrp1.deja.com>

Greetings all.

I'm having some trouble finding information on how to parse a tab
delimited text file.  Any pointers would be appreciated.

Thanks,
Brian


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 15 Sep 1999 07:33:05 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Parsing Tab Delimited File
Message-Id: <MPG.12494dfc88c6a909989f69@nntp.hpl.hp.com>

In article <7ro7uu$dge$1@nnrp1.deja.com> on Wed, 15 Sep 1999 13:46:10 
GMT, brian_fredette@vnet.ibm.com <brian_fredette@vnet.ibm.com> says...
> I'm having some trouble finding information on how to parse a tab
> delimited text file.  Any pointers would be appreciated.

Assuming you mean a tab-separated text file, you might simply want to 
chomp the newlines and split on tabs.

perldoc -f split

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 15 Sep 1999 07:49:34 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Parsing Tab Delimited File
Message-Id: <Pine.GSO.4.10.9909150749030.25903-100000@user2.teleport.com>

On Wed, 15 Sep 1999 brian_fredette@vnet.ibm.com wrote:

> I'm having some trouble finding information on how to parse a tab
> delimited text file.  Any pointers would be appreciated.

Check out the entry for split in the perlfunc manpage. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 15 Sep 1999 08:30:09 GMT
From: Mark Huizer <xaa+news_comp.lang.perl.misc@hellyeah.xaa.iae.nl>
Subject: passing array to xsub as char **
Message-Id: <slrn7tum8g.u8q.xaa@esmeralda.xaa.iae.nl>

Hi, I checked the docs and the faqs at CPAN, but still can't find a
solution to this (small?) problem.

I have a sub with prototype ($@), which I would like to change in a C
procedure with prototype (char *, char **), but I can't make it work.

So I have a

int
myproc(par1,par2)
	char *	par1
	char **	par2
OUTPUT:
	RETVAL

which when called complains about the usage being myproc(par1,par2) (and
the C code is looking for ST(1) as an SV, not an AV.

Does anyone have a link, a working piece of code or some other hint for
me?

Thanks

Mark Huizer


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

Date: Wed, 15 Sep 1999 07:06:55 -0300
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: passing array to xsub as char **
Message-Id: <Arved_37-1509990706550001@dyip-11.chebucto.ns.ca>

In article <slrn7tum8g.u8q.xaa@esmeralda.xaa.iae.nl>, Mark Huizer
<xaa+news_comp.lang.perl.misc@hellyeah.xaa.iae.nl> wrote:

> Hi, I checked the docs and the faqs at CPAN, but still can't find a
> solution to this (small?) problem.
> 
> I have a sub with prototype ($@), which I would like to change in a C
> procedure with prototype (char *, char **), but I can't make it work.
> 
Check the CPAN again for author ID Dean_Roehrich. His XS Cookbooks include
an example or two on handling char **.

Arved Sandstrom


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

Date: Wed, 15 Sep 1999 00:02:31
From: "One Bored Guru        " <One.Bored.Guru........@p0.f1.n30.z30.fidonet.org>
Subject: perl Ad
Message-Id: <00002fe3@madnet.net>

Attention Perl-5/Linux Programmers.

The Sync3 Developement Team is looking for Perl-5/Linux programmers
to help on an open source project writing a new type of bbs designed
for Linux and The Internet.  If you think you have the skill and are
interested, please send email to devteam[at]sync3.com indicating your
interest and providing us with the relevant details pertaining to
your skill level and previous experience.  Thank you for your time
and interest.

     Steve Byers,
     Project Administrator,
     The Sync3 Project.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        + The Talamasca Internet Newsgroup Gateway +
               telnet://talamasca-bbs.com


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

Date: Wed, 15 Sep 1999 13:18:53 +0400
From: tokaev <tokaev@triniti.troitsk.ru>
Subject: Perl Apache Win95
Message-Id: <37DF647D.D7FD24E1@triniti.troitsk.ru>

I need perl for win98 under Apache.



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

Date: 15 Sep 1999 10:37:23 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl Apache Win95
Message-Id: <37df68d3_1@newsread3.dircon.co.uk>

tokaev <tokaev@triniti.troitsk.ru> wrote:
> I need perl for win98 under Apache.
> 

<http://www.activestate.com/activeperl>  

The documentation that is installed on your start menu will explain
how to use Perl with various HTTP servers - how as this is a matter of
server configuration rather than about Perl itself you will be better off
asking comp.infosystems.www.servers.ms-windows if you have any difficulty
getting it to work.

/J\
-- 
"People say money brings its own problems. Rubbish, rubbish - I'm loaded -
it's fantastic" -


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

Date: 15 Sep 1999 15:34:38 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl build on SCO Openserver 5.0.5
Message-Id: <37dfae7e_1@newsread3.dircon.co.uk>

<CC sent to cited author>

hops <hops@sco.com> wrote:
> In article <37d8fff4_2@newsread3.dircon.co.uk> Jonathan Stowe <gellyfish@gellyfish.com> writes:
> 
> Initially I had similar problems tho with DB_File rather than SDBM_File.
> 
>     test fails DB_File cannot resolve fsync
>     works ok if add -lc when build DB_File.so
>         ( explicitly chg ext/DB_File/Makefile.PL 
>             my $LIB = "-ldb" ;          ->   my $LIB = "-ldb -lc" ;
>         ditto Makefile

Mike thanks,

I tried this out and unfortunately it didnt work and then there was I
nosing around on the SCO ftp site when I find:

Support Level Supplement (SLS) OSS499A, the ELF Linker Patch for SCO OpenServer
5.0.5 and Release Supplement 505A, fixes a problem in the ELF linker supplied
by Release Supplement 505A where "relocations remaining" errors were seen at 
compile-time or at run-time. 

And of course I had installed Release Supplement 505A.

This patch can be found at:

   <ftp://ftp.sco.com/SLS/oss499a>

and the instructions are:

   <ftp://ftp.sco.com/SLS/oss499a.ltr>

And now:

All tests successful.
u=0.33  s=0.24  cu=20.08  cs=5.98  scripts=183  tests=6486

Weee.

/J\
-- 
"You don't watch the Eurovision Song Contest to hear good music" -
Katrina Leskanich, Katrina and the Waves


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

Date: Wed, 15 Sep 1999 07:33:29 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl Y2k
Message-Id: <37e24735.2716425@news.skynet.be>

Chris Nandor wrote:

>You would rather waste 5 seconds of the thousands of people who read this
>newsgroup instead of taking a few minutes yourself to look up the answer
>in the readily available documentation.

<Yawn> here we go again. Hey people! Do we HAVE to have these
degenerated threads three times a day?

(p.s. Nothing personal, Chris.)

-- 
	Bart.


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

Date: Wed, 15 Sep 1999 12:43:19 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Perl Y2k
Message-Id: <pudge-1509990843230001@192.168.0.77>

In article <37e24735.2716425@news.skynet.be>, bart.lateur@skynet.be (Bart
Lateur) wrote:

# Chris Nandor wrote:
# 
# >You would rather waste 5 seconds of the thousands of people who read this
# >newsgroup instead of taking a few minutes yourself to look up the answer
# >in the readily available documentation.
# 
# <Yawn> here we go again. Hey people! Do we HAVE to have these
# degenerated threads three times a day?

Well, if we save just a few lost souls, it is worth it.

# (p.s. Nothing personal, Chris.)

:)

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: Wed, 15 Sep 1999 09:40:12 GMT
From: makau@multimania.com
Subject: Re: PLEASE HELP! - Symbolic References
Message-Id: <7rnphr$3ik$1@nnrp1.deja.com>

In article <7rm0d5$2sf$1@birch.prod.itd.earthlink.net>,
  "Zach Thompson" <cublai@earthlink.net> wrote:
> The first line of the error message says it all.  Remove the "my" in
front
> of ${$key}.   Symbolic refs access the symbol table and lexical
variables
> are not stored there.

I have already tried this so many times....
Removing the 'my' doesn't solve the problem.
The first error message disappears by the others remain!

Thanks anyways for trying to help.

Have a nice day.

Makau.


> > The actual code is a lot more complicated but to summarize, here's
what
> > I want to do :
> >
> > ---------------------------------
> > #!/usr/local/bin/perl -w
> >
> > use strict;
> >
> > my $key;
> > my %hash = (
> >         hello => 'world',
> >         perl  => 'rOckz',
> > );
> > foreach $key (keys %hash) {
> >         my ${$key} = $hash{$key};
> > };
> >
> > print "The $hello $perl !";
> > ---------------------------------
> >
> > but the Perl interpreter prints out :
> >
> > ---------------------------------
> > Can't declare scalar deref in my at ./a.pl line 11, near "} ="
> > Global symbol "$hello" requires explicit package name at ./a.pl line
14.
> > Global symbol "$perl" requires explicit package name at ./a.pl line
14.
> > Execution of ./a.pl aborted due to compilation errors.
> > ---------------------------------
> >
> > Without the 'strict' subs, it works just fine.
> > But the problem is I do NOT want to remove it (since some warnings
are
> > not displayed otherwise)!
> >
> > And YES, I want to get $$key and not a hash.
> > I have my reason.
> >
> > Is there a work-around, or can't Perl handle this when 'use strict'
is
> > mentionned?
> >
> > Please help...
> > I'm desperate!
> >
> > Makau.
> >
> > makau@multimania.com
> >


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Wed, 15 Sep 1999 15:59:59 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: PLEASE HELP! - Symbolic References
Message-Id: <3oPD3.12650$N77.938851@typ11.nn.bcandid.com>

In article <7rnphr$3ik$1@nnrp1.deja.com>,  <makau@multimania.com> wrote:
>I have already tried this so many times....
>Removing the 'my' doesn't solve the problem.
>The first error message disappears by the others remain!

You can get rid of the others with use vars, or by doing as it says and
talking about $main::hello instead of $hello.

I thought strict 'refs' prohibited symbolic references.

You can, of course, use eval STRING.

#!/usr/bin/perl -w
use strict;
BEGIN { 
	my %vars = ('x' => 'y', 'z' => 'elephant@squirrel');
	for (keys %vars) {
		eval "use vars '\$$_'; \$$_ = '$vars{$_}';";
	} 
}
print "x is $x and z is $z\n";

Output is:
x is y and z is elephant@squirrel

I hope that at some point you decide to avoid eval STRING and symrefs :)

Kragen
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Sep 14 1999
55 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Wed, 15 Sep 1999 07:10:56 GMT
From: David Huggins-Daines <dhd@eradicator.dhis.org>
Subject: Problems with PUSHi() in XS code
Message-Id: <87r9k0oedh.fsf@eradicator.dhis.org>


When I try to compile an XSUB like this in 5.005_03:

void
push_stuff()
	PPCODE:
	XPUSHi(42)

I get the following compile error:

Foo.xs: In function `XS_Foo_push_stuff':
Foo.xs:11: `targ' undeclared (first use in this function)

XPUSHn and XPUSHp (and their non-extending variations) also seem to
have this problem.

A more thorough examination of perlguts(1p) and pp.h seems to indicate
that these are expecting 'targ' to be intitialized with a pointer to
an available target SV on the stack.  However, the 'XSUBs and the
Argument Stack' section which explains the use of the X?PUSH[ipns]
macros in PPCODE sections makes no mention of this whatsoever.

What is the proper way to make sure that 'targ' is declared?  It is of
course possible to work around this by using something like
"PUSHs(sv_2mortal(newSViv(42)))" as in the example in perlxs(1p), but
PUSHi() is much more understandable, and if I understand correctly,
potentially more efficient if a target SV can be reused.

It strikes me that this is either a documentation bug (i.e. if these
macros are not meant to be used in XS code, then the man page should
state this - alternately, it should specify the proper way to use
them).

-- 
You do{} stuff.  Then it's $done.  Then you die().


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

Date: Wed, 15 Sep 1999 10:00:57 +0200
From: Daniel Krajzewicz <krajzewicz@inx.de>
To: Daniel Krajzewicz <krajzewicz@inx.de>
Subject: Procedure result inheritance
Message-Id: <37DF5239.A2C20FDE@inx.de>

Hello !!!

Let's say I#m constructing a set of modules - I can just animate you to
do this.
I wish to have a simple error-handler which works in the following way :
Each modules only expor the variable "result" and "error". When an error
occures,
the variable "error" holds the word "true" and result the
error-description. 
On no error "error" contains "false" and "result" the result of the
procedure.
So far about the technics, now two questions :
1. Is this nonsence ?? Is there a better way for an error-handler ?
2. Is there a possibility to map both variables onto the same calling
variables, that means when an error occures in a submodule,
automatically the same variables in the caller will be set ??

thanks,
Daniel Krajzewicz



-- 
 __________________________
<     Daniel Krajzewicz    >
 >------------------------<
<     krajzewicz@inx.de    >   
 >------------------------<
< http://www.art-so-far.de >
 >------------------------<
<__________________________>


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

Date: Wed, 15 Sep 1999 04:19:42 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Question with 'require' and 'import'
Message-Id: <37DF1E54.646B51C8@home.com>

Greg Boug wrote:
> 
>             require "Something::else::$_";
>             "Something::else::$_"->import(); # I know this is wrong

    eval "use Something::else::$_";

perldoc -f eval
perldoc -f use

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 14 Sep 1999 04:14:40 GMT
From: rong@news.pgs.com (Ron Grunwald-Computer Programmer PGS Tensor Perth)
Subject: Re: rand questions
Message-Id: <7rki3g$m2f$1@news.hstn.tensor.pgs.com>

Gene Senyszyn (scatt@goes.com) wrote:
: Hi,

: I've been searching for a seemingly simple answer to a few questions
: using rand().
: Is there a way to force rand() to return only integers?

: I have an array, and I get the # of items in it, and call rand() using
: the # of items as the expression (ie $x = rand $count;)
: I then have a print statement that prints the # returned ($x) and the
: corresponding position in the array. (print $ARRAY[$x];)

: The variable $x gets converted to an integer, however the next random
: number can be 4.3333, where the last one was maybe 4.2222, and they both
: print the same lines.

: Technically, its a random number, but when I print the array item, they
: are the same.

According to the 'Camel book' to generate random integers use:

    $n = int (rand ($count)) + 1;

where $n will receive integers between 1 and $count inclusive.

Your second point about generating integral numbers rather than
floating-point numbers: I think you'll find that there is no difference
between generating numbers from a 'native' integral RNG and using the
above expression. There are only $count integers that can be generated,
no matter what method you use.


Cheers, Ron.

--------------------------------------------------------------------------
Ron Grunwald               | Usual E-mail         rong@prth.pgs.com
UNIX Programming Section   | Alternate E-mail     r.grunwald@usa.net 
PGS Tensor Pty. Ltd.       | Work Tel.            011 618 9320 9029
 Petroleum Exploration and | IBM Centre, Perth
   Seismic Processing.     |             Western Australia
--------------------------------------------------------------------------


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

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

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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


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