[6441] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 66 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 6 20:28:18 1997

Date: Thu, 6 Mar 97 17:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 6 Mar 1997     Volume: 8 Number: 66

Today's topics:
     Re: /.*/ works, /[.]*/ doesn't, why!?!!?!! <lmichael@gdc.com>
     Re: @ interpolation in string context <rootbeer@teleport.com>
     Re: @ interpolation in string context <rra@cs.stanford.edu>
     Alphabetical Order <mau006@bangor.ac.uk>
     Re: beginner! <rootbeer@teleport.com>
     Building variable variable names ?? (Wolfgang Reimann)
     Re: Building variable variable names ?? <dbenhur@egames.com>
     can't find GDBM_File.pm (Broc Seib)
     compiling perl for irix6.2 <gheil@rtimeinc.com>
     Re: Counting Character Positions on a line for Database (Matthew D. Healy)
     Re: delete some lines in a doc (Kevin Buhr)
     Re: File input through the web <jeff@networkers.com>
     Re: FREE Virus Alert Newsletter <rootbeer@teleport.com>
     Re: Getting Started with Sockets <rootbeer@teleport.com>
     Re: HELP - Removing Carriage Returns (Nathan V. Patwardhan)
     Re: Installing Perl for Win32 ("John Dallman")
     Re: keys() on a map() fails. Why? <merlyn@stonehenge.com>
     Re: making large perl CGIs run faster (Matthew Ahrens)
     Re: Making sure 'perl -v' works <rra@cs.stanford.edu>
     Re: Perl -- compiled? C converter? (Bryan Miller)
     Re: Perl5 references question <dbenhur@egames.com>
     Re: PerlIS+Win32::ODBC - Can't call method "Sql"... (Parillo)
     Question about floating point math w/perl (Kendall S Hunter)
     Re: question regarding linking two perl files (Charles DeRykus)
     Re: Re Help Me Please obscene poster avoiding <rcastill@icix.net>
     Stored Procedures For ORACLE <mshannon@lds.com>
     Re: Subroutine Source? (Gurusamy Sarathy)
     Re: unprompted listen for <STDIN> (Charles DeRykus)
     Re: WANTED: SCRIPT (Bruce W. Hoylman)
     Win32::NetAdmin Question (RICH STEC)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 06 Mar 1997 14:56:22 -0500
From: Laurence Michaels <lmichael@gdc.com>
To: peterv@valkieser.nl
Subject: Re: /.*/ works, /[.]*/ doesn't, why!?!!?!!
Message-Id: <bhqohcwx09l.fsf@gdc.com>

cc'ed to peterv@valkieser.nl

I know, following up my own post... Just tried one of my own suggestions,
and it didn't work... :-(

Laurence Michaels <lmichael@gdc.com> writes:

> The following code may do the trick:
> while (<>) {
>     print join '\n', split / /, $_;
> }
> Untested, use at your own risk.
At least I gave warning :-)...
It should have been
while (<>) {
    print join "\n", split /\s+/, $_;
}

Still not quite 'perfect', since I haven't figured out how to remove
extra newlines.

Later,
 Laurence Michaels
 I do not speak for anyone but myself :)



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

Date: Thu, 6 Mar 1997 13:20:05 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Ken Williams <ken@forum.swarthmore.edu>
Subject: Re: @ interpolation in string context
Message-Id: <Pine.GSO.3.95q.970306125210.26783C-100000@kelly.teleport.com>

On Wed, 5 Mar 1997, Ken Williams wrote, quoting me:

> > If Perl hasn't seen that you're using @POSTED by the time it needs to
> > compile that string, it generates that warning. This is generally a 
> > Good Thing.

> I agree, it has helped me quite a bit several times.  My complaint is
> that it's not a warning, it's a full-fledged compilation failure. 

> Why must the complaint about "@ requires a backslash now" be so harsh,
> i.e why does it have to abort compilation instead of just printing a
> warning message? 

It's because of older scripts (and for those of us who still forget
how to properly write e-mail addresses in literal strings :-). 

In version 4 of perl (and earlier versions?), Perl was very forgiving when
you wrote code like $address = "ken@forum.swarthmore.edu" . It saw that
@forum was never used elsewhere, so it "understood" that you meant an
e-mail address, and left it as-is. This, I'm sure, had seemed a good idea
at the time, but consider what happens to such code when a maintenance
programmer begins to use the array @forum. (Or, worse, when you require a
library subroutine and the library's maintainer, unknown to you, uses that
array. Your code breaks and you never changed it!)

(This could have been fixed by either writing "ken\@forum.swarthmore.edu" 
or simply 'ken@forum.swarthmore.edu', of course. But not every programmer
thought of doing this, and Perl didn't do anything to remind them.)

This mis-feature was fixed in early versions of Perl 5, which correctly
interpolated the nonexistent array. Now some people's e-mail addresses
were silently turned into things like "ken.swarthmore.edu" in those old
scripts. For some reason, this didn't seem popular. Since this was a bug
which might lurk undetected, someone (Larry, I believe) decided to make it
a fatal compile-time error, so as to force immediate detection. 

In a future version of Perl, it may be changed to be no error at all, or
there may be a way to trigger an optional warning. At that point, folks
who use old code will be burned. And people like me will _really_ have to
learn how to put e-mail addresses into literal strings. :-)

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 06 Mar 1997 13:55:10 -0800
From: Russ Allbery <rra@cs.stanford.edu>
Subject: Re: @ interpolation in string context
Message-Id: <qumlo807kjl.fsf@cyclone.stanford.edu>

Ken Williams <ken@forum.swarthmore.edu> writes:

> I agree, it has helped me quite a bit several times.  My complaint is
> that it's not a warning, it's a full-fledged compilation failure.  I
> mean, I know Perl has to do some guessing about what's a literal and
> what's supposed to be interpolated.  But in this case, it guessed wrong.
> Why must the complaint about "@ requires a backslash now" be so harsh,
> i.e why does it have to abort compilation instead of just printing a
> warning message?

Because the failure is extremely obscure.  If you have an "@something" in
a quoted string and print it out, and @something is undef which is the
case if it's a mistake and should have been backslashed, @something turns
into the null string, which can be a real pain to track down.

I assume that this was made an error rather than a warning because not
everyone uses -w and this is sufficiently nonintuitive and potentially
serious to ensure that people always see it.

-- 
Russ Allbery (rra@cs.stanford.edu)      <URL:http://www.eyrie.org/~eagle/>


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

Date: Thu, 06 Mar 1997 21:31:22 +0000
From: "G.Cheers" <mau006@bangor.ac.uk>
Subject: Alphabetical Order
Message-Id: <331F37AA.3677@bangor.ac.uk>

NOTE: PERL NEWBE

Ok, I know what I want to do, I just don't know how to do it. I have
customised a number of free-for-all links scripts in Perl which takes
form input and posts it into a html doc. What I want to do is display
the links in alphabetical order. Sorting the initials would suffice. I
mean all beginning with A then B, rather than Aa, Ab then Ac etc. Rather
than use a database approach I thought I would just comment the html:

newlink-a, newlink-b, newlink-c etc.

If my logic is wrong, and I should be thinking differently  please let
me know, but if someone can tell me how to translate the following, I
could probably put something vaguely efficient together.

if contents of $sitename have initial letter = "a"
^^^^^^^^^^^^^^^^^^^^^^     ^^^^^^^^^^^^^^^^^^
   can do this bit!        can't do this bit!

sub newlink_a


also, should I be using 'otherwise'?


Any help or advice appreciated, Thanks

Gary Cheers


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

Date: Thu, 6 Mar 1997 13:21:59 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Mr A H Abdul Aziz <esuax@csv.warwick.ac.uk>
Subject: Re: beginner!
Message-Id: <Pine.GSO.3.95q.970306132121.26783D-100000@kelly.teleport.com>

On Thu, 6 Mar 1997, Mr A H Abdul Aziz wrote:

> Can anyone help me to solve this problem in perl ...I've write it in awk
> already... 

Maybe you want the a2p program, which comes with Perl and is probably
installed on your system. Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Thu, 06 Mar 1997 21:34:42 GMT
From: reimann@merck.de (Wolfgang Reimann)
Subject: Building variable variable names ??
Message-Id: <331f2f2c.6333507@news>

It's late in the evening and after staring at some lines of code and
trying to find an easy solution. What i'm trying to do is quite simple
for interpreted languages such as REXX and (must be) perl:

Building a variable name that contains a variable part, so that
the result is a list of variables. In the following example i want to
create variables $p1,$p2,$p3,$p4 and so on. I need these to fill a
format. Do i have to use an array? 

#!perl
      @Privs = qw (SETPRV READALL BACKUP SHUTDOWN) ;
          for ($n = 0; $n <= $#Privs ; $n++) {
               $p$n   = $Privs[$n] ;
              printf "%-10s %-10s\n","Variable ",$p$n

All i get running this is:

Scalar found where operator expected at var_of_var.pl line 4, near
"$p$l"
        (Missing operator before $l?)
syntax error at var_of_var.pl line 4, near "$p$l   "
Execution of var_of_var.pl aborted due to compilation errors.

(Perl 5.002_01    On  AlphaServer 2100     VMS 6.1)

Forgive me if that's too silly and i missed 10 FAQ's...

Wolfgang Reimann


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

Date: Thu, 06 Mar 1997 15:09:06 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: Wolfgang Reimann <reimann@merck.de>
Subject: Re: Building variable variable names ??
Message-Id: <331F4E92.5359@egames.com>

[courtesy reply emailed]
Wolfgang Reimann wrote:
> Building a variable name that contains a variable part, so that
> the result is a list of variables. In the following example i want to
> create variables $p1,$p2,$p3,$p4 and so on. I need these to fill a
> format. Do i have to use an array?
>                $p$n   = $Privs[$n] ;
make this:
  no strict 'refs';	# need this if you use strict
  ${"p$n"} = $Privs[$n];

> Forgive me if that's too silly and i missed 10 FAQ's...

If it's not in the FAQ, it probably should be.
See "symbolic references" in Camel, ch.4 or man perlref.

HTH
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"Sometimes you just have to step in it and see if it stinks"  O-
    -- Sonia Orin Lyris




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

Date: 6 Mar 1997 21:14:33 GMT
From: bseib@purdue.edu (Broc Seib)
Subject: can't find GDBM_File.pm
Message-Id: <bseib-0603971614000001@zeus.cc.purdue.edu>

I've got the GDBM distribution from MIT, built the libs, but
lo, there is not a GDBM_File.pm file!

Where do I find GDBM_File.pm?

-b
_______________________________________________________________________
  Broc Seib (bseib@purdue.edu)  |  Purdue University Computing Center
  Network Systems Programmer    |  Instructional Computing Division


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

Date: Thu, 6 Mar 1997 21:25:58 GMT
From: Greg Heil <gheil@rtimeinc.com>
Subject: compiling perl for irix6.2
Message-Id: <331F3666.63C3@rtimeinc.com>

I am trying to install perl5003 on an SGI R10000
box running irix6.2 w/o luck. I have specified irix_6_2
in the config process. I can supply the output of the
make and the config.sh...but i was hoping someone
had found a fix for this. I have found similar problems
with gnu sw and it was necesssary to pretend the OS
was 5.3 to fix those (and do w/o 64 bit registers).

My altavista search and CPAN search has come up empty.

Please reply by email, our firewall aint news friendly.

thanks in advance

-- 
Greg Heil
mailto:gheil@rtimeinc.com WORK http://www.rtimeinc.com
http://www.scn.org/tl/anvil/ HOME mailto:gheil@scn.org


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

Date: Thu, 06 Mar 1997 15:32:06 -0500
From: Matthew.Healy@yale.edu (Matthew D. Healy)
Subject: Re: Counting Character Positions on a line for Database
Message-Id: <Matthew.Healy-0603971532060001@pudding.med.yale.edu>

In article <3315C231.6CD9@worldnet.att.net>, omc@worldnet.att.net wrote:

> I have a report I get every month that has information I need but many
> of the characters on each line I do not. Each character position on a
> line means something, for example characters 45-52 might be a phone
> number called. My question is how do I get only the characters I want so
> I can make them $variables for my program. Are there any good sorting
> programs on the market or can I write a simple script to access these
> characters and export them to a simple flatfile database?
> 

Perl is indeed the tool of choice for such tasks.  You need to be
more specific about what you are trying to do.  Are your fields
always in specific columns (fixed-length fields), or are they
separated by some kind of delimeter?  Perl can handle either,
but the details will depend very much on the data format.

If you are running some flavor of Unix, the cut command may also
be useful for this kind of thing.

Look up the following in the Camel book or the Perl manpages:

unpack
split
substring

---------
Matthew.Healy@yale.edu
http://paella.med.yale.edu/~healy
Go and share the Gospel.  Use words only if necessary --St Francis


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

Date: 06 Mar 1997 17:59:20 -0600
From: buhr@stat.wisc.edu (Kevin Buhr)
Subject: Re: delete some lines in a doc
Message-Id: <vba9140607n.fsf@mozart.stat.wisc.edu>

LMD/T/KR <lmdtlb@lmd.ericsson.se> writes:
> 
> To all the PERL experts, I am new in the PERL lang. But I have to 
> make a little script to remove some lines in a document. I have reach
> the point where I can open the file and and print the lines I would like 
> to delete. 

Perl has some great command-line arguments that simplify this special
case (modifying a file, "in place", line-by-line).  For example, the
single Perl command:

	perl -i.bak -n -e 'print unless /IGNORE/o' aaa bbb

deletes all the lines containing "IGNORE" from the files "aaa" and "bbb".

How does it work?  Well...

The command line argument "-i.bak" means: "Feed each of the files
given on the command line (here, they're "aaa" and "bbb") through my
script, replace those files with the output produced, and make backups
with extension `.bak' in case I screwed up."

The command line argument "-n" means: "Don't run the script I give you
as-is.  Instead, run it on *every* line of *every* file."

The command line argument "-e" means: "The next argument is my
script."

All together, then, this command line means: run the statement

	print unless /IGNORE/o;

on every line of the following files, replacing each file with the
output thus produced.

Since this one-liner prints the current line unless it contains the
word "IGNORE", the result is that all the files on the command line
are replaced by versions without "IGNORE" lines.

			*	*	*

Now, before you get frustrated that you wrote a script to open and
close files and loop through all the lines when you could have done it
like this, understand that what you learned by "open"ing and
"while(<>)"ing files will last you a lifetime.

That being said, here's how you can get your existing script working:

1. Modify your script so that, instead of printing out the lines you
want to *delete*, it prints out the lines you want to *keep*.

2. Add a wrapper like the following around your script:

	open(OUT, ">newfile") or die "couldn't open \"newfile\": $!\n";
	select(OUT);

	. . . your script (which opens the original file and writes
	out all the lines that you *don't* want to delete) goes here . . .

	close(OUT);

The first line opens "newfile" for writing, and the second line
directs the "default output" so that "print" statements that follow
will go to the "OUT" file rather than the standard output (the
screen).  These command are documented in perlfunc(1).

3. If you want to change your program to write over the original file,
your best bet is to rename the original file (say "aaa") to something
else (say "aaa.bak") using the "rename" function; open "aaa.bak" for
input and "aaa" for output; and run your script as before.  If you're
really brave, you can then use the "unlink" function to delete
"aaa.bak".  "rename" and "unlink" are documented in perlfunc(1).

Kevin <buhr@stat.wisc.edu>


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

Date: 06 Mar 1997 11:36:30 -0800
From: Jeff Coffin <jeff@networkers.com>
Subject: Re: File input through the web
Message-Id: <m2k9nkq0ch.fsf@networkers.com>

>>>>> "Ronnie" == Ronnie Diaz <rad91@best.com> writes:

Ronnie> Is it possible to to write files in perl scripts called by a
Ronnie> web page?  I have the following, and its not working (though
Ronnie> it works fine on the shell).

This is a CGI problem, not a Perl problem since you say your Perl code
works.  Read:

http://www.perl.com/perl/faq/perl-cgi-faq.html

and all will be revealed.  THere is an entire newsgroup devoted to CGI
called  comp.infosystems.www.authoring.cgi.  That is the place to post
CGI related problems.

Good Luck 
-jeff




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

Date: Thu, 6 Mar 1997 13:27:54 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Tim Lorge <inoculation@lorge.com>
Subject: Re: FREE Virus Alert Newsletter
Message-Id: <Pine.GSO.3.95q.970306132646.26783G-100000@kelly.teleport.com>

On Wed, 5 Mar 1997, Tim Lorge wrote:

> From: Tim Lorge <inoculation@lorge.com>
> Newsgroups: comp.lang.pascal.misc, comp.lang.perl.misc,
>     comp.lang.perl.modules, comp.lang.smalltalk, comp.lang.tcl,
>     comp.lang.vrml

> ...6 to 9 NEW computer viruses are discovered EVERY SINGLE DAY??

Are they written in Perl, or did you post to this newsgroup by mistake?

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Thu, 6 Mar 1997 13:24:56 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael Stearns <mstearns@darkwing.uoregon.edu>
Subject: Re: Getting Started with Sockets
Message-Id: <Pine.GSO.3.95q.970306132419.26783E-100000@kelly.teleport.com>

On Thu, 6 Mar 1997, Michael Stearns wrote:

> use socket;

> Can't locate socket.pm in @INC at script2 line 3.

I think you wanted 'use Socket;', with the capital S. Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 6 Mar 1997 21:08:10 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: HELP - Removing Carriage Returns
Message-Id: <5fnbnq$lbi@fridge-nf0.shore.net>

Allan (asp@enterprise.net) wrote:

: I am receiving som data from an HTML form <textarea>.  When the
: contents of the form <textarea> are submitted the data is extracted no
: problem, but I want to be able to remove any carriage returns from the
: text and concatenate the info to make just one long line.

$line = "This\nis\nthe\nword\n";
$line =~ s/\n/ /g;

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Thu, 6 Mar 1997 21:56:39 GMT
From: jgd@cix.compulink.co.uk ("John Dallman")
Subject: Re: Installing Perl for Win32
Message-Id: <E6n6AF.LKy@cix.compulink.co.uk>

Daniel Mills <dmills@riag.com> asked:

> Has anyone installed the Perl port for Win32 systems done by ActiveWare?

Yes, thousands of people have. See the FAQ, noted in the sig:

> I've attached the bat file if anyone cares to take a look.

It didn't make it.

John Dallman, jgd@cix.co.uk. A micro-FAQ on things I keep getting asked: 
#!perl is at ftp://.../CPAN/ports/msdos/tips-tricks/hbp_403.zip, BigPerl 
for MS-DOS can be found in CPAN via http://www.perl.com, Perl for NT/Win 
95 can be found at http://www.activeware.com, with an excellent FAQ file 
at http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html and 
no, I don't have the slightest idea what's wrong with your CGI script.


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

Date: 06 Mar 1997 15:08:29 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: nik@coconut.blueberry.co.uk (Nik Clayton)
Subject: Re: keys() on a map() fails. Why?
Message-Id: <8crahsvfky.fsf@gadget.cscaper.com>

>>>>> "Nik" == Nik Clayton <nik@coconut.blueberry.co.uk> writes:

Nik> FWIW, I'm trying to shrink down the following one liner,

Nik>     /usr/local/bin/perl -e \
Nik>         'chomp($_=<>);%_=map{$_=>1}split(/:/);print join(":",keys %_);'

Nik> (which, for those that are interested, takes a ':' delimited string, say,
Nik> $PATH, and returns the same string with duplicate elements removed).

	perl -e 'print join ":", grep !$s{$_}++, split /:/, $ENV{PATH}'

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 543 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Thu, 06 Mar 1997 23:39:46 GMT
From: matt@callnet.com (Matthew Ahrens)
Subject: Re: making large perl CGIs run faster
Message-Id: <3325557a.427030817@news.alt.net>

On Wed, 05 Mar 1997 17:44:53 -0800, Conrad Damon
<damon@netserver.stanford.edu> wrote:

>I've looked at a few ways to make things more efficient and was
>wondering if there's any general consensus, words of advice, etc. The
>most interesting possibilities are FastCGI (run a script as a daemon)
>and mod_perl (perl interpreter within Apache). Do people have a
>preference, or does it depend on what the script is doing?
>
personally, I am using and liking mod_perl.

>It looks like both of those will be a lot easier with a perl that has
>the sfio library. Will 5.004 have that by default? The questions I have
>about FastCGI and mod_perl are:
>
>Will scripts need to be rewritten?
if you use sfio, not really. If you write good code to begin with (like 'use
strict') then the modifications should be minimal.

>Can perl modules be accessed easily?
yes

>Do I need to build a special version of perl?
no.



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

Date: 06 Mar 1997 13:51:53 -0800
From: Russ Allbery <rra@cs.stanford.edu>
Subject: Re: Making sure 'perl -v' works
Message-Id: <qumohcw7kp2.fsf@cyclone.stanford.edu>

Craig Berry <cberry@cinenet.net> writes:
> Bill (bill@sover.net.no.junkmail) wrote:

>> Look for a binary called "perl5".  I've seen ISP's that encourage the
>> use of Perl 4 but also have Perl 5 available for those that really want
>> it.

> Just out of curiosity, what benefit would an ISP gain through doing
> this?  In other words, why encourage use of a 'backlevel', unsupported
> version of Perl?  Presumably they have some good reason.

Often it's not so much that they're encouraging the use of Perl 4 as it is
that their customers have a lot of Perl 4 scripts written and running
which assume that /usr/bin/perl is version 4 and would break under version
5.  They've therefore installed version 5 as perl5 to avoid breakage.

-- 
Russ Allbery (rra@cs.stanford.edu)      <URL:http://www.eyrie.org/~eagle/>


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

Date: 6 Mar 1997 22:20:34 GMT
From: millerb@pt9546.ped.pto.ford.com (Bryan Miller)
Subject: Re: Perl -- compiled? C converter?
Message-Id: <5fnfvi$1j22@eccws1.dearborn.ford.com>

John Goerzen (jgoerzen@happy.cs.twsu.edu) appears to have written:
>In any case, I am very interested in the C code.  I checked the PERL FAQ at
>www.perl.com and it stated that there was no way to make C code from Perl.
>Yet Wall's book seems to indicate that just that thing is possible.  I would
>obviously tend to believe the book over the FAQ :-)

>So...where can I find this sort of thing?

Take a look at the FAQ again and look for the mention of
Maclom Beattie's Perl Compiler.  Perhaps your FAQ is terribly
old...

Bryan


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

Date: Thu, 06 Mar 1997 15:17:39 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: Barry G Reville <breville@uoguelph.ca>
Subject: Re: Perl5 references question
Message-Id: <331F5093.3C91@egames.com>

Barry G Reville wrote:
>         How do you dereference an array reference once its part of an array?
> I know how to dereference under normal circumstances
>         eg - $arrayref = \@array;
>                 @newarray = @$arrayref;
> If the reference is part of an array itself..
>         eg - @refarray = ($arrayref,$arrayref2);
>                 @newarray = ?????;

@newarray = @{ $refarray[0] };

You probably should read Camel Ch.4 again.

HTH
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"Sometimes you just have to step in it and see if it stinks"  O-
    -- Sonia Orin Lyris




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

Date: 6 Mar 1997 21:35:58 GMT
From: lparillo@newshost.li.net (Parillo)
Subject: Re: PerlIS+Win32::ODBC - Can't call method "Sql"...
Message-Id: <5fndbu$mml@linet06.li.net>

I got the same thing when I put the open and the select in two different 
subroutines. Don't know if this helps, I am a newbie also.

Dirk Leas (dirkl@midak.com) wrote:
: I have a simple script that executes fine under perl.exe, but under
: perlIS I get the error:  "Can't call method "Sql" without a package or
: object reference at c:\work\scripts\getCourseList.pl line 15.".

: I've checked the FAQ, but still a newbie, so be gentle ; - )

: Adios,
: Dirk


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

Date: 6 Mar 1997 21:23:17 GMT
From: hunterk@lace.colorado.edu (Kendall S Hunter)
Subject: Question about floating point math w/perl
Message-Id: <5fnck5$ak4@lace.colorado.edu>

I am trying to use perl for numerical data reduction. I have three output
files which are of the same lenght, are composed of two rows of numbers,
and each have time as the first field. I open them, then do the following:

(open lines are of the form:
  open( BRAD,"< BRAD.1" ) || die "can't open BRAD.1: $!\n";
)

while ( <PDEC> ) {
  ($time,$dec) = $_ =~ /^\s+(\.\w+E[+-]\w+)\s+(\w*\.\w+)/;
  $tmp = <BRVL>;
  ($vel) = $tmp =~ /^\s+\.\w+E[+-]\w+\s+([-]*\w*\.\w+[-]*\w*)/;
  $tmp = <BRAD>;
  ($rad) = $tmp =~ /^\s+\.\w+E[+-]\w+\s+(\w*\.\w+)/;

  $integ = $dec*$vel/$rad^(3.*1.27-2.);

  printf "%.3f %.3f\n",$time,$integ;
}

I use PDEC to find the time, then ignore it in the next two matches; I then
need to calculate $integ, a quantity I will numerically integrate using a 
fortran routine. 

My problem:
$integ is an integer. In addition, when $vel is negative, $integ = 4294967292.

Is there a fix?

Thanks - feel free to reply to this group or to me via email.

Kendall Hunter <hunterk@engine.colorado.edu>


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

Date: Thu, 6 Mar 1997 23:00:01 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: question regarding linking two perl files
Message-Id: <E6n981.6Iy@bcstec.ca.boeing.com>

In article <331CDA99.5ED5@mail.amsinc.com>,
Patrick Quinn  <patrick_pquinn@mail.amsinc.com> wrote:
 >  My name is Patrick Quinn and I work for American Management Systems in
 >  Fairfax, Virginia and currently I am coding a real-time overall testing
 >  program.  I have ran into a barrier while coding my test program.  I two
 >  perl source files.  A main, and a source file containing nothing but
 >  subroutines.  My question is how to have my main program calls the
 >  subroutines not in the main program but in the second subroutine file
 >  for both Unix and NT development.  If anyone has answers to this
 >  question, please let me by responding to this news message or by
 >  emailing directly and patrick_quinn@mail.amsinc.com.
 >  

Sounds like "require" will work for you. 

  require "/path/soure_file";    # make last line: 1; 


I believe this'll work... even on NT.


HTH,

--
Charles DeRykus
ced@carios2.ca.boeing.com


  



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

Date: Thu, 06 Mar 1997 10:56:32 -0500
From: Ramon Castillo <rcastill@icix.net>
Subject: Re: Re Help Me Please obscene poster avoiding
Message-Id: <331EE930.17D8@icix.net>

christop@ozinter.co.jp wrote:
> 
> > I'm trying to learn enough perl to modify a script called WWWBoard (by
> > Matt Wright, who I've tried to contact -- unsuccessfully) in order to
> > hide any/all obtainable user info in the posted messages, to try to help
> > catch anonymous posters of obscene msgs.
> 
> Sorry - I can't find the original message in my newsfeed only on
> altavista so I requote here..
> 
> The way I get round this is to use Selena Sol's mailing list manager to
> make the board subscription only.  Just using authentication allows
> people to subscribe with fake email addresses - we require that someone
> hits the subscribe button to get the passwords emailed to them.  If it
> turns out they're being naughty and not playing by the rules then we add
> their email to a bad_list.  When the subscribe button is pressed if the
> email submitted matches one in the badlist then an "Internal
> Misconfiguration Error" is given.. Every so often (ie after an
> "offender" incident) we change the passwords and mass mail to everyone
> on the board the new passwords and username to get in.  Works great.
> 
> If anyone has a more elegant solution I'd be dead happy to read it
> though.
> 
> Christopher
> 
> http://www.wonderlandinorbit.com


How you force a misconfiguration error happens?

RC


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

Date: Thu, 06 Mar 1997 17:12:33 -0500
From: Michael Shannon <mshannon@lds.com>
Subject: Stored Procedures For ORACLE
Message-Id: <331F4151.7BB5@lds.com>

Hi,

I am attempting to run a perl script that will will invoke an Oracle
stored procedure and return results of the stored procedure through an
IN/OUT variable that is passed as a parameter to the procedure. I know
there are examples for using straight SQL but I have not seen anything
for stored procdures. Can anyone give me some direction on this or
better yet an example, if in fact it can be done?

Thanks...Mike


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

Date: 7 Mar 1997 00:07:29 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Subroutine Source?
Message-Id: <5fnm81$mcd$1@news.eecs.umich.edu>

 [ mailed and posted ]

In article <5fk372$na6$3@csnews.cs.colorado.edu>,
Tom Christiansen  <tchrist@mox.perl.com> wrote:
>In comp.lang.perl.misc, jreed@itis.com (Jason Red) writes:
>:Is there any way, in the middle a script, to see the perl code associated
>:with a subroutine? (particularly if the sub was defined in the middle of
>:an eval?)
>
>Nope.
>

Well, one *can* pretend to be the debugger, and grep through @DB::dbline,
if one is desperate and fears not ugliness.

 - Sarathy.
   gsar@umich.edu


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

Date: Thu, 6 Mar 1997 19:41:00 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: unprompted listen for <STDIN>
Message-Id: <E6n00D.Fr9@bcstec.ca.boeing.com>

In article <5fkbpe$cui$1@news.electrotex.com>,  <snowbd@snowbd.com> wrote:
 > 
 >  I need to break out of a subroutine in which I do not prompt for input. 
 > Basically, I need something to work like
 > 
 > sub foo
 > {
 > until (<STDIN>) 
 > {
 > BLAH;
 > BLAH;
 > do a lot of stuff w/out asking for input;
 > }
 > }
 > but this still waits for input because of the reference to STDIN.
 > 

Hm, perhaps something like this, e.g.


sub foo {
  my $rout = my $rin = "";
  my($nfound, $input, $buf, $been_there_done_that, $slept);
  my $timeout = 60;

  vec($rin, fileno(STDIN), 1) = 1;
  do  {
      ($nfound) = select($rout = $rin, undef, undef, 0);  # poll
      if ($nfound) {
         sysread(STDIN, $buf, $nfound);
         $input .= $buf;
         return $input if $buf eq "\n";    # got a line's worth
       }
       unless ($been_there_done_that) {   # do lots of other stuff
          # do lots of other stuff
          $been_there_done_that = 1;
       }
       sleep 1;    # see "select" for shorter sleep 
       $slept++
    } until $slept == $timeout; 
 }
 return undef;
}



HTH,

--
Charles DeRykus
ced@carios2.ca.boeing.com


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

Date: 06 Mar 1997 22:14:47 +0000
From: bhoylma@advtech.uswest.com (Bruce W. Hoylman)
Subject: Re: WANTED: SCRIPT
Message-Id: <yz2lo80vfag.fsf@dazzle.advtech.uswest.com>


How much $$$ you got?  Sheesh ...

-- 
  Bruce W. Hoylman (303-541-6557) -- bhoylma@advtech.USWest.COM ._ 0  
   -     __0    Speaking for myself...        /\/\    /\       /  //\.
-  - - _-\<,_   "Please saw my legs off".    /~/~~\/\/~~\     '  \>> |
 -  __(_)/_(_)_____________________________/\ /    \ \/\ \________\\ `_


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

Date: 6 Mar 1997 22:15:16 GMT
From: rstec@ix.netcom.com(RICH STEC)
Subject: Win32::NetAdmin Question
Message-Id: <5fnflk$qs4@sjx-ixn10.ix.netcom.com>

I'm trying to use PERL to generate various reports on my NT domain user
population.

Using PERL's Win32::NetAdmin::UserGetAttributes, I can pull items such
as a user's home-directory, comment field, etc; while using Dave Roth's
version of UserGetAttributes, I can additionally pull full-name. Great.
However, I'd like to be able to report on additional items such as user
workstation assignments, last-logon, password last-set, etc, all of
which are available in NT's 'net user' command. I'd use 'net user', but
'net user' only allows you to see users in the domain where your
workstation is registered, and I need to cross several domains from a
single spot (UserGetAttributes does work in remote domains
successfully). 

Does anyone know of a way for PERL to grab this additional user info?
Any and all help is appreciated. Thanks.



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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". 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". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 66
************************************

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