[21775] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3979 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 16 06:10:43 2002

Date: Wed, 16 Oct 2002 03:10:15 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 16 Oct 2002     Volume: 10 Number: 3979

Today's topics:
    Re: Opinion on using Perl or JavaScript for Web develop <nobody@nowhere.com>
    Re: Opinion on using Perl or JavaScript for Web develop <ron@savage.net.au>
    Re: OS interface <frank.winkler@sun.com>
    Re: OS interface <mgjv@tradingpost.com.au>
        Peculiar problem with Win32::OLE (No type library match <rubberducky703@hotmail.com>
    Re: Peculiar problem with Win32::OLE (No type library m <david.hawley@acm.org>
    Re: Perl Memory Management (MMichalow)
    Re: Perl2exe problem. (MMichalow)
    Re: Random Character Picker <andrew_harton@agilent.com>
    Re: Random Character Picker <krahnj@acm.org>
    Re: silent detection of cgi completion problem <flavell@mail.cern.ch>
    Re: Using Perl to solve interesting Banking Probm .. <jobrien@ticon.net>
    Re: Using Perl to solve interesting Banking Probm .. (Jay Tilton)
    Re: Using Perl to solve interesting Banking Probm .. <bart.lateur@pandora.be>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 16 Oct 2002 17:10:24 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Re: Opinion on using Perl or JavaScript for Web development
Message-Id: <a98r9.53879$g9.156000@newsfeeds.bigpond.com>

Brian wrote in message <9d13498b.0210151551.7dc7f22f@posting.google.com>...
>This is more of an opinion question than anything.  Hopefully I will
>go down the right track after your responses...
>
>I need to develop a web page.  It will need to have radio buttons,
>drop downs, and list boxes.  The drop down menus need to be cascading
>(i.e. change an option in the first menu and the values listed in the
>second menu change).  Also, the second menu has to be populated by
>reading the directory structure of a server.  The list box is
>populated from the list of files that are in the directory of the
>second drop down.  Because of that, I can not get CGI (or CGI.pm) to
>work.
You are very confused.

>  Once the values are entered in the radio buttons and the drop
>downs, the user will need to click a button (submit or otherwise) and
>a perl script will need to run that will create a JPG or PNG file.
>Then a new web page will need to open displaying some text and the
>file.
Perl can create jpeg and png files using the GD module.

>
>My problem is:
>If I use all Perl - I can not get a GUI web interface.
You are now very confused. Perl is one of the major cgi languages.

> If this is
>wrong and I can do this whole thing in Perl PLEASE TELL ME!!!
Lots of people do cgi in Perl. I don't see why your requirements are all
that different from most.

>1 already have most of the code written in Perl and would really hate to
>change it.
>
>If I use CGI - I can not get cascading menus to work correctly and can
>not access the directories on the server.  This is a limitation of CGI
>- correct?
No. Perl generates HTML. It's up to the broser how to interpret it.

>
>If I use Javascript... Well - I don't know much about Javascript and I
>thought that was going to be my answer.  But then I read a bunch of
>posts where people are talking about server side/client side JS and
>basically that you should not mix perl and JS.

You can include Javascript as part of the HTML generated by Perl cgi.
>
>The last option is PHP - which I know NOTHING about other than how to
>spell it.
I can spell PHP either.

gtoomey




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

Date: Wed, 16 Oct 2002 19:55:14 +1000
From: "Ron Savage" <ron@savage.net.au>
Subject: Re: Opinion on using Perl or JavaScript for Web development
Message-Id: <aojd3t$2of2$1@arachne.labyrinth.net.au>

"Brian" <BChirhart@fnni.com> wrote in message news:9d13498b.0210151551.7dc7f22f@posting.google.com...
> This is more of an opinion question than anything.  Hopefully I will
> go down the right track after your responses...
>
> I need to develop a web page.  It will need to have radio buttons,
> drop downs, and list boxes.  The drop down menus need to be cascading
> (i.e. change an option in the first menu and the values listed in the
> second menu change).  Also, the second menu has to be populated by
> reading the directory structure of a server.  The list box is

Brian

There is a new module, DBIx::HTML::LinkedMenus available from CPAN and from http://savage.net.au/Perl-modules.html

It has not appeared in comp.lang.perl.announce yet.

--
Cheers
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html




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

Date: Wed, 16 Oct 2002 10:27:09 +0200
From: Frank Winkler - Sun Germany - Enterprise Services <frank.winkler@sun.com>
Subject: Re: OS interface
Message-Id: <1034756830.560492@intranet.consol.de>

Martien Verbruggen wrote:

> Proc::ProcessTable is pretty generic, for all sorts of Unices [1].

I'll take a look at it, thanks.

>>For df, there are unixish solutions, but nothing generic, looking for 
>>'disk'. Could be a gap in the market there :-)
>
> The most likely to work (they come bundled):

Bundled with what? At least, they aren't in the standard Perl distribution.

But maybe I'll try to write a pm issuing an accurate 'df' command for
every affected OS ...

> [1] I'm simply assuming that the OP is only interested in Unices,
> since they specifically mentioned the df and ps commands, and they are
> posting from a Sun address. If that is not true, then the OP should
> probably have mentioned it.

You're absolutely right! :)

Regards

-- 
---------------------------------------------------------------------------
Frank Winkler                                 frank.winkler@germany.sun.com
Sun Microsystems - Remote Admin Center
Sonnenallee 1                                       Voice +49 89 46008.2755
85551 Heimstetten - Germany                           Fax +49 89 46008.2740



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

Date: Wed, 16 Oct 2002 18:54:31 +1000
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: OS interface
Message-Id: <slrnaqqaa7.q36.mgjv@martien.heliotrope.home>

On Wed, 16 Oct 2002 10:27:09 +0200,
	Frank Winkler - Sun Germany - Enterprise Services
	<frank.winkler@sun.com> wrote:
> Martien Verbruggen wrote:

[referring to Filesys::Statvfs and Filesys:Df]

>> The most likely to work (they come bundled):
> 
> Bundled with what? At least, they aren't in the standard Perl
> distribution.

Bundled together is what I meant. The Filesys::Df module uses the
Filesys::Statvfs module to get its information, and doesn't rely on
external programs. Should make it faster as well.

Martien
-- 
                        | 
Martien Verbruggen      | Failure is not an option. It comes bundled
                        | with your Microsoft product.
                        | 


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

Date: Wed, 16 Oct 2002 09:22:58 +0100
From: "Rubber Duck" <rubberducky703@hotmail.com>
Subject: Peculiar problem with Win32::OLE (No type library matching "Microsoft Excel")
Message-Id: <aoj7iu$n4ie2$1@ID-116287.news.dfncis.de>

 I'm experiencing a peculiar problem with one of my perl scripts.  I have
written a script, which creates a MS Graph using win32::Ole.



I have the script up and running fine here on my localhost.  However I have
transferred the same script over to a test machine and I'm getting all sorts
of errors:



E:\perl>perl.exe queries.pl

No type library matching "Microsoft Excel" found at queries.pl line 10

Win32::OLE(0.1101): GetOleTypeLibObject() Not a Win32::OLE::TypeLib object
at E:/perl/site/lib/Win32/OLE/Const.pm line 34.

Bareword "xlPrevious" not allowed while "strict subs" in use at queries.pl
line 156.

 ...

Execution of script.pl aborted due to compilation errors.



The interesting thing is that the perl distro on the test machine is the
same as the one i'm using and both have the same version of Win32::OLE, any
ideas why i could be getting these error and anything in particular i should
look for.



Thanks

RD




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

Date: Wed, 16 Oct 2002 17:24:53 +0900
From: "Sojourneer" <david.hawley@acm.org>
Subject: Re: Peculiar problem with Win32::OLE (No type library matching "Microsoft Excel")
Message-Id: <aoj7j3$5r9$1@newsflood.tokyo.att.ne.jp>



> I have the script up and running fine here on my localhost.  However I
have
> transferred the same script over to a test machine and I'm getting all
sorts
> of errors:
> No type library matching "Microsoft Excel" found at queries.pl line 10

I would guess that Excel is not installed on the server, so Perl can't find
its typelib.




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

Date: 16 Oct 2002 02:51:43 -0700
From: michalowski@interred.de (MMichalow)
Subject: Re: Perl Memory Management
Message-Id: <7cd9e5d7.0210160151.2ffec82f@posting.google.com>

Benjamin Goldberg <goldbb2@earthlink.net> wrote in message news:<3DAC5844.9EA31869@earthlink.net>...
> Michael Carman wrote:
> [snip]
> > > Is it sufficient to restart single thread?
> > 
> > Hmm... dunno. I've never really played with threads.
> 
> Each thread has it's own malloc arena, created with mmap.
> 
> When the thread finishes, the entire arena is freed.
That sounds good...
 
> So yes, letting the thread die and starting a new one in it's place
> *should* be sufficient.  *However*, when you start a new thread, it gets
> a copy of it's *entire* parent thread's perl interpreter.  So, you
> should have your 'main' thread (the original one which starts with perl
> in it) really minimal, and load as few modules as it can, and only have
> the threads it starts load modules, so that if you want to have a thread
> get restarted, it can tell the main thread to do that (rather than doing
> it itself, which copies too much info, defeating the purpose).
O.k. I will take account of this. What's about shared variables of the
main thread? Are they 'copied' to the child threats? I think, they are
not, are they?
 
> PS: Shared arrays leak memory -- I'm not sure whether restarting a
> thread will decrease this leak.  Re-execing perl will clean up leaked
> data, though :)
Yes, I tripped over this at the beginning. But I found some Thread::*
Modules, which compensate these behaviour.


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

Date: 16 Oct 2002 02:32:57 -0700
From: michalowski@interred.de (MMichalow)
Subject: Re: Perl2exe problem.
Message-Id: <7cd9e5d7.0210160132.3cc1720a@posting.google.com>

Then the modules are possibly dependencies of the .exe convert.
Go to the URL http://search.cpan.org and use the "CPAN search" for
'Convert::EBCDIC' and 'Mac::InternetConfig'.
It seems like, you'll need them :-)


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

Date: Wed, 16 Oct 2002 10:21:10 +0100
From: "Andrew Harton" <andrew_harton@agilent.com>
Subject: Re: Random Character Picker
Message-Id: <1034759924.687386@cswreg.cos.agilent.com>

Benjamin Goldberg wrote:
> John W. Krahn wrote:
>>
>> PinkPuppy wrote:
>>>
>>> I'd like to write a script that generated a specified number of
>>> random characters.  I want to be able to specify which characters to
>>> choose from.
>>> Can someone show me some simple sample code that does something like
>>> this?
>>
>> my @characters = map chr, 0 .. 255;
>> my $random_character = $characters[rand @characters];
>
> That's just plain silly.
>
>   my $random_character = chr rand 256;

 ..but including non-printable characters is probably not what's wanted.

How about this?

my $random_printable = chr ((rand 224) + 32);

Andrew

--
$s="acehJklnoPrstu ";$_="4dbce078c32ae92a6e30152a";
split//;for(0..$#_){print substr($s,hex $_[$_],1);}




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

Date: Wed, 16 Oct 2002 09:35:58 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Random Character Picker
Message-Id: <3DAD32CE.17F0F52B@acm.org>

Andrew Harton wrote:
> 
> Benjamin Goldberg wrote:
> > John W. Krahn wrote:
> >>
> >> my @characters = map chr, 0 .. 255;
> >> my $random_character = $characters[rand @characters];
> >
> > That's just plain silly.
> >
> >   my $random_character = chr rand 256;
> 
> ..but including non-printable characters is probably not what's wanted.
> 
> How about this?
> 
> my $random_printable = chr ((rand 224) + 32);

But that includes non-printable characters like 127 and 255.



John
-- 
use Perl;
program
fulfillment


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

Date: Wed, 16 Oct 2002 11:41:43 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: silent detection of cgi completion problem
Message-Id: <Pine.LNX.4.40.0210161107240.8265-100000@lxplus071.cern.ch>

On Oct 15, Steve inscribed on the eternal scroll:

> I have a perl cgi which is submitted from javascript function using an
> image as the return (because I don't want the current webpage
> disturbed).

Advice: when you're down a hole, stop digging.

I'd risk expressing the opinion that although we don't yet know enough
about what you're trying to achieve in real-world terms, it's already
looking as if you've designed your way into an over-complex solution.

And by the way, you don't seem to have a Perl language problem.

> Does anyone have a successful way to detect when the cgi has finished,
> without wiping away the original webpage?

If you really just wanted the answer to the question that you asked,
then it looks like a CGI FAQ:
http://www.htmlhelp.com/faq/cgifaq.3.html#14

I.e if the response is an HTTP status of 204, it tells the client that
it's supposed to stay on the same page.

However, I suspect this may not really be what you want.

Why do you want to "detect when the cgi has finished"?  The idea of a
CGI script is that the client invokes a URL, the server prepares the
data for the script, the script runs for a short time, and returns a
result to the server, which in turn returns the HTTP protocol response
to the client.  End of story.

The initial HTTP request, and the closing HTTP response, are the only
communications which take place between the client and the server in a
single transaction cycle: there's no kind of intermediate opportunity
for any "detection" to occur.

If the script is liable to run for longer than it's reasonable to
expect the user to wait, then a significantly different approach is
called for.

> Please provide syntax if you have it.

The syntax of your programming language is irrelevant at this level.
I'm pretty convinced we have an XY problem: you're showing us an
apparently complex design that somehow isn't doing what you need,
but you haven't told us what real-world task it's meant to perform.



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

Date: Tue, 15 Oct 2002 23:10:31 -0500
From: "John F. O'Brien" <jobrien@ticon.net>
Subject: Re: Using Perl to solve interesting Banking Probm ..
Message-Id: <aoiorp$m38$1@galileo.ticon.net>

This is a multi-part message in MIME format.

------=_NextPart_000_0098_01C274A0.0EB99D30
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Small question here.  I was able to mostly figure this script out except =
for the expression=20

"($2^v1)" on the second line.  I know it "flips" $2, 1 becomes 0 and =
vice versa, but what does the 'v' in 'v1' do?


> Arrays and while loops are boring.
> Strings and for loops are where it's at, daddy-o.
>=20
>     $x=3D0 x($n=3D500);
>     $x=3D~s;(.{$_})(.);$1.($2^v1);egfor 0..$n-1;
>     ++$i,print"$i "x$_ for$x=3D~/./g;
>=20

------=_NextPart_000_0098_01C274A0.0EB99D30
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2></FONT><FONT size=3D2>Small question =
here.&nbsp; I=20
was able to mostly figure this script out except for the expression=20
</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>"($2^v1)" on the second line.&nbsp; I know it =
"flips" $2, 1=20
becomes 0 and vice versa, but what does the 'v' in 'v1' do?</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV><FONT face=3DArial size=3D2><FONT =

face=3D"Courier New">&gt; Arrays and while loops are boring.<BR>&gt; =
Strings and=20
for loops are where it's at, daddy-o.<BR>&gt; <BR>&gt; =
&nbsp;&nbsp;&nbsp; $x=3D0=20
x($n=3D500);<BR>&gt; &nbsp;&nbsp;&nbsp; =
$x=3D~s;(.{$_})(.);$1.($2^v1);egfor=20
0..$n-1;<BR>&gt; &nbsp;&nbsp;&nbsp; ++$i,print"$i "x$_=20
for$x=3D~/./g;<BR>&gt;</FONT> </FONT></BODY></HTML>

------=_NextPart_000_0098_01C274A0.0EB99D30--



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

Date: Wed, 16 Oct 2002 05:21:27 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Using Perl to solve interesting Banking Probm ..
Message-Id: <3dacedb4.113757119@news.erols.com>

"John F. O'Brien" <jobrien@ticon.net> wrote:

| This is a multi-part message in MIME format.

Please don't post HTML.

| Small question here.  I was able to mostly figure this script out except
| for the expression
| 
| "($2^v1)" on the second line.  I know it "flips" $2, 1 becomes 0 and
| vice versa, but what does the 'v' in 'v1' do?

It creates a string of characters.
It's described somewhere in perldata...I think.
I can never find it, and grepping on 'v' is futile.

v1 creates a string containing ASCII character 1.
v1.2 creates one containing characters 1 and 2.
v5.6.1 creates one containing characters 5, 6, and 1, though the 'v' 
can be thrown out when there are two or more dots in the literal.

v74.117.115.116.32.97.110.111.116.104.101.114.32.80.101.114.108.32.104.97.99.107.101.114.44
creates a famous phrase.  Again, the v is optional there.

Any of the following would have done the same thing:
    chr(1)
    "\cA"
    "\x1"
    "\01"

But those are too long, and too easily understood.  :)



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

Date: Wed, 16 Oct 2002 06:02:29 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Using Perl to solve interesting Banking Probm ..
Message-Id: <ftvpqucomp9gkadmomujg1lg041ottn76l@4ax.com>

Jay Tilton wrote:

>| "($2^v1)" on the second line.  I know it "flips" $2, 1 becomes 0 and
>| vice versa, but what does the 'v' in 'v1' do?
>
>It creates a string of characters.
>It's described somewhere in perldata...I think.
>I can never find it, and grepping on 'v' is futile.
>
>v1 creates a string containing ASCII character 1.
>v1.2 creates one containing characters 1 and 2.
>v5.6.1 creates one containing characters 5, 6, and 1, though the 'v' 
>can be thrown out when there are two or more dots in the literal.

"v" stands for version numbers. It's the way recent perls (starting with
5.6.0 IIRC) pack Perl's own version number, for example 5.005_03 would
now become v5.5.3, and 5.6.1 is v5.6.1. Note that these compare properly
as strings.

Grepping for "version" might not be that futile.

Ah, yes, perldata. It also mentions $^V, see perlvar. Another thing to
grep for.

-- 
	Bart.


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 3979
***************************************


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