[16565] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3977 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 10 14:10:35 2000

Date: Thu, 10 Aug 2000 11:10:24 -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: <965931023-v9-i3977@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 10 Aug 2000     Volume: 9 Number: 3977

Today's topics:
        Modules Used <gerry.morong@compaq.com>
    Re: Modules Used (Rafael Garcia-Suarez)
    Re: multi file modules <memmett@fraser.sfu.ca>
    Re: No threads in this perl? <jason@shakabuku.org>
    Re: on-the-fly variable <andylee@taiwan.com>
    Re: on-the-fly variable <bart.lateur@skynet.be>
    Re: Oracle connectivity using Perl <newsposter@cthulhu.demon.nl>
    Re: Perldoc, Redirect Output to File? WinNT <9jerry9@my-deja.com>
    Re: Problem installing Regexp.pm (Anno Siegel)
    Re: problems with ^= (Anno Siegel)
    Re: problems with ^= toddbe@my-deja.com
    Re: problems with ^= <russ_jones@rac.ray.com>
    Re: Problems with adding 1 <jcook@strobedata.com>
    Re: truncate var spaces <jcook@strobedata.com>
    Re: variable in sql array not parsed <russ_jones@rac.ray.com>
        very simple doubt <nunosanto@netcabo.pt>
    Re: very simple doubt (Rafael Garcia-Suarez)
    Re: warning/var weirdness (or is it?) <callgirl@la.znet.com>
    Re: What is "pack()" used for? <russ_jones@rac.ray.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 10 Aug 2000 10:48:58 -0500
From: "Gerry" <gerry.morong@compaq.com>
Subject: Modules Used
Message-Id: <8muisr$itl$1@mailint03.im.hou.compaq.com>

Is there a script, program or setting that will show you what perl modules
your perl script is using and where it got them from?

Gerry




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

Date: Thu, 10 Aug 2000 15:58:40 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Modules Used
Message-Id: <slrn8p5kjc.rv8.rgarciasuarez@rafael.kazibao.net>

Gerry wrote in comp.lang.perl.misc:
>Is there a script, program or setting that will show you what perl modules
>your perl script is using and where it got them from?

Look into the %INC hash. It is described in the perlvar manpage.

-- 
Rafael Garcia-Suarez
rgarciasuarez.free.fr


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

Date: 10 Aug 2000 08:52:02 -0700
From: Matthew Emmett <memmett@fraser.sfu.ca>
Subject: Re: multi file modules
Message-Id: <yvw9ya25ktb1.fsf@fraser.sfu.ca>

jason <elephant@squirrelgroup.com> writes:

> at a guess .. your use line has Modules::RosterUI in it .. you
> realise that will make Perl look for 'Modules/RosterUI.pm' in the
> directories in @INC .. if Roster.pm and RosterUI.pm are in the same
> directory then you should probably just have
> 
>   use RosterUI;
> 

In the "main" script, I have "use Modules::Roster;", so the Modules
directory isn't in @INC.  That's why I have to do "use
Modules::RosterUI;".


> a lot depends on whether that $top is being set correctly I'd
> imagine ..

$top is definetly being set properly.

> it would seem that you've got things pretty messed up and that
> whatever is 'use'ing Roster is also 'use'ing RosterUI .. perhaps it
> should just use Roster which in turn uses RosterUI

That's what it does.  Hmmm.... thanks for your thoughts though.  Any
other suggestions?

Thanks,
Matt



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

Date: Thu, 10 Aug 2000 15:46:28 GMT
From: Jason Bodnar <jason@shakabuku.org>
Subject: Re: No threads in this perl?
Message-Id: <8muioj$p16$1@nnrp1.deja.com>

In article <slrn8p4go0.7ni.sandhall@poetry.lipogram>,
  sandhall@swipnet.se wrote:

> From README.threads in the Perl 5.6.0 src:
>
>   NOTE: This documentation describes the style of threading that was
>   available in 5.005.  Perl v5.6 also has the early beginnings of
>   interpreter-based threads support (which is what will be enabled by
>   default when you simply ask for -Dusethreads).  However, be advised
>   that interpreter threads cannot as yet be created from the Perl
level
>   yet.  If you're looking to create threads from within Perl, chances
>   are you _don't_ want interpreter threads, but want the older support
>   for threads described below, enabled with:
>
>       sh Configure -Dusethreads -Duse5005threads

Ah, thank you very much. Makes sense but I would have expected
-Dusethreads to haver defaulted to 5.005 threads since interpreter
threads aren't available yet and the thread documentation is based on
5.005.

No matter. Glad I only have to recompile perl.

Thanks again.

--
Jason Bodnar
jason@shakabuku.org


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


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

Date: Thu, 10 Aug 2000 23:03:57 +0800
From: Andy <andylee@taiwan.com>
Subject: Re: on-the-fly variable
Message-Id: <3992C45D.2B14D6D6@taiwan.com>

I know that there is a function called "session" in ASP, this function can do
what I wanted, and does Perl also have this type of funtion...?

And does $ENV in Perl is like session in ASP...?

Andy.L

Bart Lateur ¼g¤J¡G

> Simply recalculate the total every time.
>
> All you need to store is the selected items themselves, but you can't
> build a shopping cart system without that.
>
> Storing the intermediate total is useless, because you'll have to fetch
> the description of the items, to put into your page, and the number of
> items for each articel, anyway. So pulling out the price as well and
> adding to a total, starting from scratch every time, is an "overhead"
> not even worth mentioning at all.
>
> --
>         Bart.



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

Date: Thu, 10 Aug 2000 15:52:26 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: on-the-fly variable
Message-Id: <4dj5pso2vr6rp1p50g7thtd8ffb34mv5ki@4ax.com>

Andy wrote:

>I know that there is a function called "session" in ASP, this function can do
>what I wanted, and does Perl also have this type of funtion...?
>
>And does $ENV in Perl is like session in ASP...?

No. "session" is not really a function. I've been told that it uses
browser cookies behind the scenes. So, ASP is cheating.

You can use cookies, or the PATH_INFO method (append a string after a
slash in the URL), to send around a unique session ID. See the CGI FAQ,
question 4.12, at <http://www.webthing.com/tutorials/cgifaq.3.html#12>

The actual data can be stored somewhere on your server, either using a
database, or temporary data files, identified by the session ID.

-- 
	Bart.


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

Date: 10 Aug 2000 16:16:17 GMT
From: Erik van Roode <newsposter@cthulhu.demon.nl>
Subject: Re: Oracle connectivity using Perl
Message-Id: <8mukgh$j6m$1@internal-news.uu.net>

Peter_Gadsby <peter_gadsbyNOpeSPAM@hfcbank.co.uk.invalid> wrote:

> Hi Erik, the code also core dumps intermittently in UNIX.....
> This is the code in question, basically it display Oracle locks
> in HTML .... Your help would be much appreciated.. Cheers

  Your problem makes a lot more sense now ... Have you tried switching
to DBI/DBD::Oracle? AFAIK Oraperl is obsolete. If you can't/don't want
to switch, you might have to dive into the Oraperl code. I've never
used Oraperl. Another thing you might try is enabling warnings. You
might be passing garbage to Oraperl's functions, causing it to crash.

> #!/usr/local/bin/perl

> $Oraperl::safe=1;
> use Oraperl;

Erik



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

Date: Thu, 10 Aug 2000 17:21:33 GMT
From: Jerry Leventer <9jerry9@my-deja.com>
Subject: Re: Perldoc, Redirect Output to File? WinNT
Message-Id: <8muoal$tib$1@nnrp1.deja.com>

In article <8knqn3$srf$1@nnrp1.deja.com>,
  Jerry Leventer <9jerry9@my-deja.com> wrote:
> I am running perl v5.6.0, bld 615 on WinNT4.0.
>
> I would like to redirect the perldoc output to a file so I can print
> it out or view it in a text editor such as 'vi'.
> Is there a way to do this?  I tried,
>
>         perldoc perldoc > file
>

My Latest Observations:

The redirection seems to work on NT but not on Win95.  Has anyone else
experienced this?

        perldoc extutils::installed > file

creates the file on the Win95 machine in a dos window, but the file is
empty.  Output is sent to the screen.

There also seems to be a difference with how the 'more' function works
when viewing the perldoc output on the screen. On my NT machine 'space
bar' and 'Enter' keys scroll an entire page.  Win 95 works correctly in
that the 'Enter' key scrolls only one line at a time.

Hmmm.


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


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

Date: 10 Aug 2000 16:18:56 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Problem installing Regexp.pm
Message-Id: <8muklg$6c9$1@lublin.zrz.tu-berlin.de>

 <jknight_30@my-deja.com> wrote in comp.lang.perl.misc:
>After running Makefile.PL and make I get the following error:
>-----------------------------------------------------
>cc-1020 cc: ERROR File = Regexp.xs, Line = 309
>  The identifier "curpm" is undefined.
>
>      regexp *re = (curpm) ? curpm->op_pmregexp : NULL;
>-----------------------------------------------------
>Looks like a syntax error, does anyone have a good copy of Regexp.xs
>or an alternative solution?

You will have to persuade the make process to add -DPERL_POLLUTE to
the cc flags.  I seem to remember that ./Makefile.PL -POLLUTE does
that.

Anno


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

Date: 10 Aug 2000 15:15:22 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: problems with ^=
Message-Id: <8mugua$68e$1@lublin.zrz.tu-berlin.de>

 <toddbe@my-deja.com> wrote in comp.lang.perl.misc:
>I'm running this bit of code on an HPUX 10.20 system and a linux system
>and get very different resaults.  On the HP $h1 get the correct value on
>the linux box $h1 becomes 0.
>
>Is ^= not working under linux?
>
>$h0 += 9804392444;
>$h1 += 15433492645;
>$h2 += 2607314627;
>$h3 += 859226588;
>$h4 += 4989140090;

Why are you assinging values via +=?  Not that it matters, but
you make everyone look twice (or not at all).

>$h1  ^=  $h0;  #$h1 goes to 0 on linux
>$h2  ^=  $h0;
>$h3  ^=  $h0;
>$h4  ^=  $h0;

Your $h1 is > 2**32.  Probably HPUX is running on a 64 bit machine and
Linux isn't.

Anno


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

Date: Thu, 10 Aug 2000 15:41:27 GMT
From: toddbe@my-deja.com
Subject: Re: problems with ^=
Message-Id: <8muif6$oli$1@nnrp1.deja.com>




> >Is ^= not working under linux?
> >
> >$h0 += 9804392444;
> >$h1 += 15433492645;
> >$h2 += 2607314627;
> >$h3 += 859226588;
> >$h4 += 4989140090;
>
> Why are you assinging values via +=?  Not that it matters, but
> you make everyone look twice (or not at all).

The code I cut from uses somthing like $h0 += $A0;  I put the actual
values in for debugging and for the purposes of posting to this group.

>
> >$h1  ^=  $h0;  #$h1 goes to 0 on linux
> >$h2  ^=  $h0;
> >$h3  ^=  $h0;
> >$h4  ^=  $h0;
>
> Your $h1 is > 2**32.  Probably HPUX is running on a 64 bit machine and
> Linux isn't.

Nope, the hp is a 32 bit machine and I found that the code works under
perl for windows.  Any body else have a suggestion?

-Todd


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


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

Date: Thu, 10 Aug 2000 11:18:57 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: problems with ^=
Message-Id: <3992D5F1.5E4747F9@rac.ray.com>

Anno Siegel wrote:
> 
> 
> Your $h1 is > 2**32.  Probably HPUX is running on a 64 bit machine and
> Linux isn't.
> 

Anno's got the "why" of it right, but shouldn't perl let you know when
you overflow?

-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

Quae narravi, nullo modo negabo. - Catullus


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

Date: Thu, 10 Aug 2000 09:45:21 -0700
From: Jim Cook <jcook@strobedata.com>
To: thirdgc@my-deja.com
Subject: Re: Problems with adding 1
Message-Id: <3992DC21.3A2C7A75@strobedata.com>

> @numb = <postnumb>;
> @numb ++;

Hey, one that even I can answer.

@numb consists of all of the lines from the postnumb file. $numb[0] is
the first line, and $numb[1] is the second line (assuming the default
array lower limit value).

If you really have only one line in the file, try one of the following
untested code fragments.

$numb = <postnumb>;
$numb++;

or

@numb = <postnumb>;
@numb[0]++;

--
jcook@strobedata.com  Live Honourably    4/1 - 4/3 + 4/5 - 4/7 + . . .
2000 Tuesdays: Feb/last 4/4 6/6 8/8/ 10/10 12/12 9/5 5/9 7/11 11/7 3/14
Strobe Data Inc. home page   http://www.strobedata.com
My home page    O-           http://jcook.net


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

Date: Thu, 10 Aug 2000 09:41:26 -0700
From: Jim Cook <jcook@strobedata.com>
To: fg19537@my-deja.com
Subject: Re: truncate var spaces
Message-Id: <3992DB36.4819043A@strobedata.com>

>     $fname = $$row[0];
>     $fname =~ s/^\s+//;
>     $fname =~ s/\s+$//;
>     print "where  fname = '$fname';\n";

How about

($fname = $$row[0]) =~ s/(^\s+|\s+$)//g;

Also, I'm unfamiliar with the $$row[0] construct. What does that do?

--
jcook@strobedata.com  Live Honourably    4/1 - 4/3 + 4/5 - 4/7 + . . .
2000 Tuesdays: Feb/last 4/4 6/6 8/8/ 10/10 12/12 9/5 5/9 7/11 11/7 3/14
Strobe Data Inc. home page   http://www.strobedata.com
My home page    O-           http://jcook.net


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

Date: Thu, 10 Aug 2000 11:15:42 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: variable in sql array not parsed
Message-Id: <3992D52E.5A414FBB@rac.ray.com>

Tim wrote:
> 
> steve_shriver@my-deja.com wrote in <8msitm$bl9$1@nnrp1.deja.com>:
> 
> >My goal is to get a SQL statement to include a variable (as a string)
> >that PERL interprets at runtime.

(snippage)
> 
> You probably need to set up a bind variable:
> 
(more snippage)
> 
> my $sql = 'select * from table where column = :1';
> 
> my $sth = $dbh->prepare($sql);
> 

I use this (I do lots more error checking, I just didn't type it all
here)


# prepare the sql handler
my $sth = $dbh->prepare("
	SELECT	field_a
	FROM	table
	WHERE	other_field = ?
	") or croak "error stuff: $DBI::errstr";
# $sth->execute lets you plug in a value to replace the question mark
# in your SELECT statement
my $other_field = "booga booga";
$sth->execute($other_field); # or "error stuff";
while (my ($field_a) = $sth->fetchrowarray())
{
  # do something here with $field_a
}

mainly because I don't know any better, but it works.


-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

Quae narravi, nullo modo negabo. - Catullus


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

Date: Thu, 10 Aug 2000 15:54:14 +0100
From: "Nuno Santo" <nunosanto@netcabo.pt>
Subject: very simple doubt
Message-Id: <8mugft$hkf$1@srvlis16.teleweb.pt>

I´m really new to Perl programming, and I´ve read a lot of documentation
about Perl. In them I´ve seen several times the following declaration:

my $something = @_;

what does it do?




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

Date: Thu, 10 Aug 2000 15:19:16 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: very simple doubt
Message-Id: <slrn8p5i9i.rm4.rgarciasuarez@rafael.kazibao.net>

Nuno Santo wrote in comp.lang.perl.misc:
>I´m really new to Perl programming, and I´ve read a lot of documentation
>about Perl. In them I´ve seen several times the following declaration:
>
>my $something = @_;
>
>what does it do?

It affects to $something the number of elements in @_.
You probably meant
  my ($something) = @_;
which does another thing: it affects to $something the value of the
first element of the @_ array, which usually contains the arguments
passed to the current subroutine.

'my' specifies that the variable is local to the enclosing block.

You missed the perlsub manpage in your readings...

-- 
Rafael Garcia-Suarez


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

Date: Thu, 10 Aug 2000 09:04:01 -0700
From: "Godzilla!" <callgirl@la.znet.com>
Subject: Re: warning/var weirdness (or is it?)
Message-Id: <3992D271.841D058C@la.znet.com>

Larry Rosler wrote:
 
> In article <965883340XBQ.fvw@var.cx>, fvw+usenet@var.cx says...
> > Thanks for the help everybody, I guess the way to troubleshoot
> > these things is indeed use strict...
 
> Ssssh!  Don't let Godzilla! hear you!!!


You will note I commented within this string
about a person discarding use of strict where
he should still be using strict.

His response is a degree of ignorance expected
from a high school dropout mixed in with personal
insults and hatred.

*shrugs*

Very typical behavior for regulars here. Regulars
here are not exactly bright boys nor noted for
being well mannered.

Godzilla!


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

Date: Thu, 10 Aug 2000 11:30:36 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: What is "pack()" used for?
Message-Id: <3992D8AC.35FE7406@rac.ray.com>

Bart Lateur wrote:
> 
> Javier Hijas wrote:
> 
> >Ok, I know what it does, but I wonder when may I need it.
> 
> Converting plain, human form data into binary structures. unpack() does
> the reverse.
> 
> For example, if you explicitely want to process binary files, unpack()
> will help in turning the rawbytes into numbers. See the module
> Image::Size for examples. pack() is usefule if you want to generate such
> binary files.
> 

IP addresses, too. get*byname() and get*byaddr() use packed binary
fields.

$ip = "127.0.0.1";
@octets = split('\.',$ip,4);
$dns_name = gethostbyaddr(pack('C4',@octets),2);

($oct1,$oct2,$oct3,$oct4) =
unpack('C4',gethostbyname("my.server.com"));
$ip = "$oct1.$oct2.$oct3.$oct4"

-- 
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747

Quae narravi, nullo modo negabo. - Catullus


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

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


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