[9523] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3117 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 10 12:07:31 1998

Date: Fri, 10 Jul 98 09:00:25 -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, 10 Jul 1998     Volume: 8 Number: 3117

Today's topics:
    Re: -w on production code (was Re: better way of gettin (Mike Stok)
    Re: -w on production code (was Re: better way of gettin <*@qz.to>
    Re: -w on production code (was Re: better way of gettin <rra@stanford.edu>
        Arrays - here's the code (The Wildman)
        BEGIN statement and PERL reference book <ffernand@mail.cern.ch>
    Re: Bug? shift( split(' ',$_)); won't compile. <jdporter@min.net>
        CGI file upload problems philc@hempseed.com
    Re: Choosing DBMS: friendly to Linux, Apache, Perl, Jav gordo@pclink.com
    Re: Do I understand this? (steve belczyk)
        forking on win32 <kolovos_ted@prc.com>
    Re: Getting Yesterday's Date (Sitaram Chamarty)
        Help installing DBD-DBI modules (Michael Murphy)
    Re: HELP: Internet Database Design questions... <eppie@interport.net>
    Re: HELP: Internet Database Design questions... (Christopher Thompson)
        How to access the default NT printer wilfwilliams@my-dejanews.com
        IPC::Open2 and Open3 question mmlenz@my-dejanews.com
    Re: my perl object becomes a HASH when I try to use it. Bellas@no.spam.leeds.ac.uk
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 10 Jul 1998 13:57:15 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <6o56jr$brr@news-central.tiac.net>

In article <35aae9c1.8574231@news.tornado.be>,
Bart Lateur <bart.mediamind@tornado.be> wrote:

>Because newbies don't know about -w, while it's the most benificial to
>them. Just look at the PODs. I strongly feel that something that should
>be used by newbies, ought to be the default.

In some book on C I read there was an analogy about sharp knives,
occasionally cutting yourself and how to make a sharp knife safe for the
user while still flexible and convenient for an experienced user.  If I
want a language where I can't hurt myself then I have plenty to chose
from.

To stretch the training wheels analogy, I wouldn't like to have to take
training wheels off my bike for every trip (and I consider things like
environment variables *much* less convenient than adding -w as they're
invisible and hinder portability...) 

There are clearly at least 2 schools of thought on this, I use -w and use
strict to develop and then take -w out, who knows when the style police
will start picking on things I consider useful (I have had data which
might usefully have been qw// quoted which provoked the comma warning, for
example)

If you want to enforce -w cleanness on the user bases I see (web servers
with thousands of scripts contributed by contract content providers using
various levels of perl and contributing to many services) then other jobs
start looking appealing pretty quickly - and the corporation which owns
the clients is firmly focussed on the bottom line.  

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: 10 Jul 1998 15:13:07 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <eli$9807101019@qz.little-neck.ny.us>
Keywords: just another new york perl hacker

In comp.lang.perl.misc, Russ Allbery  <rra@stanford.edu> wrote:
> If you want a predictable runtime environment, you should hard-code the
> version of Perl you're running under into the #! line.
> 
> Seriously.

Not good enough. Quirks in the implementation of underlying system and
library calls can change behavior in obscure ways. Not all systems can
do a truncate(), as an obvious example.

> -- 
> #!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
> $^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
>  00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
> rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print

I had a dream earlier this week about quining JAPHs. All of them were
based on "open 0" obfuscations though. Mine is not a true quine since
the output is different, but if you run that, you get the first one back
-- give or take a newline.

Elijah
------
#!/usr/bin/perl -00-#rekcah lrep NEW YORK rehtona tsuj#_$ esrever ralacs tnirp
open 0;$_=<0>;s/[A-Z\s]*/reverse$&/eg;##;ge/&$esrever/*]s\Z-A[/s;>0<=_$;0 nepo
print scalar reverse $_#just another KROY WEN perl hacker#-00- lrep/nib/rsu/!#


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

Date: 10 Jul 1998 08:16:29 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <m33ec9d9de.fsf@windlord.Stanford.EDU>

Eli the Bearded <*@qz.to> writes:
> In comp.lang.perl.misc, Russ Allbery  <rra@stanford.edu> wrote:

>> If you want a predictable runtime environment, you should hard-code the
>> version of Perl you're running under into the #! line.

>> Seriously.

> Not good enough. Quirks in the implementation of underlying system and
> library calls can change behavior in obscure ways. Not all systems can
> do a truncate(), as an obvious example.

Not good *enough*, no, but it's something that one should do for a stable
environment.  And it would solve the problem of -w giving more warnings
after an upgrade.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 10 Jul 1998 14:14:22 GMT
From: the_wildman_98@hotmail.com (The Wildman)
Subject: Arrays - here's the code
Message-Id: <slrn6qc98a.ncp.the_wildman_98@foobar.net>

If figured it might help if I showed the code that was causing trouble.

# The idea of this code is to avoid duplication. If $event[<current>] matches
# $event[<any of the previous>] then it should determine a new value for
# $event[<current>].

sub f113 {
    # $events is set to 4.
    for ($i = 0;$i < $events;) {
        # &roll(x,y) is a random number generator, simulating x number of y
        # sided dice.
        $dice = &roll(1,100);
        if ($dice <= 5)                 {$event[$i] = 1;}
        if ($dice >= 6 && $dice <= 10)  {$event[$i] = 2;}
        if ($dice >= 11 && $dice <= 20) {$event[$i] = 3;}
        if ($dice >= 21 && $dice <= 23) {$event[$i] = 4;}
        if ($dice >= 24 && $dice <= 25) {$event[$i] = 5;}
        if ($dice >= 26 && $dice <= 27) {$event[$i] = 6;}
        if ($dice >= 28 && $dice <= 31) {$event[$i] = 7;}
        if ($dice >= 32 && $dice <= 34) {$event[$i] = 8;}
        if ($dice >= 35 && $dice <= 37) {$event[$i] = 9;}
        if ($dice eq 38)                {$event[$i] = 10;}
        if ($dice >= 39 && $dice <= 41) {$event[$i] = 11;}
        if ($dice >= 42 && $dice <= 44) {$event[$i] = 12;}
        if ($dice >= 45 && $dice <= 48) {$event[$i] = 13;}
        if ($dice >= 49 && $dice <= 50) {$event[$i] = 14;}
        if ($dice >= 51 && $dice <= 53) {$event[$i] = 15;}
        if ($dice >= 54 && $dice <= 55) {$event[$i] = 16;}
        if ($dice eq 56)                {$event[$i] = 17;}
        if ($dice eq 57)                {$event[$i] = 18;}
        if ($dice >= 58 && $dice <= 62) {$event[$i] = 19;}
        if ($dice >= 63 && $dice <= 64) {$event[$i] = 20;}
        if ($dice >= 65 && $dice <= 69) {$event[$i] = 21;}
        if ($dice >= 70 && $dice <= 75) {$event[$i] = 22;}
        if ($dice >= 76 && $dice <= 81) {$event[$i] = 23;}
        if ($dice >= 82 && $dice <= 85) {$event[$i] = 24;}
        if ($dice eq 86)                {$event[$i] = 25;}
        if ($dice >= 87 && $dice <= 88) {$event[$i] = 26;}
        if ($dice >= 89 && $dice <= 93) {$event[$i] = 27;}
        if ($dice eq 94)                {$event[$i] = 28;}
        if ($dice >= 95 && $dice <= 99) {$event[$i] = 29;}
        if ($dice eq 100)               {$event[$i] = 30;}
        if ($i eq 0) {
            $i++;
        } else {
            for ($j = 0;$j < $i;$j++) {
                if ($event[$i] == $event[$j]) {
                    last;
                }
                # this line works as expected
                print $i," ",$event[$i],"/",$j," ",$event[$j],"\n";
            }
            $i++;
        }
        # $event[$i] prints as a null value right here, which is what led me
        # to believe I was doing arrays totally wrong.
        print $i," ",$event[$i],"\n";
    }
}


-- 
The Wildman - wildman at microserve dot net
Do NOT reply to this post! All mail sent to the From/Reply-To will be
considered spam, and handled appropriately.
Fight spam - http://www.cauce.org/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/MU d- s: a- C++ UL+ P+ L+++ !E W-- N+++ o !K w--- !O !M V-- PS PE Y+ PGP?
t+ 5+ X R tv b++ DI+ D++ G e h---- r++++ y++++
------END GEEK CODE BLOCK------


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

Date: Fri, 10 Jul 1998 15:39:35 +0200
From: Felix Fernandez <ffernand@mail.cern.ch>
Subject: BEGIN statement and PERL reference book
Message-Id: <Pine.HPP.3.95a.980710153707.21725R-100000@haifa.cern.ch>


I'm posting this message for a friend who has problems for posting in this
news group, you could answer him directly or do a reply to this message.

Thank you very much in advance.

_______________________________________________________________________
1. Could somebody give me a good explanation about BEGIN. It's really a
PERL statement? What is it used for ??

2. I am looking for a good book on PERL available on the net for free
use but I can't find it. Can somebody give the address of a good
PERL reference book ??


Thanks in advance.

Please, 
E-mail to: cdelvil@ribera.tel.uva.es
________________________________________________________________________


------/THY WILL BE DONE/------------- Felix



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

Date: Fri, 10 Jul 1998 15:44:23 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Bug? shift( split(' ',$_)); won't compile.
Message-Id: <35A6389B.8D1@min.net>

Ronald J Kimball wrote:
> 
> Perl is telling you exactly why it doesn't compile.  What does that say?
> shift modifies its argument, so it needs a named array, not an anonymous
> one.

No, it needs an array, not a list.
Anonymous arrays work fine:
	$x = shift @{[ split ]};

-- 
John Porter


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

Date: Fri, 10 Jul 1998 14:30:39 GMT
From: philc@hempseed.com
Subject: CGI file upload problems
Message-Id: <6o58ih$7nk$1@nnrp1.dejanews.com>

I'm trying to write a program to handle the file upload HTML form, but it's
not consistent when it works. Here's the code i have written so far:
-----------------------------------------------------------------------
#!/usr/local/bin/perl

# this script runs on a Windoze95 box with ActiveState perl build 316
# standard CGI lib
use CGI qw(:standard);
# a few subroutines are defined in this.
require "CLUtils.pl";

# server path is C:\windows\desktop\public-html\CodeLibrary\
# the DIR parameter is something like "Development\Accounting\TestProject"
# DIR never ends with a "\"
$path = &serverPath . &param("DIR");

# FILE is the file uploaded
# Remember, this is a file handle, too.
$name = &param('FILE');

# gets the local name
@temp = split(/\\/, $name);

# just in case it ends in a "\"
unless($localName = $temp[@temp])
{
	$localName = $temp[(scalar @temp) - 1];
}

# &followsSyntax makes sure it doesn't have any forbidden chars
# returns 0 if it does, while outputting an HTML error page...else returns 1
if(&followsSyntax($localName))
{
	# chr(92)-- I was getting regexp errors with '\\' and /\\/
	# opens a new filehandle for the local copy of the file
	open (OUTPUT, '>' . $path . chr(92) . $localName );
	# saves the file in the appropriate place
	while(read($name, $buffer, 1024))
	{
		print OUTPUT $buffer;
	}
	# goes back to the original calling script
	print "Location:	/cgi-bin/View.pl?WHERE=" . &param('DIR') .
"\n\n";
}
---------------------------------------------------------------------------

I'm sure it's obvious to the more experienced perl-ists here that i'm not very
well-versed in perl...:-)

The problem with this script is that it sometimes works, and sometimes
doesn't. If the directory for the file to be saved in is

C:\...etc...\Development\Claims\TestProject

it won't work. However, if i create a sub-directory like this:

C:\...etc...\Development\Claims\TestProject\uploads

and upload there, it usually does work (sometimes it doesn't the first time,
but trying again, it does!?!?!)

Really, nothing changes or is different about a successful upload vs. an
unsucessful one....

I'd appreciate any help...
Thanks in advance...

-phil

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 10 Jul 1998 14:44:48 GMT
From: gordo@pclink.com
Subject: Re: Choosing DBMS: friendly to Linux, Apache, Perl, Java
Message-Id: <6o59d0$8nl$1@nnrp1.dejanews.com>

Thanks. Do you know anything of INterbase's history and product development
trajectory?

gordon

In article <6o3lhs$g7l@bgtnsc02.worldnet.att.net>,
  m.hewitt@worldnet.att.net (Milton) wrote:
> At precisely, Thu, 09 Jul 1998 12:24:07 -0700
> ID: <35A518D7.1B43@Non-HP-USA-om42.om.hp.com>
> Newsgroup: news:comp.databases
>
> Matt Houseman proclaimed:
>
> >Your best bet to create a robust app is to choose InterBase given
> >the choices available right now for Linux.  Have a look at:
> >http://www.interbase.com  (Lots of downloadable software for Linux)
> >I think that you'll find that it meets all of your criteria:
> >	- RedHat
> >	- IBPerl
> >	- InterClient JDBC driver
> >Matt Houseman
>
> I agree, BUT Interbase 4 will only run on RedHat 4.2.
> Interbase 5, coming in 3qtr98 will run on RedHat 5.x
>
> --
> +++++++++++++++++++++++++;;;;;;;;;;;;;;;;;;;;;;;;;;
>  Milton B. Hewitt
>  CAUCE member - http://www.cauce.org
>  Proud supporter of the Microsoft Boycott Campaign
>  http://www.abctec.com/~msbc/
> +++++++++++++++++++++++++;;;;;;;;;;;;;;;;;;;;;;;;;;
>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 10 Jul 1998 15:51:24 GMT
From: seb3@gte.com (steve belczyk)
Subject: Re: Do I understand this?
Message-Id: <6o5d9s$ds0$1@news.gte.com>

(Posted and mailed.)

In article <6nuvgn$ie8$1@mark.ucdavis.edu>,
Phillip George Geiger <geiger@cs.ucdavis.edu> wrote:
>I want to put some advertising banners on my web site.  They generally
>pay a set amount per click from a unique IP address.

Some also pay by the number of "impressions", which is simply the number
of times an ad is displayed.  There are also campaigns that pay by
"transaction", meaning that someone visited the advertiser's site and
placed an order.

http://www.markwelch.com/bannerad/ is a good source of information on
different banner ad companies.  I use Eads (www.eads.com) and Burstnet
(www.burstnet.com) and so far I've been pretty happy with both.

I know some people hate these ads, but they pay for my cable modem
connection, and not a single person has complained about the ads since I
added them a few months ago.  My server gets about 200,000 hits a day,
but I only display about 5,000 ads a day so folks don't get overloaded.

>But someone told me that
>	print:  "Location: http://www.mysponsor.com/?mycode\n\n";
>will cause *my* server to send an http request to the sponsor's
>site, get the data, and then forward it to the client's computer.

No, the Location: header will cause the *browser* to go to the URL you
specify.  The sponsor's web server will see the hit from the browser's
IP number, so you're okay.

So, if the sponsor says to put this on your web page:

    <a href=http://www.mysponsor.com/?mycode><img src=ad.gif></a>

You can put something like this instead:

    <a href=ad.cgi><img src=ad.gif></a>

and make an ad.cgi that looks something like:

    #! /usr/local/bin/perl
    #
    # Record the click
    &RecordClick;
    #
    # Send the browser to the ad
    print "Location: http://www.mysponsor.com/?mycode\n\n";

- steve belczyk



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

Date: Fri, 10 Jul 1998 11:28:37 -0400
From: Ted <kolovos_ted@prc.com>
Subject: forking on win32
Message-Id: <35A63325.DB38149D@prc.com>

I noticed that fork is unimplemented on win32, is there
a way around this, perhaps through a call to the windows createthread
api
in kernerl32.dll??

also is there a way to setup a signal so that whenever a socket is
closed on the
other end my perl script can be notified so that it can terminate?

please send any help to kolovos_ted@prc.com,
thanks for your time,
Ted



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

Date: 10 Jul 98 13:21:24 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Getting Yesterday's Date
Message-Id: <slrn6q7grc.3aj.sitaram@ltusitaram.diac.com>

On Wed, 08 Jul 1998 10:51:51 GMT, Richard Parker <rparker@ims.ltd.uk> wrote:
>On 8 Jul 1998 04:46:13 GMT, Tom Christiansen <tchrist@mox.perl.com>
>wrote:
>
>> [courtesy cc of this posting sent to cited author via email]
>>
>>In comp.lang.perl.misc, 
>>    allbery@kf8nh.apk.net writes:
>>:Technically, though, he's correct:  what about leap seconds?  :-) :-)
>>
>>Leap seconds are ignored.  time() is 29 seconds wrong, be definition.
>>
>Expain please? Checked man -s 2 time and can't see why...

perldoc -f time is prolly what Tom meant...


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

Date: Fri, 10 Jul 1998 11:17:54 -0500
From: mike_murphy-ppk@nortel.com (Michael Murphy)
Subject: Help installing DBD-DBI modules
Message-Id: <mike_murphy-ppk-1007981117540001@nppkm606.us.nortel.com>

Hey everyone,
My sysadmin is having trouble installing DBI-0.93 and DBD-Oracle-0.51.  We 
already have DBI-0.88 and DBD-Oracle-0.46 installed.  He said that he read 
the readme and followed the instructions.  He created a text file from the 
output of the attempted install.  I've included a small chunk of it where 
it seems to start falling apart.  Details are below:


/opt/FSFgcc/lib/gcc-lib/sparc-sun-solaris2.5/2.7.2/include/sys/param.h:187:
warning: `NBBY' redefined
/usr/include/sys/select.h:45: warning: this is the location of the
previous definition
In file included from /usr/include/sys/stream.h:26,
                 from /usr/include/netinet/in.h:38,
                 from /opt/lib/perl5/sun4-solaris/5.00401/CORE/perl.h:361,
                 from DBIXS.h:13,
                 from DBI.xs:10:
/usr/include/sys/model.h:32: #error "No DATAMODEL_NATIVE specified"
*** Error code 1
make: Fatal error: Command failed for target `DBI.o'
nppks47f:root# perl -V
Summary of my perl5 (5.0 patchlevel 4 subversion 1) configuration:
  Platform:
    osname=solaris, osvers=2.5.1, archname=sun4-solaris
    uname='sunos nppks47f 5.5.1 generic_103640-08 sun4u sparc
sunw,ultra-enterprise '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio= d_sfio=



Any help would be greatly appreciated.

TIA,
Mike

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Mike Murphy              ~ Nortel                   ~
~  my opinions are my own  ~ Raleigh, North Carolina  ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Fri, 10 Jul 1998 10:37:31 -0400
From: Catherine Skidmore <eppie@interport.net>
Subject: Re: HELP: Internet Database Design questions...
Message-Id: <35A6272B.583F@interport.net>

Avi Goldenberg wrote:

> 1)  What are the current technologies needed to achieve the minimum of
> data storage, retrieval, and manipulation?  (I prefer to stay NT as
> opposed to UNIX)

ooh. Access and ASP. or Access and Cold Fusion.

> 2)  What do I need to look for in a hosting service to allow me to
> achieve #1?

an NT Box running IIS. 

-catherine

-- 

Catherine Skidmore
http://www.suck-my-big.org
"You can kiss my ass and go straight to hell bitch." - danbel


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

Date: 10 Jul 1998 15:29:56 GMT
From: thompson@scapa.cs.ualberta.ca (Christopher Thompson)
Subject: Re: HELP: Internet Database Design questions...
Message-Id: <6o5c1k$95c$1@pulp.ucs.ualberta.ca>

Catherine Skidmore (eppie@interport.net) wrote:
: Avi Goldenberg wrote:

: > 1)  What are the current technologies needed to achieve the minimum of
: > data storage, retrieval, and manipulation?  (I prefer to stay NT as
: > opposed to UNIX)

: ooh. Access and ASP. or Access and Cold Fusion.

A relational database and Java also makes a good choice.  MS Access would
qualify but as this uses a JDBC-ODBC bridge, you'll need at least a
three tiered database setup.

In fact, you don't *need* a database at all but I'm guessing that your
requirements include one.

If you use a database and are designing your application, PLEASE PLEASE
make sure you understand the basics of good database design.  If you
do not know what "database normalisation" means, you aren't qualified.

: > 2)  What do I need to look for in a hosting service to allow me to
: > achieve #1?

: an NT Box running IIS. 

And a service provider that gives you a dedicated IP and allows you
to run servers on your system.

--

                   -=Christopher Thompson=-
http://ugweb.cs.ualberta.ca/~thompson/programming/javascript/meta-FAQ.html
All email is spam-filtered:  http://www.internz.com/SpamBeGone/
No Spam: //www.senate.gov/~murkowski/commercialemail/EMailAmendText.html
My minimalistic web site:  http://ugweb.cs.ualberta.ca/~thompson/



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

Date: Fri, 10 Jul 1998 14:43:27 GMT
From: wilfwilliams@my-dejanews.com
Subject: How to access the default NT printer
Message-Id: <6o59af$8n2$1@nnrp1.dejanews.com>

Ok I'm Newbie,  I have the camel book!
can anyone tell me ho to get a file/files to go to the default printer

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 10 Jul 1998 14:52:52 GMT
From: mmlenz@my-dejanews.com
Subject: IPC::Open2 and Open3 question
Message-Id: <6o59s4$976$1@nnrp1.dejanews.com>

I'm attempting to write to STDIN on a bin and read from STDOUT.  I'm finding
that I have no problems with the bin and perl script on a AIX 4.3 / Perl
5.00403 box.. but on a AIX 4.1.4 / Perl 5.00404 .. it doesnt want to seem to
always work. here is a snippet of the code.. the bin is just as modified
version of EAY's des encrypt/decrypt proggy.  I just made it so that the
DESKEY could be read from an environment variable instead.

here's some of the code

$enc_des = 'somepath/bin/des -E -k';

sub cisrc_encrypt_string {

  my $dec_text = shift;  ## plain text or whatever you wanna encrypt

  my $enc_text = undef;
  if(!$ENV{'DESKEY'}) { die("Missing KEY"); }
  if(!$enc_des) { die("Missing bin"); }
  if(!$dec_text) { die("Missing text"); }
  $|=1;  ## needs this to work with NS Enterprise server *shrug*
  my $pid = open2(OUTPUT, INPUT, $enc_des);
  print INPUT $dec_text; close(INPUT);
  while(<OUTPUT>) { $enc_text .= $_; } close(OUTPUT);
  wait;
  return cisrc_escape($enc_text);

}

Now I dont claim to be an expert on the IPC modules but this was
working for me fine on a different OS .. idea's?  If you write
alot of IPC::Open* gimme an example of what code you would use
to send 'text' to STDIN of a bin and read 'binary' (meaning binary
structure, garbage.. whatever) from STDOUT.  I found that just
evaluating <OUTPUT> as a scalar didnt work cuz sometimes the encrypted
binary structure had \n's in it :)   Please send me some mail if you
can offer any help!

-matt

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 10 Jul 1998 14:54:00 +0100 (BST)
From: Bellas@no.spam.leeds.ac.uk
Subject: Re: my perl object becomes a HASH when I try to use it. please help
Message-Id: <35A68D57.7C69@no.spam>

Stephen Riehm wrote:
>         my $ref = $self->{"platforms"}{$Pkg::Overview::platform};
>         print "ref is a ", ref( $ref ), "\n";
>         # print $ref->get( "package_dir" ), "\n";

Without wishing to cross with Tom Phoenix, it might help if I report
a similar, very simple, problem that I had with with my code, that
took me over 2 hours to solve last night.

I had a method like this:

sub fExists($$) {
	my $self = shift;
	my $url = shift;

	return ${$self->{Inodes}}{ $url };
}

intended to be called like this

if( $r->fExists( 'www.perl.org' ) {
	# ...

};

Carelessly I had managed to call my function using this syntax
	fExists( 'www.perl.org' );

which produced a similar error message to yours. Regretfully, I cannot
reproduce the error or the error message today (the code that I have
posted does not fail because the prototype catches the error); but
the error message was, as I recall, "Cannot use string as HASH ref
while use strict".

I may be completely off-beam, and this may be too simple for c.l.p.m, 
but I may be able to save someone the time that I spent investigating
this: Check that the first and second parameters to a class or an
instance method are what you think they are. (If these two are right
then any others probably are as well). The Camel book gives further
advice and mentions other pitfalls.

Ben.


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

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

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