[22770] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4991 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 16 06:05:38 2003

Date: Fri, 16 May 2003 03: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)

Perl-Users Digest           Fri, 16 May 2003     Volume: 10 Number: 4991

Today's topics:
    Re: [The/My] trouble with Perl (Villy Kruse)
    Re: [The/My] trouble with Perl <simon.andrews@bbsrc.ac.uk>
    Re: [The/My] trouble with Perl <geenspam@geenspam.biz>
    Re: [The/My] trouble with Perl <parv_fm@emailgroupsWhereElse.net>
    Re: [The/My] trouble with Perl <geenspam@geenspam.biz>
    Re: [The/My] trouble with Perl <geenspam@geenspam.biz>
    Re: [The/My] trouble with Perl <geenspam@geenspam.biz>
    Re: [The/My] trouble with Perl <geenspam@geenspam.biz>
    Re: [The/My] trouble with Perl <geenspam@geenspam.biz>
    Re: change a format patern <john.thetenant-s@moving-picture.com>
        concise code competition <jvandervloet@hotmail.com>
    Re: full 256 ascii auto string increment? (Anno Siegel)
        HELP: module installation without root password <nospam@nospam.com>
    Re: HELP: module installation without root password (Anno Siegel)
        multiple sorts on an array <jvs+nospam@india.ti.com>
    Re: my and dereferences (Jay Tilton)
    Re: my and dereferences (Anno Siegel)
    Re: my and dereferences (T. Postel)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 16 May 2003 07:49:32 GMT
From: vek@station02.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: [The/My] trouble with Perl
Message-Id: <slrnbc9600.1v9.vek@station02.ohout.pharmapartners.nl>

On Thu, 15 May 2003 22:07:28 +0200,
    Henk van Bree <geenspam@geenspam.biz> wrote:


>Abigail wrote:
>> I'm confused. You make an application, and as part of the application
>> it's ok to include Tk, which has a buttload of files, but it's not ok
>> to roll out Perl, which is also just a buttload of files?
>
>That's the short version of it, yes. The application will be deployed
>in several financial institutions (banking and insurance) and one of
>the requirements is that there can be no (as in none whatsoever)
>development tools on the client machines. Combined with other rather
>stringent security measures this will ensure no-one tampers with
>the programs and datasets.
>


That pretty much rules out Perl as an option, doesn't it, along with
any other scripting languages.  



Villy


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

Date: Fri, 16 May 2003 08:51:06 +0100
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: [The/My] trouble with Perl
Message-Id: <3EC4986A.6030804@bbsrc.ac.uk>


Henk van Bree wrote:
> Darren Dunham wrote:
> 
> 
>>>I still need Tk installed, don't I?
>>
>>Just on your development machine.  Not on the machines you're
>>distributing to.
> 
> 
> Hmm, I was under the impression I required at least 'tk?.dll'
> and some windows registry settings. I'll look into that!

You are under a mistaken impression.  We use the pp utility within the 
PAR module distribution to bundle up Perl/Tk apps into Windows 
executables.  The whole thing comes down to a single executable and a 
perl DLL.  If you are running a statically linked Perl on your 
development machine then you can even bundle everything into a single 
(although somewhat bigger) .exe.

Installation on the target machine is as simple as copying the file.  No 
complex setup, no registry editing, nothing.  In our case we just put 
the exe and dll in the same dir on a read-only network share and let 
everyone run it from there.  Works like a charm, and not a hint of perl 
installed on any client machine.

Hope this helps

Simon.

PS If you want a reason to not use Perl/Tk, then try interacting nicely 
with windows print queues - but that's another thread :-)




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

Date: Fri, 16 May 2003 11:28:42 +0200
From: Henk van Bree <geenspam@geenspam.biz>
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4a133$0$49116$e4fe514c@news.xs4all.nl>

henq wrote:

> I use GhostScript as an alternative to GD. Gives you cleaner graphics with
> anti-aliasing and more effects, like scaling and rotation. As GhostScript
> installs with its own fonts, it usually runs with 1 install.  The
> postscript language takes some time to grok, however.

Actually, I'm moderately fluent in PostScript. However, I can't use this
because I have to update the graph in realtime and continuous generating
of PostScript images might be a bit clumsy.

Thank for your input though, it's an interesting angle.

Henk



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

Date: Fri, 16 May 2003 08:32:18 GMT
From: parv <parv_fm@emailgroupsWhereElse.net>
Subject: Re: [The/My] trouble with Perl
Message-Id: <slrnbc98q0.brk.parv_fm@localhost.holy.cow>

in message <pan.2003.05.15.19.09.13.886487@kamelfreund.de>,
wrote Janek Schleicher ...

> If you want a native GUI widget set, just write one.
> 
> But don't force me to use it or even to download it, only because
> anyone thought it is necessary.

I am w/ you...

> It is the philosophy of Perl, that the programmer can and will
> choose what he/she needs or wants for his/her job.

 ...and some (CGI|Net)::* modules being included in perl 5.8 by
default is unsettling to me in the same sense as above.


  - parv

-- 

  please don't send me private e-mail.
  if you must, do away w/ WhereElse in the address.


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

Date: Fri, 16 May 2003 11:43:53 +0200
From: Henk van Bree <geenspam@geenspam.biz>
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4a4c2$0$49108$e4fe514c@news.xs4all.nl>

Janek Schleicher wrote:

>>         **Let Perl 7 have a native GUI widget set!**
>> 
>> So far I've tried to get Qt, WxWindows, Gtk and/or Tk to work, with
>> several degrees of succes but it just doesn't work everytime.
> 
> These are all native GUI widget sets.
> The Perl modules are mostly only wrappers around the native parts.

Ah, miscommunication. I meant native to Perl. As in, built in to the
language. This would avoid having to muck around with incompatible widgets 
sets on different platforms and would help general portability a great 
deal.

> Perhaps the simplest answer, why it shouldn't be a "fixed" (core) part of
> Perl is, that it would break the main principle of Perl:
> 
> There's More Than One Way To Do It.

And sometimes, it might be a good idea to provide a way to actually
accomplish a task. Sure, Perl is very flexible in general but I would dare 
you to write a simple application (say, one window, with one button) that 
runs on both Linux and Windows from the same Perl source.

> If you want a native GUI widget set,
> just write one.

I meant native as "built in", not as another slightly different way to 
handle a basic task.

> But don't force me to use it or even to download it,
> only because anyone thought it is necessary.
> (Personally I'm programming now in Perl for nearly 3 years,
>  but I needed a graphic output for only 1 month in all the years.
>  If I would have worked me in a complicated graphic toolkit -
>  as every graphic toolkit is complicated when it is complex -
>  I would have needed 2 months for the job,
>  and the output would have been perhaps only slightly better.
> )

So how do you handle user interaction? Are you only writing scripts or 
full-fledged user applications?

> Let's see it in a different way.
> Java e.g. has something like a native GUI widget set
> (Don't flame me, I'm not really a Java expert, if it's wrong)
> That's on the one hand nice as you can guarantee that the application
> looks the same at the client side as on your developper side.
> But it also has some downsides.
> Even if the client doesn't need the graphic,
> he will install at least the JRE with >20 MB IIRC,
> where the Perl interpreter works with <1 MB + the module sizes.

I see your point, but I disagree... ;-)

Maybe we can have both our way, by having a native (built in) widget set, 
with language construct to use it and then have a compile time option to 
include or remove it in the Perl version you use.

> Nowadays in Perl, you have the choice,
> taking the simple Tk,
> the quick and beautiful, but harder to program, Qt,
> the known feeling from [mw]xWindows,
> a complete different interface from PRIMA,
> or what I would suspect of professional program,
> the superquick, programmer friendly Curses interface.

You essentially make my point for me, with this. You are right on a 
theoretical level, but if you try to get it to work (portably) it just 
won't do. Most of the toolkits work only on one platform, or have almost no 
documentation, are just not finished/polished enough to be usable.

> I don't say that the Java way is better or worse,
> it's just another philosophy that wouldn't fit to Perl and its programmers
> IMHO.

I consider myself a Perl programmer, and I too thought everything could be 
solved by 'just installing a module', but lately I've experienced the 
bitter side of it: no standardisation and no real support for multiple 
platforms. And I for one think that this holds back Perl from being useful 
for 'normal' application development. 

Henk



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

Date: Fri, 16 May 2003 11:46:09 +0200
From: Henk van Bree <geenspam@geenspam.biz>
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4a54a$0$49108$e4fe514c@news.xs4all.nl>

Janek Schleicher wrote:

> Henk van Bree wrote at Thu, 15 May 2003 19:30:42 +0200:
> 
>>> (3) spamcodes his email address
>> 
>> True. I'm getting over a hundred (100) spams a day already,
>> I have no desire for more. If you have a solution to my
>> problem that you are not willing or able to post but are
>> willing and able to mail, please use the address below, your
>> input is greatly appreciated.
> 
> Have a look to the CPAN module
> Mail::SpamAssassin

Thank you for trying to help me, but I'm already subscribed to
blacklist services and have a Bayesian filter running. You wouldn't
believe the amount of spam in my raw, unfiltered feed...

Henk



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

Date: Fri, 16 May 2003 11:48:32 +0200
From: Henk van Bree <geenspam@geenspam.biz>
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4a5d9$0$49108$e4fe514c@news.xs4all.nl>

Abigail wrote:

> Henk van Bree (geenspam@geenspam.biz) wrote on MMMDXLIV September
> MCMXCIII in <URL:news:3ec3e567$0$49104$e4fe514c@news.xs4all.nl>:
> :)  Abigail wrote:
> :) > I'm confused. You make an application, and as part of the application
> :) > it's ok to include Tk, which has a buttload of files, but it's not ok
> :) > to roll out Perl, which is also just a buttload of files?
> :)
> :)  That's the short version of it, yes. The application will be deployed
> :)  in several financial institutions (banking and insurance) and one of
> :)  the requirements is that there can be no (as in none whatsoever)
> :)  development tools on the client machines. Combined with other rather
> :)  stringent security measures this will ensure no-one tampers with
> :)  the programs and datasets.
> 
> Well, can Perl be on the client machine? If it can, you can deploy it
> as part of the application. If it cannot, this entire exercise is
> academic, isn't?

No, Perl can't be installed on the client machine, at least not a 
development version. That was never meant to be, as the application can be 
compiled and deployed. Some support files are OK, as long as there are no 
option for the user to execute unautorised code on the dataset.

Henk



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

Date: Fri, 16 May 2003 11:49:18 +0200
From: Henk van Bree <geenspam@geenspam.biz>
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4a607$0$49108$e4fe514c@news.xs4all.nl>

Villy Kruse wrote:

> That pretty much rules out Perl as an option, doesn't it, along with
> any other scripting languages.

No, while Perl can't be installed on the client machine, at least not a 
development version, the application can be compiled and deployed. Some 
support files are OK, as long as there are no option for the user to 
execute unautorised code on the dataset.

Henk



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

Date: Fri, 16 May 2003 11:54:44 +0200
From: Henk van Bree <geenspam@geenspam.biz>
Subject: Re: [The/My] trouble with Perl
Message-Id: <3ec4a74d$0$49114$e4fe514c@news.xs4all.nl>

Simon Andrews wrote:

>> Hmm, I was under the impression I required at least 'tk?.dll'
>> and some windows registry settings. I'll look into that!
> 
> You are under a mistaken impression.  We use the pp utility within the
> PAR module distribution to bundle up Perl/Tk apps into Windows
> executables.  

This is really great, I must have done something wrong/differently with
my initial test setup then. I'll try again.

> The whole thing comes down to a single executable and a
> perl DLL.  If you are running a statically linked Perl on your
> development machine then you can even bundle everything into a single
> (although somewhat bigger) .exe.

One big .exe (for the Windows boxes) is prefered. Have you also done this
on Linux? If it works it solves almost all of my problems! (Still have to
get GD to play nice, but that I'm confident about).

> Hope this helps

It does. A lot.

> PS If you want a reason to not use Perl/Tk, then try interacting nicely
> with windows print queues - but that's another thread :-)

I don't need printing, so no trouble there! ;-)

Thanks!
Henk



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

Date: Fri, 16 May 2003 09:39:52 +0100
From: John Strauss <john.thetenant-s@moving-picture.com>
Subject: Re: change a format patern
Message-Id: <20030516093952.7eb04dec.john.thetenant-s@moving-picture.com>

On Fri, 16 May 2003 00:15:59 +0000
Mario542 <member17678@dbforums.com> wrote:
>
> 
> Does anyone know how to change the format pattern of a query from a perl
> script?  When I run the perl script it returns the total amout of
> 3642.0500 from the database. What I am tring to do is change it to
> 3,642.05 without the extra zeros so it looks better for the user.
> 
> Thanks for all the help,
> Mario
> 
> --
> Posted via http://dbforums.com

you could just it after extracting from the database, 
rather than trying to do it in the db query.

try out Number::Format from CPAN http://search.cpan.org/author/WRW/Number-Format-1.45



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drop the .thetenant to get me via mail


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

Date: Fri, 16 May 2003 09:58:58 GMT
From: "joeri" <jvandervloet@hotmail.com>
Subject: concise code competition
Message-Id: <CD2xa.4452$1u5.337@afrodite.telenet-ops.be>

Hi folks,

we're having ourselves a little competition here
on making the following code as concise as possible,
without loosing any performance. Here's the code as it is now:

    opendir(DIR, $dir="c:/dir") or die "$!";
    mkdir("$dir/output");

    for(grep(/\.txt$/, readdir(DIR))) {
        open(FILE, "$dir/$_") or die "$!";
        $out = "$dir/output/$_";
        open(OUT, ">$out") if !-e $out || -z $out;
        for(@strings=<FILE>) {
            $_ =~ s/=/\n/g;
            print OUT;
        }
        close OUT;
        close FILE;
    }

So what it does basically is read in all the .txt files from a specified
directory,
replace all "=" tokens by a newline, opens an outputfile of the same name in
a subdirectory
of the directory where one is reading the files from called "output" and
writes the text there.
That's it.
Any of you guys have a way of writing the above code more compact?

J




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

Date: 16 May 2003 09:54:09 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: full 256 ascii auto string increment?
Message-Id: <ba2cg1$mi6$1@mamenchi.zrz.TU-Berlin.DE>

LBX10 <no.spam@spam.com> wrote in comp.lang.perl.misc:
> What is the best way to go about incrementing a string so as to use all 256
> chars (ASCII) instead of just [A-Za-z0-9] ?
> 
> So I can cycle al the way from \0x00 all the way to
> \xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF
> (that is, those hex values are really characters just not printable ones but
> define the full range.)

You will have to do that yourself, the magical string increment keeps
characters in printing range.  This seems to do it, but needs more
testing:

    sub inc_str {
        my $n = length $_[ 0];
        while ( $n-- ) {
            last if ++ vec( $_[ 0], $n, 8);
        }
        $_[ 0] = chr( 1) . $_[ 0] unless vec( $_[ 0], 0, 8);
    }

If you need it to be extremely fast, consider Bit::Vector.

Anno


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

Date: Fri, 16 May 2003 10:47:06 +0200
From: "Stiv" <nospam@nospam.com>
Subject: HELP: module installation without root password
Message-Id: <JB1xa.54940$DN.1337579@tornado.fastwebnet.it>

Hello everybody,
I have problems with installing Perl modules with dependencies on a Linux
system where I haven't the root password.
I had to install the File::Tail module, and it required the module
Time::HiRes as the only dependency.
I've installed the letter using:

perl Makefile.PL PREFIX=/home/mydir/Perl/Modules  followed by

make, make test and make install

Then, trying to install the File::Tail I got an error message for missing
dependency, because there was no local modules path indication in @INC.
I edited the code to find a way to insert manually the path, but without
succcess.
In my Perl books I haven't found any explanation of the problem and how to
resolve it, and so on the Internet using Google.
Could anybody tell me how to set the path of the local dependency module
necessary to complete the installation of the File.:Tail?
Thanks in advance.

Stiv





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

Date: 16 May 2003 09:11:30 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: HELP: module installation without root password
Message-Id: <ba2a02$kdn$1@mamenchi.zrz.TU-Berlin.DE>

Stiv <nospam@nospam.com> wrote in comp.lang.perl.misc:
> Hello everybody,
> I have problems with installing Perl modules with dependencies on a Linux
> system where I haven't the root password.
> I had to install the File::Tail module, and it required the module
> Time::HiRes as the only dependency.
> I've installed the letter using:
> 
> perl Makefile.PL PREFIX=/home/mydir/Perl/Modules  followed by
> 
> make, make test and make install
> 
> Then, trying to install the File::Tail I got an error message for missing
> dependency, because there was no local modules path indication in @INC.
> I edited the code to find a way to insert manually the path, but without
> succcess.
> In my Perl books I haven't found any explanation of the problem and how to
> resolve it, and so on the Internet using Google.
> Could anybody tell me how to set the path of the local dependency module
> necessary to complete the installation of the File.:Tail?
> Thanks in advance.

Have you tried setting then environment variable PERL5LIB to your
private directory?  I would have expected the build process to do
that, but from what you say it doesn't.

Anno


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

Date: 16 May 2003 07:39:38 GMT
From: Jahagirdar Vijayvithal S <jvs+nospam@india.ti.com>
Subject: multiple sorts on an array
Message-Id: <ba24jq$ggd$1@home.itg.ti.com>

I was trying to interactively group the contents of an array based on
pattern match and sort operation. for eg if the array is 
aabbcc
aaefgh
aaghe
aafftr
abbef
abbec
afgcc
abcc

the patterns given interactively by me would be something like 
first pattern \baa
sort
second pattern \ba.*bb
sort
third pattern \ba.*cc
sort
and the final expected result is 

aabbcc
aaefgh
aaghe
aafftr
abbef
abbec
aabbcc
afgcc
abcc


The actual codefragement use is at the end of this post
is there a way to retain previously sorted part of the array  without
using a second array? or is grep the only way to go?

Regards
Jahagirdar Vijayvithal S

-----------------------------codefragment--------------------------------
foreach $bar (keys (%foo)){                        
	my $sortpattern=<STDIN>;                   
	chomp $sortpattern;                        
	my @sort_result =sort {                    
		my $return_val=+1;                 
		if ($a=~ /$sortpattern/){          
			$return_val-=2             
		}                                  
		if ($b =~ /$sortpattern/){         
				$return_val+=1;    
			}                          
		return $return_val;                
	} @{$foo{$bar}{contents}};                 
	@{$foo{$bar}{contents}}=@sort_result;      
	redo;
}
-----------------------------codefragment--------------------------------


-- 
A couple of Months? It's only Software!  
Jahagirdar .V.S 
IC Design Engineer , Texas Instruments (India) Ltd.
91-80-5099129(O)


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

Date: Fri, 16 May 2003 08:01:52 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: my and dereferences
Message-Id: <3ec49a46.255775682@news.erols.com>

T.Postel@ieee.org (T. Postel) wrote:

: Can someone explain this to me:
:    @one = (0, 1);
: my @two = (4, 5);
: my $test1 = 'one';
: my $test2 = 'two';
: 
: print "@$test1 \n@$test2\n$]";
: 
: shows this:
: Name "main::one" used only once: possible typo at one.pl line 2.
: 0 1 
: 
: 5.00503

What would you like explained?

"@$test1" prints the contents of @one by using a symbolic reference.

"@$test2" does not print the contents of @two because lexical
variables cannot be accessed through symbolic references.



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

Date: 16 May 2003 08:18:37 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: my and dereferences
Message-Id: <ba26st$irj$1@mamenchi.zrz.TU-Berlin.DE>

T. Postel <T.Postel@ieee.org> wrote in comp.lang.perl.misc:
> Can someone explain this to me:
>    @one = (0, 1);
> my @two = (4, 5);
> my $test1 = 'one';
> my $test2 = 'two';
> 
> print "@$test1 \n@$test2\n$]";
> 
> shows this:
> Name "main::one" used only once: possible typo at one.pl line 2.
> 0 1 
> 
> 5.00503

You should say which behavior you expected and how the actual behavior
differs.  You are using symbolic references (see perldoc -q 'variable as'
for why that is usually a bad idea).  Only package variables can be
accessed through symbolic references, that accounts for the difference
in behavior between @one and @two.

Anno


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

Date: Fri, 16 May 2003 09:10:30 GMT
From: T.Postel@ieee.org (T. Postel)
Subject: Re: my and dereferences
Message-Id: <aW1xa.161$rO.24707@newsread1.prod.itd.earthlink.net>

In article <ba26st$irj$1@mamenchi.zrz.TU-Berlin.DE>, anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
>T. Postel <T.Postel@ieee.org> wrote in comp.lang.perl.misc:
>> Can someone explain this to me:
>>    @one = (0, 1);
>> my @two = (4, 5);
>> my $test1 = 'one';
>> my $test2 = 'two';
>> 
>> print "@$test1 \n@$test2\n$]";
>> 
>> shows this:
>> Name "main::one" used only once: possible typo at one.pl line 2.
>> 0 1 
>> 
>> 5.00503
>
>You should say which behavior you expected and how the actual behavior
>differs.  You are using symbolic references (see perldoc -q 'variable as'
>for why that is usually a bad idea).  Only package variables can be
>accessed through symbolic references, that accounts for the difference
>in behavior between @one and @two.
>
>Anno

Thank you Anno & Jay. I remember that, only package variables are visible to 
symbolic references, now. I don't use symbolic references as a rule, and here's 
one reason why.


-- 
While my e-mail address is not munged,     | T.Postel@ieee.org
I probably won't read anything sent there. |


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

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


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