[17847] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 6 14:25:27 2001

Date: Sat, 6 Jan 2001 11:25:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <978809110-v10-i7@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 6 Jan 2001     Volume: 10 Number: 7

Today's topics:
    Re: perl and zombies <bernie@fantasyfarm.com>
        PerlCC and DBI problem... bbrelin@yahoo.com
    Re: recursive directory copy?!? <lincoln@marr.academics.co.uk>
    Re: Running Perl scripts with no extensions (Tad McClellan)
        Script for Managing Member Accounts? <jeffw411@hotmail.com>
    Re: sending numbers??? (Mark Jason Dominus)
    Re: Shall use a reference instead? (Martien Verbruggen)
    Re: Shall use a reference instead? (Mark Jason Dominus)
    Re: Unitialised value error. (Tad McClellan)
    Re: Using C code in Perl (Tad McClellan)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 06 Jan 2001 09:34:11 -0500
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: perl and zombies
Message-Id: <dfae5tccupm31nhhp352bpjqg1jdffpmv8@news.supernews.net>

mgjv@tradingpost.com.au (Martien Verbruggen) wrote:

} This is where the process gets waited on. I bet that if you check
} _after_ the close you won't find the zombie. The original complaint was
} that the zombies remained after the close, until the program terminates.
} 
} See the parallell thread in which MJD tells us all why :)

can you be a bit less elliptic about this?  I didn't see MJD's answering
this on *this* thread, and I can't figure out which is the 'parallel
thread' you're referring to...  What's the 'subject' for this other thread?

  /Bernie\
-- 
Bernie Cosell                     Fantasy Farm Fibers
bernie@fantasyfarm.com            Pearisburg, VA
    -->  Too many people, too few sheep  <--          


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

Date: Sat, 06 Jan 2001 18:02:40 GMT
From: bbrelin@yahoo.com
Subject: PerlCC and DBI problem...
Message-Id: <937mjt$ulj$1@nnrp1.deja.com>

Hello,

I'm have the following:

Perl 5.6
Solaris 7
DBI
DBD::Oracle

I've written a DBI program that I want to compile using perlcc.

The compilation goes fine, at least, it created the binary.

When I try to use it, however, I get the following error:

install_driver (Oracle) failed: panic: mapstart at <path>/Heavy.pm
line 194.

Line 194 is part of the sub _push_tags().

This program works fine when I run it via perl, it just fails when
I try to run the standalone binary.

Anyone seen this problem before???

Thanks,

Braun Brelin
bbrelin@yahoo.com





Sent via Deja.com
http://www.deja.com/


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

Date: Sat, 6 Jan 2001 14:55:06 -0000
From: "Lincoln Marr" <lincoln@marr.academics.co.uk>
Subject: Re: recursive directory copy?!?
Message-Id: <937bhg$sb4$1@news5.svr.pol.co.uk>


djinni <genie.us@@home.com> wrote in message
news:Jjd56.942965$8u4.19010825@news1.rdc1.bc.home.com...
> Does anyone know how to recursively copy a directory?
> thanks,
>
> -dj
>

I did this a while ago, if you're familiar with installing modules just
download the File::NCopy module from CPAN and follow the instructions, its
very easy.




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

Date: Sat, 6 Jan 2001 07:48:22 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Running Perl scripts with no extensions
Message-Id: <slrn95e50m.ri8.tadmc@magna.metronet.com>

CM <cmon_209@hotmail.com> wrote:
>
>How do I run a Perl script WITHOUT any extension on my Apache-on-Linux
>Web Server?


How to configure a web server is off-topic in a Perl newsgroup.

There are newsgroups where web server configuration _is_ discussed:

      comp.infosystems.www.servers.unix
      comp.infosystems.www.authoring.cgi


Please ask over there (after searching your apache docs.
Try "ScriptAlias" as a search term).


>Has this got anything to do with configuration of Perl


No.


>should I manipulate my Server config in some way?


Yes.


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sat, 06 Jan 2001 16:37:56 GMT
From: "JEFF" <jeffw411@hotmail.com>
Subject: Script for Managing Member Accounts?
Message-Id: <ERH56.62650$wF3.159764@skycache.prestige.net>

This is a multi-part message in MIME format.

------=_NextPart_000_001E_01C077DD.606E6820
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I am building a web site with multiple member areas, and am looking for =
=3D
a script/program or someone capable of writing a script that would =3D
generate login/password, process credit card and restrict the new member =
=3D
to the area they paid for. Does anyone now of such a program or shopping =
=3D
cart for multiple restricted member areas or who could write such a =3D
program relatively cheap?=20
Thanks



------=_NextPart_000_001E_01C077DD.606E6820
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I am building a web site with multiple =
member=20
areas, and am looking for =3D<BR>a script/program or someone capable of =
writing a=20
script that would =3D<BR>generate login/password, process credit card =
and restrict=20
the new member =3D<BR>to the area they paid for. Does anyone now of such =
a program=20
or shopping =3D<BR>cart for multiple restricted member areas or who =
could write=20
such a =3D<BR>program relatively cheap?=20
<BR>Thanks<BR><BR></FONT></DIV></BODY></HTML>

------=_NextPart_000_001E_01C077DD.606E6820--



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

Date: Sat, 06 Jan 2001 17:49:48 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: sending numbers???
Message-Id: <3a575abc.ee$328@news.op.net>

[mailed and posted]

In article <Pine.SOL.4.10.10101051711190.25935-100000@robert>,
Bin - Lu  <b0l4549@cs.tamu.edu> wrote:
>
>I'm trying to send number type variables through socket. But it seems that
>the number is always converted to characters and then sent to the other
>side. 

Right.  The internet protocols allow you to send a sequence of 8-bit
bytes.  That is all.  If you want to send 'numbers', you must encode
them as a series of 8-bit bytes.

>Although I know that I can use FreezeThaw to convert them back to
>numbers at the other side, it's not an efficient way because, say
>1000, the integer may only needs 4 bytes but four characters 1,0,0,0
>would need 16 bytes

Use

        $string = pack "N*", $number, $another, @moreNumbers;

to turn the numbers into a string before sending them, and

        @numbers = unpack "N*", $string;

to turn them back again on the other side.

That uses exactly 4 bytes per number.


-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Sun, 7 Jan 2001 01:20:36 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Shall use a reference instead?
Message-Id: <slrn95eadk.7ou.mgjv@martien.heliotrope.home>

On Sat, 06 Jan 2001 13:51:49 GMT,
	bababozorg@aol.com <bababozorg@aol.com> wrote:
> Hi,
> 
> i am writing this program that its performance in terms of memory/CPU
> usage is very important for me...

Then you should probably not be writing it in Perl.

Seriously.

> use MyConfs;
> my $config=MyConfs->new;
> my $color = $config->get_color;

> that
> $config object will fly on all the subroutines i have throughout my
> program and modules... so it will be passed from one sub to another...
> and i will catch the config in subs by "my $config = $_[0]"...
> 
> Now... this thing just accored to me that i could pass it as a
> reference to each of the subs instead of the actual $config...

$config is already a reference. A blessed one, but still simply a
reference. At least, I am assuming that your MyConfs::new sub looks
something like:

sub new
{
	my $proto = shift;
	my $class = ref $proto || $proto;
	my $self = {}; # or a scalar ref, or an array ref
	bless $self, $class
}

Right? Then what this sub returns _is_ a reference, and $config will be
a reference. Passing a reference to a reference isn't going to be faster
than passing the reference itself, especially not, since you now will
have to dereference two references, instead of one.

It would also increase the amount of memory needed, since you need to
carry this extra reference around. But that would not really be
noticeable in any program of a reasonable size.

Now, One thing that may make a negligible difference would be
to not do:

my $config = $_[0];

but to just use that $_[0] directly all the time. However, I would not
even consider doing something like that. It'll make your code impossible
to read, and the speed improvements will most likely be negligible.

If you're worried about passing that reference around, why don't you
make it into a package global? That way you can get at it from
everywhere, directly, with no cost at all.

use MyConfig;

MyConfig->ReadConfig();

sub that_needs_config_info
{
	my ($p1, $p2) = @_;
	#....

	$some_option = MyConfig->get_option('foo');

	# or even

	$some_other_option = $MyConfig::ConfigHash{'foo'};

	# or anything else you like
}

It's unlikely that you'll ever need more than one config object in a
single program, so you might as well make it a single thing to deal
with. OO is fine, but not everything has to be an object.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | 
Commercial Dynamics Pty. Ltd.   | Curiouser and curiouser, said Alice.
NSW, Australia                  | 


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

Date: Sat, 06 Jan 2001 17:40:43 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Shall use a reference instead?
Message-Id: <3a57589a.bb$388@news.op.net>
Keywords: collet, prosecution, strangulate, tradition

In article <9377tk$jmj$1@nnrp1.deja.com>,  <bababozorg@aol.com> wrote:
>well that was a little introductions... BUT the problem i have is: that
>$config object will fly on all the subroutines i have throughout my
>program and modules... so it will be passed from one sub to another...
>and i will catch the config in subs by "my $config = $_[0]"...
>
>Now... this thing just accored to me that i could pass it as a
>reference to each of the subs instead of the actual $config...

That won't help.  It might make your program a little slower.

As Martien pointed out, $config is already a reference.

But even when $config is not a reference, even if $config were a
10-megabyte string, it still wouldn't help.  In Perl, scalars are
always passed by reference.  If you have

        $s = "this is a 10 megabyte string";
        foo($s);

there is no copying of the string.  Perl does not have to allocate 10
megabytes to hold a copy of $s to give to foo().  Inside of Perl, what
is passed is a C pointer to the string.  That is why foo() can change
the value of $s by doing this:

        sub foo {
          $_[0] = 'ERASED';
        }

because of this, the reference is already there whether you put it
there or not.  (In fact, Perl actually passes a pointer to the pointer
to the string.  If you pass \$s instead of $s, you are passing a
pointer to the pointer to the pointer to the string.)

The extra layer of intdirection won't get you anything.  It won't
decrease memeory usage and it won't speed up your program.

>do u think that would shorten the memory usage? 

Also, I think you mispelled 'you'. Hope this helps.

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Sat, 6 Jan 2001 08:40:00 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Unitialised value error.
Message-Id: <slrn95e81g.ri8.tadmc@magna.metronet.com>

Wolfgang Hielscher <W.Hielscher@mssys.com> wrote:
>John Boy Walton <johngros@Spam.bigpond.net.au> wrote:

>Anno and I did point you to this (potential) bug before. Ignoring advice
>is the fast lane to never getting any advice in the future.


That's how he got scored down by me, and that is on top of the
downscoring for munging the right side of the @ sign. The only
"nice" munging of the domain part is by appending ".invalid" to
the end.

Munge the login name if you must, not the domain.


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sat, 6 Jan 2001 07:18:38 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Using C code in Perl
Message-Id: <slrn95e38u.ri8.tadmc@magna.metronet.com>


[ Please do not send stealth Cc's ]


Brian Ingerson <ingy@ActiveState.com> wrote:
>
>
>Tad McClellan wrote:
>
>>> I've got some C/C++ functions that I want to use in a perl program, but
>>> I can't figure out how and if this is possible.
>>    perldoc -q " C "
>> Ah, that's better:
>>    "Where can I learn about linking C with Perl?"
>
>Great in theory, 


My point was if you have a question about C you (he) should have checked
for mention of C in the Perl FAQs before posting to the Perl newsgroup.

If you've done that, and the answer there doesn't help, then you
should mention that you have already seen that, else you'll
just get a bunch of pointers to where you have already been. 


>but in practice 


But it practice Doing It Wrong turned out well this time. 
It uncovered a bug.


>this query does not mention anything 
>about Inline.pm :) 


Bugs in the documentation should be reported with 'perlbug'
rather than on clpmisc  :-)    :-)

[ I'm actually serious here. Please send me email if you would
  rather not report it, and I will. Thanks.
]


>It mentions a lot about XS, but XS is an insane 
>starting point for Robert.
                ^^^^^^^^^^


You could have left that part out without affecting the truth
of the statement :-)    errr, make that  :-(


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

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 V10 Issue 7
************************************


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