[15567] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2980 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 8 18:05:56 2000

Date: Mon, 8 May 2000 15:05:25 -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: <957823525-v9-i2980@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 8 May 2000     Volume: 9 Number: 2980

Today's topics:
    Re: #How to parse and strip perl comments? (Abigail)
    Re: #How to parse and strip perl comments? <phill@modulus.com.au>
        (not so) large integers <jpl@research.att.com>
    Re: (not so) large integers <lr@hpl.hp.com>
        2 decimal places? (Dave)
    Re: 2 decimal places? <lr@hpl.hp.com>
    Re: 2 decimal places? atomshop_1@my-deja.com
    Re: 2 decimal places? (Tad McClellan)
    Re: 8i + Oraperl DBD db112i@my-deja.com
    Re: [problem solved] sorting hashes by value rather tha <nospam@devnull.com>
    Re: Accidental Creation of Static Variable <aqumsieh@hyperchip.com>
    Re: Accidental Creation of Static Variable (Abigail)
        CGI.pm <jamalone@earthlink.net>
    Re: CGI.pm <dave@dave.org.uk>
    Re: CGI.pm <adams1015@worldnet.att.net>
    Re: CGI.pm <makarand_kulkarni@My-Deja.com>
        dns lookup on choosen name server? <sendke@uni-paderborn.de>
    Re: Does anyone use Perl on Alpha based NT systems? <baughj@rpi.edu>
    Re: dynamic html <jamalone@earthlink.net>
    Re: dynamic html (Bart Lateur)
    Re: FAQ for configuring Perl on Win NT <lr@hpl.hp.com>
    Re: FAQ for configuring Perl on Win NT <jamalone@earthlink.net>
    Re: Getting the platform on which Perl is running <jamalone@earthlink.net>
    Re: Getting the platform on which Perl is running nobull@mail.com
    Re: Getting variables from html <adams1015@worldnet.att.net>
    Re: Getting variables from html <camerond@mail.uca.edu>
        Hang on uploading a file siust@my-deja.com
        How do I use a dll ? <michaelr@apgtest.com>
    Re: How do I use a dll ? (Bart Lateur)
        keep-alive atomshop_1@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 8 May 2000 20:13:55 GMT
From: abigail@ucan.foad.org (Abigail)
Subject: Re: #How to parse and strip perl comments?
Message-Id: <slrn8he803.234.abigail@ucan.foad.org>

In article <390E2796.3D1E@modulus.com.au>, Peter Hill wrote:
>Tom Phoenix wrote:
>[snip]
>> Oh, you want a program to do it. That smells as if you want to obfuscate
>> your code. 
>
>No. My code is sufficiently obscure as it is, and needs no help in that
>direction - I'm just production prepping some heavily (indeed
>excessively) commented code.


That begs the question, why can't production code have comments?



Abigail


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

Date: Tue, 09 May 2000 07:59:48 +1000
From: Peter Hill <phill@modulus.com.au>
Subject: Re: #How to parse and strip perl comments?
Message-Id: <391738D4.E2A@modulus.com.au>

Abigail wrote:
> 
> In article <390E2796.3D1E@modulus.com.au>, Peter Hill wrote:
> >Tom Phoenix wrote:
> >[snip]
> >> Oh, you want a program to do it. That smells as if you want to obfuscate
> >> your code.
> >
> >No. My code is sufficiently obscure as it is, and needs no help in that
> >direction - I'm just production prepping some heavily (indeed
> >excessively) commented code.
> 
> That begs the question, why can't production code have comments?
> 
> Abigail
No reason, indeed. But nor does it beg the question. I want to strip the
existing comments which are excessive,
inappropriate and in some cases just plain wrong, since they were
written at the level of "the next line does 'blah'". I'll then replace
them with appropriate notes for any particular choices which may not be
self evident from the code, which would seem to be better commenting
practice than writing pseudo-code which *may* or *may not* reflect what
the following code actually does in perl.

But, I'm learning as I go; any comments on comments or commenting style
appreciated.
-- 
Peter Hill,
Modulus Pty. Ltd.,
http://www.modulus.com.au/


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

Date: Mon, 8 May 2000 18:28:04 GMT
From: "John P. Linderman" <jpl@research.att.com>
Subject: (not so) large integers
Message-Id: <39170734.DAB2B39@research.att.com>

Now that 5.6.0 supports 64-bit integers,
it's no longer necessary to split things like
10-digit telephone numbers into pieces.
Still, when dealing with a few million of them,
it's a pity to dedicate 8 bytes to each number,
when 5 bytes will do.

The problem isn't deciding how many bytes
will do

1+ int($length * log(10) / log(256))

establishes that for digit strings of a given
$length (and 8-bit bytes).  But how can such
numbers be packed into strings of fixed length,
that compare, as strings, in the same way as the
integers they encode?

substr(pack("Q", $value), 3)

is ok on big-endian architectures, but I know of
no architecture-independent quad pack item,
like "N" for 32-bit integers.

pack("w", $value)

compares correctly, but varies in length unless
we take care to add in some high-order bit to
wire down the length.  It only makes good use
of 7/8's of the bits, and, by the time we fiddle with
the high-order bit to fix the length, it's less time
efficient on the architectures I've checked.

Any hope for a network order "Q" pack item?
Or a good workaround?



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

Date: Mon, 8 May 2000 12:49:51 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: (not so) large integers
Message-Id: <MPG.1380ba38d387b78d98aa23@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <39170734.DAB2B39@research.att.com> on Mon, 8 May 2000 
18:28:04 GMT, John P. Linderman <jpl@research.att.com> says...
> Now that 5.6.0 supports 64-bit integers,
> it's no longer necessary to split things like
> 10-digit telephone numbers into pieces.
> Still, when dealing with a few million of them,
> it's a pity to dedicate 8 bytes to each number,
> when 5 bytes will do.

 ...

> Any hope for a network order "Q" pack item?
> Or a good workaround?

Here's a possible workaround (assuming 5 bytes will do):

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

  my $n = 9876543210;

  my $s = pack(C => $n / 2 ** 32) . pack(N => $n % 2 ** 32);

  print unpack('H*' => $s), "\n";

  print unpack(C => substr $s, 0, 1) * 2 ** 32 +
        unpack(N => substr $s, 1), "\n";

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


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

Date: Fri, 05 May 2000 14:08:11 GMT
From: Dave@nospam.uk (Dave)
Subject: 2 decimal places?
Message-Id: <3914d5be.21447435@news.tesco.net>

Just wondered if someone
could tell me how you get
a calculation to say 2 decimal places?

e.g. 37.837    should come to 37.84

Dave


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

Date: Mon, 8 May 2000 12:28:30 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: 2 decimal places?
Message-Id: <MPG.1380b5381e14de8698aa21@nntp.hpl.hp.com>

In article <3914d5be.21447435@news.tesco.net> on Fri, 05 May 2000 
14:08:11 GMT, Dave <Dave@nospam.uk> says...
> Just wondered if someone
> could tell me how you get
> a calculation to say 2 decimal places?
> 
> e.g. 37.837    should come to 37.84

perlfaq4: "Does Perl have a round() function? ..."

Warning:  If you are doing calculations involving currency, it is best 
to use integer units of pence, and do the conversion to pounds once at 
the very end.

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


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

Date: Mon, 08 May 2000 19:52:08 GMT
From: atomshop_1@my-deja.com
Subject: Re: 2 decimal places?
Message-Id: <8f75t1$u6t$1@nnrp1.deja.com>

In article <3914d5be.21447435@news.tesco.net>,
  Dave@nospam.uk wrote:
> Just wondered if someone
> could tell me how you get
> a calculation to say 2 decimal places?
>
> e.g. 37.837    should come to 37.84
>
> Dave
>
for output it's something like this...
printf "%8.2f",$number;


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


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

Date: Mon, 8 May 2000 16:59:17 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: 2 decimal places?
Message-Id: <slrn8heal5.dl7.tadmc@magna.metronet.com>

On Fri, 05 May 2000 14:08:11 GMT, Dave <Dave@nospam.uk> wrote:

>Just wondered if someone


Anyone who checked the Perl FAQ before posting to the
Perl newsgroup can help you with that.

You should have done that you know.


>could tell me how 


Yes I could. But I'm not. Just see the FAQ about rounding numbers.


>you get
>a calculation to say 2 decimal places?
>
>e.g. 37.837    should come to 37.84


   perldoc -q round


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


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

Date: Mon, 08 May 2000 20:19:22 GMT
From: db112i@my-deja.com
Subject: Re: 8i + Oraperl DBD
Message-Id: <8f77fp$vp7$1@nnrp1.deja.com>

Hey Yakov,

I didn't use any switches on the command line (you might be refering to
the rebuilding of a static perl).  I just followed the recipe:

To build perl:  1)sh Configure 2)make 3)make test 4)make install
To build dbi:  1)perl makefile.PL 2)make 3)make test 4)make install
To build dbd:  1)perl makefile.PL 2)make 3)make test --- fails

I did modify the makefile a little but I don't remember what I did and I
did it different a couple of times and saw no impact either way.

Just remember to have your basic Oracle Environment set:
ORACLE_HOME
ORACLE_BASE
ORACLE_SID
before you start the dbi and dbd builds.

Sorry I'm not much help, but it was very straight forward.  I built it
with both gcc and the cc from SUNWspro.  The perl works fine and the dbi
appears to work fine.

Good Luck,
-Don

In article <8f5ghe$2gb$1@nnrp1.deja.com>,
  mozarty@my-deja.com wrote:
> Hi Don,
>
> I try to do the same for ORACLE 8.1.5
>
> on Sun Solaris 2.6
>
> Could you tell me how exactly looks
>
> your perl Makefile.PL command line ?
>
> Thanks,
>
> Yakov
>
> In article <8euf5f$mj6$1@nnrp1.deja.com>,
>   db112i@my-deja.com wrote:
> > Help,
> >
> > I have installed Oracle 8i (8.1.6) on Sun
> Solaris 7.  I have installed
> > the latest version of production perl 5.005 and
> now I'm trying to build
> > DBD and DBI.
> >
> > The make and build of DBI 1.13 seems to work,
> test, and install fine.
> >
> > The make and build of DBD 1.03 will build but
> always fails the "make
> > test" with an error that simply says "You need a
> >  Solaris patch to run this version of java
> runtime".  No mention of what
> > patch.
> >
> > I've gone to sunsolve and called Sun ... no
> help.
> > I've gone to metalink and called Oracle ... no
> help.
> >
> > Let my people go.  I need an answer.
> >
> > I realize that ORACLE_HOME/JRE is a link to the
> Oracle JRE 1.1.8, but
> > you must use this version with Oracle.
> >
> > Someone must have figured this out.
> >
> > Thanks,
> > -Don
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


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


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

Date: 8 May 2000 21:46:03 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: [problem solved] sorting hashes by value rather than by key in a foreach loop
Message-Id: <8f7cir$1a9$3@216.155.32.56>

In article <m1zoq1tev6.fsf@halfdome.holdit.com>, merlyn@stonehenge.com 
(Randal L. Schwartz) wrote:

 | >>>>> "The" == The WebDragon <nospam@devnull.com> writes:
 | 
 | The>  | print "Just another Perl hacker," unless undef;
 | 
 | The> *chuckle* and since 'undef' will never return true, this will 
 | always 
 | The> print.
 | 
 | <cowboy_voice>You're new in these parts, aren't ya?</cowboy_voice>

hehe yup, but I'm learning as fast as I can. 

this group is an invaluable resource, as I can also see what OTHER 
newbies (and pros) are asking and the answers they get. 

I've got a growing library of snippets from here of Q&A relating to 
things of potential interest to me.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Mon, 08 May 2000 18:21:08 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Accidental Creation of Static Variable
Message-Id: <7ar9bc9a3w.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>


nobull@mail.com writes:

> Tom Briles <sariq@texas.net> writes:
> 
> > Is this behavior documented?
> 
> Not that I know of, I'd call it a bug. 

I believe I saw a discussion of this a few months ago on p5p. IIRC, the
consensus was that it is indeed a bug, and I believe was (or will be)
fixed.

Check the archives for more details.

--Ala


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

Date: 8 May 2000 21:22:22 GMT
From: abigail@ucan.foad.org (Abigail)
Subject: Re: Accidental Creation of Static Variable
Message-Id: <slrn8hec0e.234.abigail@ucan.foad.org>

In article <u98zxlgeq0.fsf@wcl-l.bham.ac.uk>, nobull@mail.com wrote:
>Tom Briles <sariq@texas.net> writes:
>
>> Given:
>> 
>> ---
>> 
>> #!/usr/bin/perl -w
>> 
>> use strict;
>> foo(20);
>> foo(10);
>> 
>> sub foo {
>>     my ($comp) = @_;
>>     my $test = 1 if $comp == 30;
>>     $test = 2 if $comp == 20;
>>     print "$test\n";
>> }
>> __END__ 
>> 
>> Could someone kindly explain why $test seems to be static?
>
>Because it has been declared by never initialised.
>
>The line...
>
>my $test = 1;
>
>...does two things.  First it declares $test at compile time as
>lexically scoped to the encosing block.  Secondly it assigns $test at
>run time to one.
>
>my $test = 1 if $comp == 30;
>
>Still does the compile-time stuff but not the runtime stuff.
>
>> Is this behavior documented?
>
>Not that I know of, I'd call it a bug.

I wouldn't. It's a cute trick, and simpler to write than:

    {my $test;
     sub foo { .... }
    }

>                                        You are probably accessing data
>via an uninitialised pointer.

There are no pointers in Perl, so your remark doesn't make much sense.

>                               That way lies segmentation faults.

Now, *that* would be a bug in perl. A Perl program should never segfault
(unless of course you send it a SEGV signal).



Abigail


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

Date: Mon, 08 May 2000 18:31:13 GMT
From: "Jason Malone" <jamalone@earthlink.net>
Subject: CGI.pm
Message-Id: <RJDR4.38770$x4.1272559@newsread1.prod.itd.earthlink.net>

Is it possible with CGI.pm to read all of the form variables into an
associative array?

For example if I have a web form that submits the following vars/values to
the script

var1=value1
var2=value2
var3=value3

Is it possible to do something like

%FORM = param();

and get

$FORM{var1} == "value1"
$FORM{var2} == "value2"
$FORM{var3} == "value3"

etc.....

Thanks for your help
Jason Malone




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

Date: Mon, 08 May 2000 19:46:19 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: CGI.pm
Message-Id: <4m2ehsgfnhrqs1hdb6i433v4lv3iunb6rl@4ax.com>

On Mon, 08 May 2000 18:31:13 GMT, "Jason Malone"
<jamalone@earthlink.net> wrote:

>Is it possible with CGI.pm to read all of the form variables into an
>associative array?
>
>For example if I have a web form that submits the following vars/values to
>the script
>
>var1=value1
>var2=value2
>var3=value3
>
>Is it possible to do something like
>
>%FORM = param();
>
>and get
>
>$FORM{var1} == "value1"
>$FORM{var2} == "value2"
>$FORM{var3} == "value3"
>
>etc.....

param() called with no arguments will return a list of all of the CGI
parameter names that your script has recieved. Therefore you can do
something like this:

my %FORM;
my @params = param();

foreach (@params) P
  $FORM{$_} = param($_);
}

Of course, if any of your CGI parameters are multi-valued then param()
will return a list rather than a scaler and this simple code will need
to be 'improved'.

hth,

Dave...

-- 
<http://www.dave.org.uk>  SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>

"There ain't half been some clever bastards" - Ian Dury [RIP]


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

Date: Mon, 08 May 2000 18:49:28 GMT
From: "Veronica Adams" <adams1015@worldnet.att.net>
Subject: Re: CGI.pm
Message-Id: <Y_DR4.44179$PV.3027168@bgtnsc06-news.ops.worldnet.att.net>


Jason Malone <jamalone@earthlink.net> wrote in message > Is it possible with
CGI.pm to read all of the form variables into an
> associative array?
>
> For example if I have a web form that submits the following vars/values to
> the script
>
> var1=value1
> var2=value2
> var3=value3
>
> Is it possible to do something like
>
> %FORM = param();
>
> and get
>
> $FORM{var1} == "value1"
> $FORM{var2} == "value2"
> $FORM{var3} == "value3"

 Yes, but you have to import the :cgi-lib function calls. I thought of doing
this myself but nowdays I try to avoid cgi-lib. , so I decied agains it.
Check the documentation for cgi.pm. It will tell you how to do this.





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

Date: Mon, 08 May 2000 12:01:30 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: CGI.pm
Message-Id: <39170F0A.80CF3A2B@My-Deja.com>



Jason Malone wrote:

> Is it possible with CGI.pm to read all of the form variables into an
> associative array?

use the Vars() method. This is clearly explained in the CGI.pm
documentation. You have to be careful in the cases where
there are more than one name/value pairs sharing the same name.
In this case multivalued parameters will be returned as a packed string,
separated by the "\0" (null) character.




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

Date: Mon, 08 May 2000 23:05:57 +0200
From: arne sendke <sendke@uni-paderborn.de>
Subject: dns lookup on choosen name server?
Message-Id: <39172C35.F8D66B95@uni-paderborn.de>

Hi,

i have still a problem,

i want to translate a url like www.amazon.com
into the fitting ip adress.

gethostbyaddr doesn`t work because i want
to choose the name server by my script.

my idea was to create a socket to a name
server and print the request like:

print $server "$URL";

but i don`t know the correct contents
of $URL to get a answer.

thank you

sendke@uni-paderborn.de


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

Date: Mon, 08 May 2000 14:37:48 -0400
From: justin baugh <baughj@rpi.edu>
Subject: Re: Does anyone use Perl on Alpha based NT systems?
Message-Id: <3917097C.9E9F9AB5@rpi.edu>

Larry Blische wrote:
> 
> I have a client who is interested in hosting a Perl/Oracle app on an
> existing Alpha NT server. I'm having trouble locating the DBI and
> DBD::ODBC modules. Does anyone have pre-built versions of these or
> instructions on how I can build these myself?
> 

DBI/DBD and almost every other module in existence can be found on 
CPAN:

http://www.cpan.org/modules/01modules.index.html

DBI is at:

http://cpan.valueclick.com/authors/id/TIMB/DBI-1.13.tar.gz
(or any CPAN mirror)

Specific DBD drivers can be found on the modules page that I 
indicated above.

~j

-- 
==================================================
Justin Baugh (baughj@nocannedmeat.rpi.edu)
PGP: http://www.rpi.edu/~baughj/keys.txt
"Evil is easy, and has infinite forms." - Pascal


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

Date: Mon, 08 May 2000 18:37:48 GMT
From: "Jason Malone" <jamalone@earthlink.net>
Subject: Re: dynamic html
Message-Id: <0QDR4.38777$x4.1273415@newsread1.prod.itd.earthlink.net>

You can do this if your server supports Server Side Includes.  You should be
able to find some information on that.  If not, I noticed on Matts page that
he has a couple of scripts that will let you emulate SSI's on servers that
do not support it.  I haven't used them but you can check them out at
http://www.worldwidemart.com/scripts

Jason Malone

"Matthew Armarego" <trookat@q-net.net.au> wrote in message
news:957767281.642127@hearts.q-net.net.au...
>
>
> is this achivable via perl .. any sites you can refer me to?
>
>




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

Date: Mon, 08 May 2000 21:38:33 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: dynamic html
Message-Id: <391933b3.4177760@news.skynet.be>

Matthew Armarego wrote:

>is this achivable via perl .. 

Can you do it using CGI? If so, then yes, you can do it with Perl.

-- 
	Bart.


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

Date: Mon, 8 May 2000 11:25:48 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: FAQ for configuring Perl on Win NT
Message-Id: <MPG.1380a6899e33bce98aa1e@nntp.hpl.hp.com>

In article <JhrR4.15400$PL4.383799@ozemail.com.au> on Mon, 8 May 2000 
14:18:38 +1000, Kthulu <lord_kthulu@hotmail.com> says...
>                                         Is there a FAQ for setting up Perl
> on IIS 4 on Win NT Server.  I've set security permissions of my CGI
> directory to Full Access, I can run *.pl files from a command line but cant
> run through a browser.  No doubt this is a common and simple problem, does
> anyone know what the answer is, or can anyone point me to a relevant FAQ.

Assuming you have installed ActivePerl (if not, why are you asking this 
question?), go to te online documentation 
(Start:ActivePerl:Documentation), and look for "ActivePerl faq6 - web 
server info".

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


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

Date: Mon, 08 May 2000 18:40:00 GMT
From: "Jason Malone" <jamalone@earthlink.net>
Subject: Re: FAQ for configuring Perl on Win NT
Message-Id: <4SDR4.38778$x4.1272046@newsread1.prod.itd.earthlink.net>

I can't remember exactly where but you have to modify the registry somewhere
in the IIS settings to tell the server to use perl.exe to process files with
an extension of .pl or .cgi or whatever you want to use.  I think maybe if
you do a search on .htm or .asp it should give you the approximate location

Jason Malone

"Kthulu" <lord_kthulu@hotmail.com> wrote in message
news:JhrR4.15400$PL4.383799@ozemail.com.au...
> Hello from a Perl Newbee,
>                                         Is there a FAQ for setting up Perl
> on IIS 4 on Win NT Server.  I've set security permissions of my CGI
> directory to Full Access, I can run *.pl files from a command line but
cant
> run through a browser.  No doubt this is a common and simple problem, does
> anyone know what the answer is, or can anyone point me to a relevant FAQ.
>
> TIA,
>
> K
>
>
>
>




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

Date: Mon, 08 May 2000 18:42:22 GMT
From: "Jason Malone" <jamalone@earthlink.net>
Subject: Re: Getting the platform on which Perl is running
Message-Id: <iUDR4.38780$x4.1269682@newsread1.prod.itd.earthlink.net>

If it is on a Unix system you should be able to do something like

$OS = `uname`;
print $OS;

notice that in the first line they are back ticks telling perl to execute
the system command and store the return in $OS.

Hope this helps
Jason Malone

"Hans Scholte" <hans@salience.nl> wrote in message
news:3916a10d.12672762@news.nl.net...
> Hi,
>
> Does anybody know if there is a way (a standard function or some
> predefined variable) to ask Perl on what platform it is running?
>
> Thanks in advance,
>
> Hans Scholte
>
>




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

Date: 08 May 2000 19:55:20 +0100
From: nobull@mail.com
Subject: Re: Getting the platform on which Perl is running
Message-Id: <u9wvl4g9d3.fsf@wcl-l.bham.ac.uk>

[ Please put your comments following the quoted text that you
  are commenting on.  Jeopardectomy performed.                   ]

"Jason Malone" <jamalone@earthlink.net> writes upside down:

> "Hans Scholte" <hans@salience.nl> wrote in message
> news:3916a10d.12672762@news.nl.net...

> > Does anybody know if there is a way (a standard function or some
> > predefined variable) to ask Perl on what platform it is running?

Have you considered looking at the list of predefined varables?  It is
not exactly long - surely is would be quicker to read it than post to
Usenet asking if it contains something?

> If it is on a Unix system you should be able to do something like
> 
> $OS = `uname`;
> print $OS;

Usually $^O is enough.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Mon, 08 May 2000 18:08:21 GMT
From: "Veronica Adams" <adams1015@worldnet.att.net>
Subject: Re: Getting variables from html
Message-Id: <poDR4.44131$PV.3025019@bgtnsc06-news.ops.worldnet.att.net>


Kerry Shetline <kerry@shetline.com> wrote in message > This handles both GET
and POST:
>
> sub getFormData
> {
>         unless (defined($getFormData_initflag)) {
>                 $getFormData_initflag = 1;
>
>                 my $pairs;
>
>                 if ($ENV{'REQUEST_METHOD'} eq 'GET') {
>                         @pairs = split(/&/, $ENV{'QUERY_STRING'});
>                 }
>                 elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
>                         my $buffer;
>                         read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
>                         @pairs = split(/&/, $buffer);
>                 }
>                 else {
>                         return undef;
>                 }
>
>                 my ($pair, $key, $value);
>
>                 foreach $pair (@pairs) {
>                         ($key, $value) = split(/=/, $pair);
>                         $key = unescape($key);
>                         $value = unescape($value);
>                         $value =~ s/<!--(.|\n)*-->//g;
>                         $getFormData_formdata{$key} = $value;
>                 }
>         }
>
>         return $getFormData_formdata{$_[0]};
> }
>
> sub unescape
> {
>         my      @out = @_;
>
>         for (@out) {
>                 tr/+/ /;
>                 s/%([a-fA-F0-9][a-fA-F0-9])/ pack("C", hex($1))/eg;
>         }
>
>         return wantarray ? @out : $out[0];
> }
>

*GASP*

  #!/usr/bin/perl -w
  use CGI::Carp qw(carpout fatalsToBrowser);
  use CGI qw(:standard);
  use diagnostics;
  use strict;

  my $var1 = param('value');
  my $var2  = param('value2');

wow, thats scary-








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

Date: Mon, 08 May 2000 15:30:22 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Getting variables from html
Message-Id: <391723DE.D6CC500F@mail.uca.edu>

Veronica Adams wrote:
> [LONG snip]
> 
> *GASP*

Says it all for me. After that, you need some air that's fit to breathe.

Cameron

-- 
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu


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

Date: Mon, 08 May 2000 21:27:27 GMT
From: siust@my-deja.com
Subject: Hang on uploading a file
Message-Id: <8f7bfc$4ju$1@nnrp1.deja.com>

My script below is a quite simple perl script for file uploading which
I saw often in perl web sites.

The problem is that when I input a valid file on the PC, the script
works fine.

But if I type a wrong filename, the script is hung on my unix server.
(I am using Netscape Enterprise server and IE5.0/Netscape communicator)

Can anyone give me a hint on what's wrong about my code.
Appreicate any help.


============================================

#!/opt/local/bin/perl5

use CGI qw(:standard);

my $cgi = new CGI;

if ($cgi->param) {
  my $file=$cgi->param('file');


  if (!$file) {
      exit(0);
  }
  $day = $cgi->param(whichday);
  $filename = "../docs/" . $cgi->param(whichday) . ".doc";
  unlink $filename;
  open(LOCAL, ">".$filename) or die $!;
  binmode(LOCAL);
  while ($size = read($file, $buffer, 1024)) {
   print LOCAL $buffer;
  }
  close(LOCAL);
  chmod 777, $filename;

  print $cgi->header();
  print "File for $day has been successfully uploaded ... thank you.\n";
}
else {
print << "HTML";
Content-type: text/html

<FORM ENCTYPE="multipart/form-data" ACTION="calevent_upload.cgi"
METHOD=POST>

<H1>Calendar of Events</H1>
<P>Specify the document for:<BR>
<P>
<INPUT TYPE="radio" CHECKED NAME="whichday" VALUE="monday">Monday<BR>
<INPUT TYPE="radio" NAME="whichday" VALUE="tuesday">Tuesday<BR>
<INPUT TYPE="radio" NAME="whichday" VALUE="wednesday">Wednesday<BR>
<INPUT TYPE="radio" NAME="whichday" VALUE="thursday">Thursday<BR>
<INPUT TYPE="radio" NAME="whichday" VALUE="friday">Friday<BR>
<P>
Please select a file: <BR>
<INPUT TYPE="FILE" NAME="file">
<P>
<INPUT TYPE="submit" VALUE="Submit File">
</FORM>
HTML

}





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


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

Date: Mon, 08 May 2000 13:11:39 -0600
From: Michael Roinestad <michaelr@apgtest.com>
Subject: How do I use a dll ?
Message-Id: <3917116B.2AD2D898@apgtest.com>

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Greetings
<br>&nbsp;&nbsp;&nbsp; How would I go about using an exported function
from a dll&nbsp; in perl ?&nbsp; It's needed to run in the NT 4.0(service
pack 6 if it matters) enviroment.&nbsp; The particular function I am trying
to access resides in CFuncs.dll that has an exported function called ChkNumber
that returns a number and requires along&nbsp; and a string as an argument.
<p>From CFuncs.h
<br>long ChkNumber(long xNumber, char *Filter);
<p>Thanks in advance
<br>Michael Roinestad
<br>&nbsp;</html>



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

Date: Mon, 08 May 2000 21:13:19 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: How do I use a dll ?
Message-Id: <391726a9.838979@news.skynet.be>

Michael Roinestad wrote:

><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
><html>

Please don't post in HTML.

>How would I go about using an exported function
>from a dll in perl? It's needed to run in the NT 4.0(service
>pack 6 if it matters) enviroment. The particular function I am trying
>to access resides in CFuncs.dll that has an exported function called ChkNumber
>that returns a number and requires a long and a string as an argument.

Get the Win32::API module from Acivestate's PPM repository
(<http://www.activestate.com/packages/>) and install it. Then check out
the docs on how to call functions from a DLL. The docs indicate that
it's main purpose is to use Windows' own API functions, but I believe it
ought to work with any custom DLL (save ActiveX).

>From CFuncs.h
>long ChkNumber(long xNumber, char *Filter);

It takes a number and a pointer to a string, and returns a number. So,
declare the function with qw(N P) as parameter types and 'N' as return
value type. That should do it. I hope.

-- 
	Bart.


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

Date: Mon, 08 May 2000 18:54:06 GMT
From: atomshop_1@my-deja.com
Subject: keep-alive
Message-Id: <8f72g5$q1e$1@nnrp1.deja.com>

Is this the proper systax for keep-alive in the http header?
How effective is this at creating persistent connections?
Thanks.

# Create a user agent object
$ua = new LWP::UserAgent;
$ua->agent("AgentName/0.1 " . $ua->agent);
$ua->proxy('http'=>'http://proxy');


$req = new HTTP::Request 'POST','http://somewhere.com';
$req->proxy_authorization_basic("user", "pass");
$req->content_type('application/x-www-form-urlencoded');
$req->header(Connection => 'Keep-Alive');
$cont_str = "'field1=1&field2=2'";
$req->content($cont_str);


# pass request to the user agent and get a response back
$res = $ua->request($req);
	if ($res->is_success) {
	        print "succesful";
		$html_rec = $res->content;
		print $html_rec;

	} else {
		print "request not a success\n";
   	}


Darren Bard
atomshop@hotmail.com


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


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

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


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