[17177] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4589 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 11 21:05:32 2000

Date: Wed, 11 Oct 2000 18:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <971312713-v9-i4589@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 11 Oct 2000     Volume: 9 Number: 4589

Today's topics:
    Re: Altered files sometimes go empty! <madmanz123@hotmail.com>
    Re: Cutesy Arrows - Just say no! (was Re: Convert array (Craig Berry)
        DBD on SGI 6.5 (64 bit) & Oracle 8.1.6 <Stephen.Spence@Australia.Boeing.com>
    Re: DBD::RAM question... (Jeff Z.) <jeff@vpservices.com>
    Re: Help for a CGI newbie <elephant@squirrelgroup.com>
        How to get params after use Mod? <kistler@gmx.net>
    Re: How to know EMail  address of user (Chris Fedde)
    Re: How to know EMail  address of user <flavell@mail.cern.ch>
    Re: http_cookie not set in ms ie <elephant@squirrelgroup.com>
    Re: http_cookie not set in ms ie <troyr@vicnet.net.au>
        Invoking ssh from a script (Dave Sherohman)
    Re: Invoking ssh from a script (NP)
    Re: ip under win9x/2k from the commandline? <elephant@squirrelgroup.com>
    Re: mod_perl variables <wsprague100@yahoo.com>
        passing and returning hashes <dale@emmons.dontspamme.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 11 Oct 2000 22:13:04 GMT
From: "madman" <madmanz123@hotmail.com>
Subject: Re: Altered files sometimes go empty!
Message-Id: <QB5F5.96380$4d.13197010@news02.optonline.net>

wow... a perl god.

I'm reading one of your books now. Pretty good, just wish I was smarter.
(chap 3, still trying to figure some things out)




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

Date: Wed, 11 Oct 2000 22:17:59 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Cutesy Arrows - Just say no! (was Re: Convert array to string?)
Message-Id: <su9ponbr481k04@corp.supernews.com>

James Taylor (james@NOSPAM.demon.co.uk) wrote:
: > Cargo-cult?
: 
: Yes, I'd like to know what that means. I'd come to the conclusion that
: it was a cultural reference specific to America and that I'd never
: find out exactly what nuance it had. It clearly means "bad" in some
: sense, but more than that I haven't been able to deduce.
: 
: Could someone in the know please explain the derivation, history, and
: current usage of the term "cargo-cult" please.

World War II brought occupying military forces to many remote islands in
the Pacific which had had little or no previous exposure to outsiders.
Suddenly, out of nowhere, ships and planes arrived, and with them came
tons and tons of cargo -- tools, food, fuel, clothing -- beyond anything
previously imagined by the islanders.  Needless to say, a little of this
bounty ended up in the islander's hands, either as gifts or through
scavenging when bases were abandoned during and after the war.  The
natives had no idea what had just happened, but they knew they wanted more
cargo.  So, on some islands, "cargo cult" religions were born.  Models of
airplanes were made out of palm fronds, runways were cleared, "control
towers" built, all in the hopes of coaxing the 'gods' back.

Within the Perl community, 'cargo cult coding' refers to using some idiom
or pattern without understanding why you are doing it or how it works. 
Frequently the code involved is identifiably from some suspect source, or
replicates (with bugs) a function better performed in modern Perl by a
module.  The sense in which the phrase is used is clear, I hope; just like
the builders of airplane totems, cargo cult coders *think* they understand
the technology which they want to work make for them, but very clearly do
not actually have this understanding. 

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Quidquid latine dictum sit, altum viditur."
   |


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

Date: Wed, 11 Oct 2000 23:34:00 GMT
From: "Stephen Spence" <Stephen.Spence@Australia.Boeing.com>
Subject: DBD on SGI 6.5 (64 bit) & Oracle 8.1.6
Message-Id: <G2AHG5.7D5@news.boeing.com>

All,

Has anybody had success in getting DBD compiled for :
SGI 6.5 (64 bit) & Oracle 8.1.6 ?

I have successfully built perl 5.6.0, DBI both 64bit but no luck with DBD.

Email preferred,
Cheers,
Stephen




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

Date: Wed, 11 Oct 2000 16:18:07 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: DBD::RAM question... (Jeff Z.)
Message-Id: <39E4F52F.88BDD8E9@vpservices.com>

Brian McDonald wrote:
> 
> "Jeff Zucker" <jeff@vpservices.com> wrote in message
> news:39E48133.CFA607BA@vpservices.com...
> >
> > Brian McDonald wrote:
> > >
> > > I am writing a text-to-XML parser that operates on a CSV raw data file.
> >
> > Uh, in that case, why don't you just use DBD::RAM which can read and
> > write both CSV and XML using DBI methods?
> >
> 
> I've checked out the documentation for DBD::RAM at CPAN and don't really
> understand how you envision it's utility for my application. What I need to
> do is to take an input CSV file, parse it, and then generate an XML
> document.

I guess it depends on what you mean by "parse it".  If there is a
relationship between the fields you have in the CSV file and the tags
you want in the XML file (and that can be a one- to-one or one-to-many
or many-to-one relationship),  you can use DBD::RAM to define that
relationship, import the CSV file into memory, then export that to an
XML file.  If there is other processing you need to do e.g. you need to
calculate some other data from what is in the CSV file, or you need
transform what is in the CSV file before storing it as XML, you could
also do that with DBD::RAM by defining a user-defined read_sub() that
would perform those operations on specified fields of each CSV record as
it imports the CSV file.

Without seeing your actual situation I can't say that using the module
is better than the method you are working out, but it might possibly
save you some steps.  If you'd like to email me privately with more
details, perhaps I could make a better recommendation.
 
> I see this module as being potentially useful for the other processor I
> need: i.e. the script that takes our XML files (like the one txt2xml.pl is
> creating), parses them, and injects the data into SQL.

Yes, it can do that part out of the box: take an XML file and create a
SQL-accessible database out of it.

-- 
Jeff


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

Date: Thu, 12 Oct 2000 11:57:05 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: Help for a CGI newbie
Message-Id: <MPG.144fc57da4afe69989813@localhost>

newsgroups wrote ..
>I was wondering if someone would be willing to help a CGI newbie out with
>some misbehaving code.  I am trying to write a CGI program that will allow a
>user to update a webpage through an HTML form.  I am testing on an NT4
>server running IIS4 with Active State's Active Perl 5.2.2.  Essentially what
>the code is supposed to do is create a new file and copy all of the HTML
>file into the new file with changes according to the variables passed.  It
>then renames the old file to a backup and renames the new file to the old
>files name.  This code worked as a stand alone perl script but as soon as I
>tried to run it as a CGI script it started creating a blank new file.

rubbish .. the code below will also produce a blank webpage.htm file in 
a non-CGI environment .. you should really be careful of your facts 
before making statements

the convention of using uppercase names for filehandles is not a silly 
one that should be ignored .. your problems all arise because the 
filehandle that you've used conflicts with a function name exported from 
the :standard set of functions in CGI.pm

change your filehandles to upper case and your (current) problems will 
be solved

this problem is a perfect argument against using function sets from 
modules .. ie. if you don't know what functions are exported then it's 
easy to create hard to track bugs in your code

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Thu, 12 Oct 2000 00:10:31 +0200
From: Per Kistler <kistler@gmx.net>
Subject: How to get params after use Mod?
Message-Id: <39E4E557.A2A0D2CC@gmx.net>

How can one get the parameters (a,b,c) after a "use Module qw(a b c )"
from within a package?

Per.


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

Date: Wed, 11 Oct 2000 22:07:23 GMT
From: cfedde@u.i.sl3d.com (Chris Fedde)
Subject: Re: How to know EMail  address of user
Message-Id: <vw5F5.21$T3.170882560@news.frii.net>

In article <brian-ya02408000R1110001757090001@news.panix.com>,
brian d foy <brian@smithrenaud.com> wrote:
>In article <nT4F5.18$T3.170882560@news.frii.net>, cfedde@u.i.sl3d.com
>(Chris Fedde) posted:
>
>> Once apon a time there was a part of the CGI spec that made the
>> users e-mail address available to a CGI script.  
>
>are you sure?  I've never seen that as part of a specification.  it
>has only been due to user-agent bugs AFAIK.
>

Well...  CGI has never really had the force of a spec, and early browsers really
were a bit rough.   So I'll give you the point.  By the time best practices
were published that behavior had gone away.

Rough consensus and running code!
chris
-- 
    This space intentionally left blank


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

Date: Thu, 12 Oct 2000 01:43:03 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: How to know EMail  address of user
Message-Id: <Pine.GHP.4.21.0010120140040.23460-100000@hpplus03.cern.ch>

On Wed, 11 Oct 2000, Chris Fedde wrote:

> Well...  CGI has never really had the force of a spec, and early browsers really
> were a bit rough.   So I'll give you the point.  By the time best practices
> were published that behavior had gone away.

You're a bit off-beam there, I'd say.  The From: header is still there
in the HTTP spec as an option and - in the unlikely event of a client
sending one - the server would still be expected to present it across
the CGI interface to a script.

[f'ups set]



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

Date: Thu, 12 Oct 2000 10:47:10 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: http_cookie not set in ms ie
Message-Id: <MPG.144fb516c055abb198980f@localhost>

Troy Rasiah wrote ..
>> >i get some problems with micorsoft IE. it's not possible to read the
>> >cookie. The Browser set's the cokkie with correct values.then i tried
>> >to receive the cookie with fetch CGI::Cookie.
>> >http_cookie ENV is not set by using ms IE.
>> >
>> >With netscape everything work fine.
>> >
>> >use: apache 1.3.9 unix, perl 5.005_03, solaris 2.6
>> >
>> >any idea?
>>
>> if your cookies work with one browser but not with another browser -
>> then the problem is not a Perl problem .. perhaps find out how IE
>> handles cookies from Microsoft or a related newsgroup/FAQ/website/etc.
-
>I had the same problem....seems to work fine with IE up till 5.5
>5.0 and under work fine

even more not a Perl problem then .. the browser has obviously changed 
the way it handles cookies in some way that you're not expecting

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Thu, 12 Oct 2000 12:00:20 +1100
From: "Troy Rasiah" <troyr@vicnet.net.au>
Subject: Re: http_cookie not set in ms ie
Message-Id: <338F5.25794$O7.412261@ozemail.com.au>

----------------------------------------------------------------------------
----------------
"jason" <elephant@squirrelgroup.com> wrote in message
news:MPG.144fb516c055abb198980f@localhost...
> Troy Rasiah wrote ..
> >> >i get some problems with micorsoft IE. it's not possible to read the
> >> >cookie. The Browser set's the cokkie with correct values.then i tried
> >> >to receive the cookie with fetch CGI::Cookie.
> >> >http_cookie ENV is not set by using ms IE.
> >> >
> >> >With netscape everything work fine.
> >> >
> >> >use: apache 1.3.9 unix, perl 5.005_03, solaris 2.6
> >> >
> >> >any idea?
> >>
> >> if your cookies work with one browser but not with another browser -
> >> then the problem is not a Perl problem .. perhaps find out how IE
> >> handles cookies from Microsoft or a related newsgroup/FAQ/website/etc.
> -
> >I had the same problem....seems to work fine with IE up till 5.5
> >5.0 and under work fine
>
> even more not a Perl problem then .. the browser has obviously changed
> the way it handles cookies in some way that you're not expecting

Jason....know a news group that handles/discusses a mixture of browser
related problems and perl?

ta




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

Date: Wed, 11 Oct 2000 22:53:02 GMT
From: esper@news.visi.com (Dave Sherohman)
Subject: Invoking ssh from a script
Message-Id: <slrn8u9rqe.5cc.esper@pchan.dojo>

I'm trying to put together a utility script to do a little remote maintenance
via ssh.  My first attempt (included below) fails.  It invokes ssh, but ssh
refuses to allocate a pty because stdin isn't a terminal.  My script then
fails to recognize any data as being received from the ssh process, it just
blocks on the while(...<SSHREAD>).

What do I need to do to get SSHREAD and SSHWRITE hooked up to ssh's stdin and
stdout?  (Oh, one other complication - although it's not present in this
example, the final version will need to manage multiple concurrent ssh
sessions, so anything dependent on using specific file descriptiors won't
work in the long term.)

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

use IPC::Open2;

# Read command line
my $host = shift;
my $user = shift;
my $password = shift;

my $ssh_prompt = undef;
my $ssh_pid = open2(*SSHREAD, *SSHWRITE, "ssh $host -l $user")
              || die "ssh invocation failed!  $!";                          
                                                                           
while (!$ssh_prompt && <SSHREAD>) {
  print;

  print SSHWRITE "$password\n"  if /password:$/;
  $ssh_prompt = $_              if /[\$#]$/;
}                                               

print "\n(Found prompt: \"$ssh_prompt\")\n";

print SSHWRITE "exit\n";

-- 
"Two words: Windows survives." - Craig Mundie, Microsoft senior strategist
"So does syphillis. Good thing we have penicillin." - Matthew Alton
Geek Code 3.1:  GCS 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+


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

Date: Wed, 11 Oct 2000 23:05:12 GMT
From: nvp@spamnothanks.speakeasy.org (NP)
Subject: Re: Invoking ssh from a script
Message-Id: <Hm6F5.33924$bI6.1230396@news1.giganews.com>

esper@news.visi.com wrote:
: I'm trying to put together a utility script to do a little remote maintenance
: via ssh.  My first attempt (included below) fails.  It invokes ssh, but ssh
: refuses to allocate a pty because stdin isn't a terminal.  My script then

Correct.  You should probably use Expect.pm instead.

-- 
Nate II


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

Date: Thu, 12 Oct 2000 11:07:51 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: ip under win9x/2k from the commandline?
Message-Id: <MPG.144fb9ef8e25e32989810@localhost>

Werner, Wolfgang wrote ..
>how can i find ount my ip using the windows commandline and perl?

  perl -MSocket -e"print inet_ntoa inet_aton $ENV{COMPUTERNAME}"

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Wed, 11 Oct 2000 22:08:50 GMT
From: curious_hubby <wsprague100@yahoo.com>
Subject: Re: mod_perl variables
Message-Id: <8s2odc$2cd$1@nnrp1.deja.com>

If you are using Apache, try sending it a USR1 signal.  This seems to
work for me, re starting the cache.

In article <x7vguziesb.fsf@onceler.kciLink.com>,
  Vivek Khera <khera@kciLink.com> wrote:
> >>>>> "a" == apacheproblems  <apacheproblems@my-deja.com> writes:
>
> a> I notice when using %ARRAYS in mod_perl that for new requests
previous
> a> data stored in the %ARRAY are still present. I have declared the
> a> veriables with my(%ARRAY) = () and still causing problems.Any
ideas?
> a> -a
>
> Yes; this is a mod_perl FAQ even.
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Vivek Khera, Ph.D.                Khera Communications, Inc.
> Internet: khera@kciLink.com       Rockville, MD       +1-301-545-6996
> GPG & MIME spoken here            http://www.khera.org/~vivek/
>


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


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

Date: Wed, 11 Oct 2000 19:42:49 -0500
From: "Dale Emmons" <dale@emmons.dontspamme.com>
Subject: passing and returning hashes
Message-Id: <sua2529d1ngr36@corp.supernews.com>

hello,

I'd like to create a subroutine that takes a hash of values as its arguments
and returns a hash as its value, something like:

%fbsubs_returned_hash = fbsub( foo => 'fooit', bar => 'barit' );

print $fbsubs_returned_hash{foobar};

sub fbsub {

    my ($fb, $bf);

    ### do something... to give $fb & $bf values from $_{foo} and $_{bar}

    return ( foobar => $fb, barfoo => $bf );
}

I know that this probably isn't close to what would work, but I hope you
understand what I'm getting at?

Thanks,
Dale




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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 4589
**************************************


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