[12142] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5742 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 21 12:08:33 1999

Date: Fri, 21 May 99 09:00:26 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 21 May 1999     Volume: 8 Number: 5742

Today's topics:
    Re: CGI : transferring a whole file <airman@inreach.com>
    Re: CGI : transferring a whole file <jdporter@min.net>
        CGI/DBI Interaction Oddity <drew.taylor@gtri.gatech.edu>
    Re: check pop3 with perl? <ludlow@us.ibm.com>
    Re: conditional regexp matching. Please advise. <ravik@cyrix.com>
    Re: DBD Oracle <rhrh@hotmail.com>
        DBI, MySQL DBD and Active State Perl <craig@mathworks.com>
    Re: DBI, MySQL DBD and Active State Perl <craig@mathworks.com>
    Re: DBI, MySQL DBD and Active State Perl <drew.taylor@gtri.gatech.edu>
        Dereferencing a filehandle. <keithp@comnet.ca>
    Re: Dynamic Thumnail Generation?? (Peter Rowell)
    Re: HASH AND ARRAY <kensai@nortel.com>
    Re: How about two arrays? [Was: Blasting array into has (M.J.T. Guy)
    Re: Making executables from .pl files? <jhecker@iago.nac.net>
        Need help <postbus@suzy.demon.nl>
    Re: Need help <brad@wcubed.net>
        Need Perl interpreter (anonymous)
    Re: Perl "constructors" <jdporter@min.net>
    Re: Perl "constructors" <jdporter@min.net>
    Re: Perl "constructors" <garethr@cre.canon.co.uk>
    Re: Perl compiler...If or when <corus@my-dejanews.com>
    Re: Perl Programmer needed for special program <jdf@pobox.com>
    Re: Perl, Oracle8i and CLOBs <jhecker@iago.nac.net>
        Perlets, Exceptions (Juho Cederstrom)
        Process pipe output immediately? <occitan@esperanto.org>
    Re: Regular expression ? <anand@my-dejanews.com>
    Re: Seek on STDIN? <asharka@my-dejanews.com>
    Re: Setting the env. / oraperl question (Tad McClellan)
        SOLVED: error passing a CGI object to a function in a p <bwlang@genome.wi.mit.edu>
        Sorting arrays using values from two arrays <andrew_long@andrews-models.com.au>
    Re: Sorting arrays using values from two arrays <jdf@pobox.com>
    Re: stripping text with regex <jdf@pobox.com>
    Re: stripping text with regex <dgris@moiraine.dimensional.com>
    Re: stripping text with regex <anand@my-dejanews.com>
        Usin IF gives Internal Server Error?? <airman@inreach.com>
    Re: wait(), zombies, and solaris: why won't my children (Charlie Stross)
    Re: What's wrong with this hit counter? (Larry Rosler)
        Which Perl programming book should I buy? (anonymous)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 21 May 1999 06:35:30 -0700
From: LEB <airman@inreach.com>
Subject: Re: CGI : transferring a whole file
Message-Id: <37456122.2F9EC84A@inreach.com>

Hope this helps. I included some script to create directories if you need
to. The 755 part does a chmod on the directory.

mkdir("/newdir/dirname, 0755) || &error("Can't make /newdir/dirname");


open (OUT, ">/images/main_bnr.gif") || &error("Can't open
/images/main_bnr.gif");
open (IN, "</newdir/dirname/main_bnr.gif") || &error("Can't transfer to
/newdir/dirname/main_bnr.gif");
print OUT <IN>;
close IN;
close OUT;


bernard menez wrote:

> Hi all, I want to write a CGI script that would send back a binary file.
>
> My problem is that I want to send it as a whole ... I do not want
> something
> like this :
> @lines=<file>;
> foreach $line (@lines)
> { print "$line"; }
> I'm using a windows environment. If I was using Unix, I guess I could do
>
> something like :
> $data='cat file';
> print "$data";
> Could anyone tell me how I can do something like this ?
> Thanks in advance.
>
>     Bernard



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

Date: Fri, 21 May 1999 14:30:32 GMT
From: John Porter <jdporter@min.net>
Subject: Re: CGI : transferring a whole file
Message-Id: <7i3qm9$sem$1@nnrp1.deja.com>

In article <37454B8C.4A886FD6@chez.com>,
  parpaille@chez.com wrote:
> Hi all, I want to write a CGI script that would send back a binary
file.
>
> My problem is that I want to send it as a whole ... I do not want
> something
> like this :
> @lines=<file>;
> foreach $line (@lines)
> { print "$line"; }
> I'm using a windows environment. If I was using Unix, I guess I could
do
>
> something like :
> $data='cat file';
> print "$data";

If the idea is to get the entire contents of the file into a variable,
the easiest way is to turn off the feature of <> which splits the
input into "lines"; and the way to do that is to set the special
variable $/ to undef.  Read about this variable in the section of
the decumentation called perlvar.  Anyway:

open F, "< $file" or die "open $file: $!";
binmode F;  # this is critical, on windows platforms!
local $/ = undef;
$data = <F>;  # gets it all at once
close F;

Hope this helps.
--
John Porter
Put it on a plate, son.  You'll enjoy it more.


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


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

Date: Fri, 21 May 1999 10:37:05 -0400
From: Drew Taylor <drew.taylor@gtri.gatech.edu>
Subject: CGI/DBI Interaction Oddity
Message-Id: <37456F91.43053F2A@gtri.gatech.edu>

Has anyone else encountered this weirdness?

I've been moving some perl CGI scripts that access a MySQL
database via DBI from a Linux system to an NT system.  Under
Linux, I have the scripts print out the content-type & get
the parameters first, then connect to the database; that
seems to work fine.  But under NT, I have to move the
DBI->connect statement before the CGI stuff for them to
work; otherwise, they just stop after the DBI->connect
statement.

I've fixed the problem, so it's not urgent, but I'd still
like to know, in case it's symptomatic of a bigger issue.

If it helps, the version of perl running on the Linux system
calls itself 5.004_04 for i386-linux and the version of perl
running on the NT system calls itself version 5.005_03 built
for MSWin32-x86-object.

Thanks,

Drew


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

Date: Fri, 21 May 1999 08:34:05 -0500
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: check pop3 with perl?
Message-Id: <374560CD.715276D2@us.ibm.com>

Holger Kasten wrote:
> 
> is there any known way, to check a pop3
> account using a perl-script?

Yes, and there's even modules to make it easier for you.  Check CPAN.

-- 
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)


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

Date: Fri, 21 May 1999 08:12:03 -0500
From: Ravi Kumar <ravik@cyrix.com>
Subject: Re: conditional regexp matching. Please advise.
Message-Id: <37455BA3.AC9E837@cyrix.com>

> [from previous post]
> set addr 0x10000 data deadbeefh bytes 0xff expect bab009h
>
> The regexp would be like so
>
> /set\s+address\s+(**)\s+data(**)\s+bytes\s+(**)\s+expect\s+(**)/
> Obviously I want $1-$4 to contain the numbers without the 'h' and
> the '0x'.

I have several of these region1-2-3 combinations in a single line. I want
to track them all in a single regexp. Please see above example. In lex-yacc
I'd go like so (hamming here. ..)
SENTENCE:
    ACTION ADDRESS HEXNUM DATA HEXNUM BYTES HEXNUM EXPECT HEXNUM
;
ACTION:
    SET {...}
|
  RESET {...}
;

HEXNUM:
   ZEROXHEXNUM
|
   HEXNUMH
;

 .. and appropriately define ZEROXHEXNUM and HEXNUMH.

How can I do this in perl with a single regexp? Why a single regexp?
Convinience
and the hope that it can indeed be done using some manipulation of the ?! or
?=
operations.
[..]

> Which, of course, can be rephrased "capture region2 iff (region1 XOR
> region3)", which immediately translates into Perl:
>
> /region2/ if /region1/ ^ /region3/;

--
Cheers,
--ravi, (ravik,8643)





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

Date: Fri, 21 May 1999 14:31:38 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: DBD Oracle
Message-Id: <3745603A.6E8181AB@hotmail.com>

Pavel Kotala wrote:
> 
> Can I explicitly close Oracle cursor? Does it $sth->finish?
> 

Yes, $sth->finish closes the cursor,
you probably should be closing cursors explicitly all the time, 
though if this is just a habit rather than essential i couldnt say.
Richard H


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

Date: Fri, 21 May 1999 10:01:31 -0400
From: Craig Ciquera <craig@mathworks.com>
Subject: DBI, MySQL DBD and Active State Perl
Message-Id: <3745673B.41CAA382@mathworks.com>

Hello,

Anyone using DBI, And the MySQL DBD driver with the Active State
distribution (5.09 or 5.15)????

If so, can you provide information on how you did it??

Craig



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

Date: Fri, 21 May 1999 10:21:57 -0400
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: DBI, MySQL DBD and Active State Perl
Message-Id: <37456C05.C908A7BB@mathworks.com>

Solved!!!

ppm to the rescue:

ppm install http://www.mysql.com/Contrib/ppd/DBD-mysql.ppd

In case anyone else is interested.

Craig

Craig Ciquera wrote:

> Hello,
>
> Anyone using DBI, And the MySQL DBD driver with the Active State
> distribution (5.09 or 5.15)????
>
> If so, can you provide information on how you did it??
>
> Craig



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

Date: Fri, 21 May 1999 10:24:39 -0400
From: Drew Taylor <drew.taylor@gtri.gatech.edu>
To: Craig Ciquera <craig@mathworks.com>
Subject: Re: DBI, MySQL DBD and Active State Perl
Message-Id: <37456CA7.85B78A4E@gtri.gatech.edu>

Craig Ciquera wrote:
> 
> Hello,
> 
> Anyone using DBI, And the MySQL DBD driver with the Active State
> distribution (5.09 or 5.15)????
> 
> If so, can you provide information on how you did it??
> 
> Craig


Here's how I did it.  Go to your \Perl\bin directory and run
ppm.  Type install DBI.  Then type this:

install
http://mysql.he.net/Downloads/Contrib/ppd/DBD-mysql.ppd

That'll install the MySQL DBD.

Drew


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

Date: Fri, 21 May 1999 10:24:24 -0400
From: "Keith" <keithp@comnet.ca>
Subject: Dereferencing a filehandle.
Message-Id: <7i3q8b$ccp$1@bmerhc5e.ca.nortel.com>

Can anyone tell me how to show the value of a filehandle in my output?
I have something like this:
print "FILE: $_\n";

Where FILE is the filehandle defined earlier in the program.
I want FILE to show up as the real file name.
Thanks,




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

Date: 21 May 1999 07:59:20 -0700
From: thirdeye@sonic.net (Peter Rowell)
Subject: Re: Dynamic Thumnail Generation??
Message-Id: <7i3sc8$p6a@bolt.sonic.net>

In article <7i2p53$d2m$1@carroll.library.ucla.edu>, bob <bob@bob.com> wrote:
>Does anyone know if there is a perl script or equivalent way to create
>'thumbnails on the fly'...any help is very much appreciated.

I suspect you want the GD module (currently rev 1.19, I believe).
>From the documentation (from 1.14), I find:

GD::Image::copyResized(sourceImage,dstX,dstY,srcX,srcY,destW,destH,srcW,srcH)

    This method is similar to copy() but allows you to choose different
    sizes for the source and destination rectangles. The source and
    destination rectangle's are specified independently by (srcW,srcH)
    and (destW,destH) respectively. copyResized() will stretch or shrink
    the image to accomodate the size requirements.

    Example: 

            $myImage = new GD::Image(100,100);
            ... various drawing stuff ...
            $srcImage = new GD::Image(50,50);
            ... more drawing stuff ...
            # copy a 25x25 pixel region from $srcImage to
            # a larger rectangle starting at (10,10) in $myImage
            $myImage->copyResized($srcImage,10,10,0,0,50,50,25,25);

    HTH,
    Peter
    peter@thirdeye.com


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

Date: Fri, 21 May 1999 08:24:35 -0400
From: digital kensai <kensai@nortel.com>
Subject: Re: HASH AND ARRAY
Message-Id: <37455083.BE242D0D@nortel.com>

armchairmillions@hotmail.com wrote:

> In article <7habjt$f5c@news.dns.microsoft.com>,
>
> it would be nice to make:
> while ( ($key,$value) = each (%hash) )
> {
>
> }
>
> come out in alphabetically sorted key order via some keyword besides
> 'each' or by setting some variable.

how about:
my (%myhash, $key);
foreach $key (sort(keys %myhash)){
    # do something with $myhash{$key}
}



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

Date: 21 May 1999 15:01:00 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: How about two arrays? [Was: Blasting array into hash ???]
Message-Id: <7i3sfc$ori$1@pegasus.csx.cam.ac.uk>

Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote:
>Matthew O. Persico <mpersico@erols.com> wrote:
>> 
>> for (@keyArray) {
>>   $hash{$_} = pop @valueArray;
>> }
>
>Why are you taking from the back of @valueArray?
>
>@hash{@keyArray} = @valueArray;
>
>List on the left, list on the right.

Or, if he *really* wants the effect of his sample code

 @hash{@keyArray} = reverse @valueArray;

:-)


Mike Guy


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

Date: Fri, 21 May 1999 13:07:17 GMT
From: Jared Hecker <jhecker@iago.nac.net>
Subject: Re: Making executables from .pl files?
Message-Id: <9Uc13.728$kn3.17717@nntp1>

smnayeem@my-dejanews.com wrote:
> say i name it mail.pl and the exe i make with perl2exe is mail.exe
> what happens is at one stage the following error comes up :

> Global symbol "%NetConfig" requires explicit package name at Net/SMTP.pm
> line 29.

Are you able to run this package with 'use strict'?  Whenever I have had
this problem it is becuase I did not explicitly label a local ('my')
variable.

hth -

Regards,
jh
-- 
Jared Hecker	| HWA Inc. - Oracle architecture and Administration
jared@hwai.com	|  ** serving NYC and New Jersey **


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

Date: Fri, 21 May 1999 17:21:28 +0200
From: "Suzy" <postbus@suzy.demon.nl>
Subject: Need help
Message-Id: <927299951.404.0.pluto.d4ee23d0@news.demon.nl>

Hello,

I need help.
With perl 5 I try to make a script what can convert exchange names to
personal names.

An example:
In exchange the input is:
Name: Maria
Initials: MJ
Last name: Steen-van Buizen
Common Name: Steen-van Buizen van der, MJ Maria

what we want is:
Name: Maria
Initials: MJ
Last name: Steen-van Buizen
Infix: van der
etc

The problem is I can't separate the words in common name for infix. Infix is
an output file. A script has to solve that.
One of the solutions is to delete everything behind the comma and delete the
last name. But how to do that in Perl??

Thanks in advance, a lot....

Greets,

Suzanne




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

Date: Fri, 21 May 1999 09:34:16 -0600
From: Brad Waite <brad@wcubed.net>
Subject: Re: Need help
Message-Id: <37457CF8.266DBF50@wcubed.net>

Here's a quick but messy option:

while(<FILE>){
	if( /^Last name: (.*)/ ){
		$lastname = $1;
		print;
	} elsif( /^Common Name: $lastname (.*),.*/ {
		print "Infix: $1\n";
	} else {
		print;
	}
}

Suzy wrote:
> 
> Hello,
> 
> I need help.
> With perl 5 I try to make a script what can convert exchange names to
> personal names.
> 
> An example:
> In exchange the input is:
> Name: Maria
> Initials: MJ
> Last name: Steen-van Buizen
> Common Name: Steen-van Buizen van der, MJ Maria
> 
> what we want is:
> Name: Maria
> Initials: MJ
> Last name: Steen-van Buizen
> Infix: van der
> etc
> 
> The problem is I can't separate the words in common name for infix. Infix is
> an output file. A script has to solve that.
> One of the solutions is to delete everything behind the comma and delete the
> last name. But how to do that in Perl??
> 
> Thanks in advance, a lot....
> 
> Greets,
> 
> Suzanne

-- 
Brad Waite
W Cubed - The World Wide Web Company


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

Date: Fri, 21 May 1999 15:45:09 GMT
From: quikscor@ix.netcom.com (anonymous)
Subject: Need Perl interpreter
Message-Id: <37457f4b.639307@nntp.ix.netcom.com>

Where's the best place to get a Perl interpreter for Windows 98?  Can
I download one for free from anywhere?

- j


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

Date: Fri, 21 May 1999 14:55:17 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl "constructors"
Message-Id: <7i3s4k$tmj$1@nnrp1.deja.com>

In article <7i2v20$92c$1@nnrp1.deja.com>,
  armchair@my-dejanews.com wrote:
> In article <7i1lsc$c7d$1@nnrp1.deja.com>,
>   John Porter <jdporter@min.net> wrote:
> >
> > char* p = get_some_chars();
> >
> > Is the string that p points to null-terminated?  Is it 8-bit clean?
> > Is it legal SGML?  Maybe get_some_chars actually returns a pointer
> > to some class instance but has cast it to (char*).  How do you know?
>
> If I may use the style of the newsgroup - "this is C++, this isn't C.
We
> use strings in C++, not null terminated character arrays. If you want
to
> program in C, maybe C++ is not for you".

You are highly skilled at missing (or dismissing) my point.


> int var = function();
>
> is var number or a string or an address?
>
> my $var = function();
>
> is $var a number or a string or an address?
>
> >
> > A* p = get_next();
> >
> > Hmm, does p point to a B, or possibly a C?
>
> p is a pointer to an object that consists of at least object A. Not a
> number, not a string.

You sound pretty sure of yourself.

Now lets use more meaningful names, instead of A, B, C:

Object* p = get_next();

// Who can say what p really points to.  It could point to an object
// of any class derived from Object (which in some frameworks is
// *every* class).

Scalar* p = get_next();

// Hmm. Maybe p points to a String, maybe to an Integer.


Container* p = my_things();

// p could point to a Set, a Bag, an OrderedSet, etc. etc.

Are you grokking yet?  "scalar" can be thought of as a superclass
of number and string and reference; and almost all of the time you
only need to deal with the superclass, because almost all of the
methods (get, set) are meaningfully defined in the subclasses.

The "deference" method is not meaningfully defined for all three
subclasses; but the ref() method is there to tell you whether the
scalar is a reference, and what kind.  So you can do this:

	if ( ref($r) =~ /ARRAY/ ) {
		@a = @{$r};
	}
	elsif ( ref($r) =~ /HASH/ ) {
		%h = %{$r};
	}
	elsif ( ref($r) =~ /SCALAR/ ) {
		$s = ${$r};
	}
	else {
		print "$r is not a reference.\n";
	}

Of course, if you blithely try to deref something which turns out
not to be a reference, perl throws an exception:

	eval { # like "try"
		@a = @{$r};
	};
	if ( $@ ) { # like "catch"
		print "problem dereferencing $r: $@\n";
	}

--
John Porter
Put it on a plate, son.  You'll enjoy it more.


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


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

Date: Fri, 21 May 1999 15:06:28 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Perl "constructors"
Message-Id: <7i3spi$u50$1@nnrp1.deja.com>

In article <7i2to7$83g$1@nnrp1.deja.com>,
  armchair@my-dejanews.com wrote:

> I never left C++. Unlike some, I have not yet fallen in love with a
> programming language. But maybe you are right, Perl can only be
> understood by geniuses, where as C++ is the language of the common
man.

ROFL.  The real difference is, C++ is a low-level language, and
Perl is a high-level language.  Each has its strengths, and its
peculiar idiom.  Some aspects of Perl's idiom can seem bizarre to
people who are used to C++ (not to mention toy languages like VB).


> > { local $^W;  some_fancy_non_warning_compliant_code() }
> >
> > Even when you run under -w, not everything has to be "-w safe".
> > Same goes for use strict.
>
> So how do you turn strict off and on?

no strict; # turn off.
use strict; # turn it on again.


> > : my $scalar = myObject->ReturnSomething();
> > :
> > : what does $scalar hold at this moment zenin, number, string or
> > : reference?
> >
> > 	See perldoc myObject
>
> I didn't find it.

The point is, if you want to know what myObject->ReturnSomething()
is supposed to return, you should read the documentation for the
class of which myObject is an instance.  If there is any documentation,
you are likely to be able to read it using the perldoc command.

--
John Porter
Put it on a plate, son.  You'll enjoy it more.


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


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

Date: Fri, 21 May 1999 15:26:07 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: Perl "constructors"
Message-Id: <sizp2yculs.fsf@cre.canon.co.uk>

armchair@my-dejanews.com wrote:
> int var = function();
> is var number or a string or an address?

Why limit the set of types you ask about?

Is 'var' an ASCII character?  A Unicode character?  A year, month or day
number?  A Unix inode number?  A file descriptor?  Today's temperature
(in degrees Fahrenheit)?  Yesterday's temperature?  The exponent of a
new Mersenne prime?  The width of the screen in pixels?  An error code
(0 is success)?  A status code (0 is failure)?  A byte-code instruction?
A 24-bit colour?  An Internet address?

The "type" of data covers all these things and more.  It isn't limited
to types that a particular compiler knows about, or to a set of classes
that the programmer has defined.  Suppose you have a Temperature class:
you still need to know what the temperature represents, when it was
taken, how accurate it is, if it's a spot or an average, (and if so then
if it's a mean or a median and if so of how many samples) - and so on.
All these things are aspects of the data's type.

The C/C++ notion of the type of an object doesn't tell you everything
you need to know about the object.  Often it tells you very little.
It's up to the programmer to give meaning to data by documenting it and
by applying correct operations to it.

-- 
Gareth Rees


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

Date: Fri, 21 May 1999 15:16:29 GMT
From: Corus <corus@my-dejanews.com>
Subject: Re: Perl compiler...If or when
Message-Id: <7i3tcb$uit$1@nnrp1.deja.com>

Thank for your response.

> Which brings me to a point?  Why do *you* want a "compiler"?
> Algorithm hiding is pointless (see below).  Speeding up?  Not
> necessarily.  Portable binary distribution?  Not unless you also
> install all the modules.  Speed up CGI?  Just use mod_perl.
>
> So, why?
I don't hide my *personal* reason for wanting a compiler. (One without
the decompiler)
It is to hide my code from evil eyes. Or at least make it considerably
harder to get at.
If someone has the skills to succesfully de-compile code that wasn't
intended to be "decompileable", then they probably would equally have
the skill to not have resort to doing it.
(In the majority of circumstances)

Perl developers will call me a disgrace to open source software but they
would be doing that from the safety secured for them by their in-depth
knowledge of Perl.
Knowledge that is untouchable by 99.999% of the Perl user community even
if Perl's code is out there for everyone to see and change at their
whim.

A language's or OS's strength lies its popularity. Obviously popularity
is a factor of marketing as well as value that the end-user will attain
from its use.

Even if the OS/language starts its life or *is* a free product, the
developers, if and when their brainchild reaches adulthood will have
lots to gain from it. (Sincerely, congratulations, all the best to them
and lets keep'em coming.)

The same does not apply to a script or application developer mainly due
to the fact that his/her work is usually considerably, to say the least,
less complex as well as much smaller in size, and hence easier to
replicate in either its original form or otherwise.
Irrespective of how well he has tried to legaly safeguard his efforts.

A couple of days ago I saw a guy flamed in a thread in which he had made
enquiries about the "byte code saver" (I'll call it a compiler as I've
come to associate the word with something that sucks source and spits
binary) in the hope that it would safeguard his employer from illicit
copying of proprietary software.
I suppose some of you think of it as being insignificant for a company
trying to make a break in a market as competitive as the net, and
spending thousands of currency units (just being politically correct)
*paying* people like *us* to do work for them, only to find out that the
product of theirs and our efforts was tarred onto a floppy and sold to
their competitor next door by an employee that doesn't know the
difference between a scalar and his socks. (the ones you wear on your
feet no the otherones)

People hard done by Perl in such a way will inevitably seek refuge in a
language whose binaries are a bit more secure.


> Now, if a sugar daddy were to come along and buy someone's time for
> six months, I'm sure we'd see a lot of progress.  If you'd be willing
> to offer, I'll direct you to the right people. :)

"If I were a rich man..."

Not only am I not a rich man, but to make it worse I know of no sugar
daddies or mummies(just being politically correct... Ok.Sorry, you've
had enough of that :) in my immediate vicinity.

However I'm no free loader and as a matter of fact I have an idea that I
am willing to put my money by.

I, personally will pay $5000 for a Perl compiler that will do its best
to make its binaries as hard as "compilably" possible to decompile. And
I'm willing to pay half of it the minute a timeframe for its delivery
has been established.

I realise that $5000 is not enough to cover the development costs of
such a product but I am sure that there are other people out there
willing to pay just as much if not more.

The compiler once complete can be sold as an add-on to the standard Perl
distribution for say $100 a piece with the initial "stake holders"
financially sharing in its success.

I'm not greedy either. Once the initial "stake holders" have received
double their initial investment back, they will have no more
expectations of the "venture" and all subsequent proceeds will go to the
developers.

Obviously this is only a draft of the "deal" but that's the general
idea.


How does it sound? Maybe I'm just too naive.


regards...


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


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

Date: 21 May 1999 09:16:28 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: mike@mindlogic2.com (Mind Logic)
Subject: Re: Perl Programmer needed for special program
Message-Id: <m3iu9m5zrn.fsf@joshua.panix.com>

mike@mindlogic2.com (Mind Logic) writes:

> I've inquired to this newsgroup twice before in the last week with offers of 
> work. I currently have a third project which I'm looking to obtain price 
> quotes for.

Then you're once, twice, three times a bad citizen.  This newsgroup is
for discussion of Perl language issues.  Please restrict job offers to
the jobs newsgroups.  You might check out
http://www.pm.org/mailing_lists.shtml for a mailing list that
specifically targets Perl programmers.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Fri, 21 May 1999 13:04:32 GMT
From: Jared Hecker <jhecker@iago.nac.net>
Subject: Re: Perl, Oracle8i and CLOBs
Message-Id: <ARc13.727$kn3.17717@nntp1>


FWIW -

The only way LOB's are easily manipulated is via PL/SQL or 3GL, though
since Oraperl uses an OCI interface, you might try getting hold of an OCI
(Oracle Call Interface) manual and see how it's handled there.

hth -

Regards,
jh


wvw <wvw@fred.net> wrote:
> Greetings,

> I really need some help getting perl to insert and fetch CLOB's; I have
> the latest and greatest DBI/DBD's from CPAN; I've no problem with other
> types ... just these durn CLOB's.  The workaround I'm using now is to
> call a stored procedure which reads a file and does an insert ... no
> problem ... just cumbersome.

> Short samples of inserts and fetches would be greatly appreciated.

> Thanks,

> wvw@fred.net

-- 
Jared Hecker	| HWA Inc. - Oracle architecture and Administration
jared@hwai.com	|  ** serving NYC and New Jersey **


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

Date: Fri, 21 May 1999 18:00:00 +0300
From: cederstrom@kolumbus.REMOVE_THIS.fi (Juho Cederstrom)
Subject: Perlets, Exceptions
Message-Id: <slrn7kat7g.pv.cederstrom@vortex.cede.net>

Somebody should check what Java Servlets are and program a Perlet
module which would have some kind of same functionality.

1) Java Servlets are a _lot_ faster, even though you use mod_perl.
2) Java Servlets have a great way of saving session info.

And please, lets not fight about which one of these languages is
better, because every one knows that Perl is still better... }:)


PS. Does Perl have exceptions? RTFM? Which FM?

-- 
#!/usr/bin/perl -wT # Please take a look at my mail address when replying
use CGI;$a=reverse"r56%b6%36%16%H02%l27%56%P02%r56%86%47%f6%e6%A02%t37%".
"57%J=japh";$b=new CGI($a);$c=$b->param(lc(reverse("JAPH")));print"$c\n";


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

Date: Fri, 21 May 1999 13:44:47 GMT
From: Daniel Pfeiffer <occitan@esperanto.org>
Subject: Process pipe output immediately?
Message-Id: <7i3o0e$qb3$1@nnrp1.deja.com>

Hi!

While analyzing a strange network nonreaction I sporadically have on one
machine, I found someone too frequently opening connections.  Whenever I
tried to find the corresponding process in the kernel-analyzer crash, it
was already gone.

So I want to write a Perl script that automates this, so that I can
consult crash immediately when tcpdump barks.  My problem is, if I read
in the tcpdump output via a pipe, it will be buffered, making it
useless.  How can I prevent this or what alternatives are there?  I
imagine, this could be achieved with pseudo-terminals, but how do I open
and connect one from Perl?

--
Perl |berallhin:
Perl everywhere:	http://beam.to/iPerl/
Perl ^cien:


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


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

Date: Fri, 21 May 1999 15:27:48 GMT
From: Anand <anand@my-dejanews.com>
Subject: Re: Regular expression ?
Message-Id: <7i3u1g$v1o$1@nnrp1.deja.com>

In article <7i2vs6$9gt$1@nnrp1.deja.com>,
  tvn007@my-dejanews.com wrote:
> Would someone help me with the "bug" in this perl script?

How about taking a miniscule effort in explaining what the "bug" is (or
where the "bug" is) instead of just pasting a huge program for others to
decipher?

Anand


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


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

Date: Fri, 21 May 1999 10:06:29 -0500
From: Al Sharka <asharka@my-dejanews.com>
Subject: Re: Seek on STDIN?
Message-Id: <37457674.62A2@my-dejanews.com>

Ronald J Kimball wrote:
> 
> Al Sharka <asharka@my-dejanews.com> wrote:
> 
> > Ronald J Kimball wrote:
> > > Al Sharka <asharka@my-dejanews.com> wrote:
> > >
> > > > open(README, "zcat $ARGV[0] |") || die "Couldn't fork: $!\n";
> 
> > [...]
> 
> > Thank you.  Now, is there a way to accomplish skipping through
> > $ARGV[1] records without performing a read statement (literally
> > could be a million times), or is that how I have to do it?
> 
> Unzip to a file first.  Then you can seek all you want.  :)

Ah.  Well, since these can be huge(1.5G compressed), and there could be
multiple files, I'll take that as a "no" then.  Thanks for your help.


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

Date: Fri, 21 May 1999 05:02:00 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Setting the env. / oraperl question
Message-Id: <8e73i7.s9f.ln@magna.metronet.com>


[ Followups trimmed. Nothing specific to Oracle in here.  ]


Jared Hecker (jhecker@iago.nac.net) wrote:

: I am planning a script that will have to:

: 2. change an environmental variable and do some work (loop iteration 1,
: ENV=xxx, run scripts; loop iteration 2, ENV=yyy, run scripts; etc.).

: My question is, when I set an environmental variable from perl and then
: use a system call to run another app (in this case SQL*Plus), does the
: environmental variable setting hold for the called app's environment?

: (If it's convenient, e-mail will reach me faster.)


   If it's convenient, writing four lines of code to see what
   happens would have answered your question in less than a minute:


--------------------
#!/usr/bin/perl -w
use strict;

$ENV{foo} = 'foo';
system 'echo $foo' and die 'problem running system()';

$ENV{foo} = 'FOO';
system 'echo $foo' and die 'problem running system()';
--------------------


output:

foo
FOO


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


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

Date: Fri, 21 May 1999 09:03:59 -0400
From: "Bradley W. Langhorst" <bwlang@genome.wi.mit.edu>
Subject: SOLVED: error passing a CGI object to a function in a pm.
Message-Id: <374559BF.C2EB50D4@genome.wi.mit.edu>

solved

this was a tough one to track down.
it turns out that lincoln removed the troublesome
isaCGI function from the latest revision of CGI.pm
(which is not on CPAN, only on his site).

that got rid of the nasty error message i was experiencing.

thanks for everyone's suggestions

brad



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

Date: Sat, 22 May 1999 00:08:23 +1000
From: "News" <andrew_long@andrews-models.com.au>
Subject: Sorting arrays using values from two arrays
Message-Id: <7i3otg$6cj$1@the-fly.zip.com.au>

I am trying to sort an array by using values from another array and then
doing the second ordering of the sorted list.  The arrays are
one-dimensional and always have the same number of elements.

The code I have written is:

sub byrank {
 $out_rank[$a] <=> $out_rank[$b]
 or
 $a <=> $b;
}
@out_sort = sort byrank @out;

which does some sort of sorting, but I can't quite work out exactly what.

As an example if we have
@out_rank={2,2,1,1,2} and
@out={10,20,30,40,50}

I am hoping to get back from @out_sort the following
@out_sort={30,40,10,20,50}

I would be ever grateful for any help




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

Date: 21 May 1999 11:02:15 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: "News" <andrew_long@andrews-models.com.au>
Subject: Re: Sorting arrays using values from two arrays
Message-Id: <m390aicvpk.fsf@joshua.panix.com>

"News" <andrew_long@andrews-models.com.au> writes:

> As an example if we have
> @out_rank={2,2,1,1,2} and
> @out={10,20,30,40,50}
> 
> I am hoping to get back from @out_sort the following
> @out_sort={30,40,10,20,50}

  @out_sort = map { $out[$_] }
              sort { $out_rank[$a] <=> $out_rank[$b]
                     ||
                     $out[$a] <=> $out[$b]
                   }
              (0..$#out);

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: 21 May 1999 09:08:14 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: ainsoph@propaganda-arts.org
Subject: Re: stripping text with regex
Message-Id: <m3lnei605d.fsf@joshua.panix.com>

ainsoph@propaganda-arts.org writes:

> Is it possible to use regex to stip the text off of a string, say a
> first name, and turn it into an initial?

Certainly, and there are many ways to do it.  You should buy yourself
a copy of the book _Learning Perl_.  By the time you're through with
it you'll certainly know at least a couple of ways to do that, and
you'll be better prepared to understand the documentation that you
already have.  If you'd like to dive right into the docs, check out
perlfunc for the substr() bultin, perlre for regular expressions, and
perlop for the substitution and matching operators.  Good luck.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: 21 May 1999 08:19:25 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: stripping text with regex
Message-Id: <m3r9oatsia.fsf@moiraine.dimensional.com>

"Jody Fedor" <JFedor@datacom-css.com> writes:

> Don't you just love the smug answers you get here?

Ask a dumb question, get a dumb answer.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
`There are no stupid questions.  Just stupid people.'
      South Park


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

Date: Fri, 21 May 1999 15:14:22 GMT
From: Anand <anand@my-dejanews.com>
Subject: Re: stripping text with regex
Message-Id: <7i3t8b$ugr$1@nnrp1.deja.com>

In article <fd42i7.0je.ln@magna.metronet.com>,
  tadmc@metronet.com (Tad McClellan) wrote:
> ainsoph@propaganda-arts.org wrote:
> : Is it possible to use regex to stip the text off of a string, say a
> : first name, and turn it into an initial?
>
> : example: chris = c
>
>    No, you need an operator to do that.
>    A regex is not enough.

Warning: Newbie reply.

Why? This regex will do it.

$str="chris";
if ($str =~ /^\W*(.)/) {
  print $1;
}

It prints "c" for me like the original poster wanted.

Anand


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


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

Date: Fri, 21 May 1999 08:49:00 -0700
From: LEB <airman@inreach.com>
Subject: Usin IF gives Internal Server Error??
Message-Id: <3745806C.BBE2A7B5@inreach.com>

When I add the IF statement as below, I start getting Internal Server
Error.??? Any ideas? Without the IF statement, all works fine. I am
trying to say that IF the varialble MEDIAURL is not EMPTY print the
following line to the file.

Thanks for any input.

open(LIST,">$path") || &error("Can't open $path");
print LIST "<HTML>\n";
print LIST "<HEAD>\n";

IF ($mediaurl ne "") {
print LIST "$mediaurl \n";
}

print LIST "TEST \n";
print LIST "</HEAD>\n";
print LIST "<TITLE></TITLE>\n";
print LIST "<BODY>\n";
print LIST "</BODY>\n";
print LIST "</HTML>\n";
close(LIST);



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

Date: Fri, 21 May 1999 15:45:35 GMT
From: charlie@antipope.org (Charlie Stross)
Subject: Re: wait(), zombies, and solaris: why won't my children die?
Message-Id: <slrn7kavuj.ssp.charlie@cs.ed.datacash.com>

Stoned koala bears drooled eucalyptus spittle in awe
as <zenin@bawdycaste.org> declared:

>	Well, if you really, truly don't care what actually happened to your
>	children, you can completely ingore them and never wait() if you
>	set the right sigaction:

Thanks, that worked great. Doesn't work on Linux, of course. Sigh. I
feel an updated release of NetServer::Generic coming on ...


-- Charlie



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

Date: Fri, 21 May 1999 07:12:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: What's wrong with this hit counter?
Message-Id: <MPG.11af099fb7a76543989ad6@nntp.hpl.hp.com>

In article <ebohlmanFC2tnv.1D7@netcom.com> on Fri, 21 May 1999 09:43:06 
GMT, Eric Bohlman <ebohlman@netcom.com> says...
+ Felix <felixtse@crosswinds.net> wrote:
 ...
+ <block>
+ : for(j=0;j<5;j++){
+ : print "<Img Src=\"count$digit[j].gif\" Alt=\"Hit Counter\"
+ : Width=\"20\" Height=\"30\">";
+ : }
+ </block>
+ 
+ replace with:
+   foreach my $digit (@digits) {
+     print qq(<img src="count$digit.gif" alt="" width="20"
+       height="30">);
+   }
+ 
+ 1) Using the qq quote operator, as described in perlop, eliminates the 

+ need to backwhack every single quote.

How about backwhacking every double quote?  Heh, heh, heh.
 
+ 2) Things like graphical hit counters should have empty alt values
+ since they're non-essential and the information can't be conveyed
+ textually; someone using Lynx, for example, really doesn't need to
+ see:
+ 
+ [Hit Counter][Hit Counter][Hit Counter][Hit Counter][Hit Counter]

Why not use alt=$digit (quotes are optional)?

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


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

Date: Fri, 21 May 1999 15:43:57 GMT
From: quikscor@ix.netcom.com (anonymous)
Subject: Which Perl programming book should I buy?
Message-Id: <37457f1c.592487@nntp.ix.netcom.com>


                "Learning Perl" and it's a good intro for me.  I
already program in C++ and Java and am
                familiar with UNIX commands. 

                I haven't purchased "Programming Perl" because of what
I've read in the Amazon
                reviews.  Apparently there's nothing to help me with
the database tasks I want to
                perform.  And it seems to be a good reference book,
but not a good technique book, which
                is what I need.  I may also need to take an OO
approach to what I'm designing, I'm not sure
                at this point. 

                Any suggestions on what Perl programming book I should
buy? 

- j


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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