[19996] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2191 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 23 14:05:49 2001

Date: Fri, 23 Nov 2001 11:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1006542306-v10-i2191@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 23 Nov 2001     Volume: 10 Number: 2191

Today's topics:
        calling perl scripts. <samer.forzley@alcatel.com>
    Re: calling perl scripts. (Anno Siegel)
    Re: calling perl scripts. nobull@mail.com
        Difficulty with references and hashes <lovedaddy@heros-keep.com>
    Re: Difficulty with references and hashes <5l259r001@sneakemail.com>
    Re: Enigma encryption (Mark Jason Dominus)
    Re: Enigma encryption <godzilla@stomp.stomp.tokyo>
    Re: Enigma encryption <godzilla@stomp.stomp.tokyo>
    Re: File locking question (Sara)
    Re: File locking question (Mark Jason Dominus)
    Re: File locking question (Mark Jason Dominus)
    Re: File locking question (Mark Jason Dominus)
    Re: File locking question (Anno Siegel)
    Re: File locking question (Rafael Garcia-Suarez)
    Re: File locking question (Sara)
    Re: How do I make several modules reference variables f (Anno Siegel)
    Re: MX records. <rvdb@comweb.nl>
    Re: Problems adding module to path (Rafael Garcia-Suarez)
    Re: Problems adding module to path <bart.lateur@pandora.be>
    Re: Problems with Mirror - ftp.pl doesn't get the right <bart.lateur@pandora.be>
    Re: Problems with Mirror - ftp.pl doesn't get the right (Anno Siegel)
    Re: Using CGI.pm to obtain a list of params <wsegrave@mindspring.com>
    Re: Using CGI.pm to obtain a list of params <wsegrave@mindspring.com>
    Re: Using CGI.pm to obtain a list of params <flavell@mail.cern.ch>
    Re: Using CGI.pm to obtain a list of params <wsegrave@mindspring.com>
        what are the diff between -w and "use warnings" and $^W (Sara)
    Re: what are the diff between -w and "use warnings" and (Rafael Garcia-Suarez)
    Re: what are the diff between -w and "use warnings" and <krahnj@acm.org>
        Win32::GUI sample <oliver.bork@comtrue.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 23 Nov 2001 11:33:28 -0500
From: Samer Forzley <samer.forzley@alcatel.com>
Subject: calling perl scripts.
Message-Id: <3BFE7A58.341ABDE2@alcatel.com>

This is a multi-part message in MIME format.
--------------B522C65B9D6CA72987A75E6F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi

I wonder if you can help.

I need to call a perl script from another perl script and pass it a list
of files to read. does anyone know what function to use.

thanks

--------------B522C65B9D6CA72987A75E6F
Content-Type: text/x-vcard; charset=us-ascii;
 name="samer.forzley.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Samer Forzley
Content-Disposition: attachment;
 filename="samer.forzley.vcf"

begin:vcard 
n:Forzley;Samer
tel;work:613 784 1856
x-mozilla-html:FALSE
url:www.alcatel.com
org:Alcatel Canada
adr:;;;;;;
version:2.1
email;internet:samer.forzley@alcatel.com
title:Test/Development Coordinator
fn:Samer Forzley
end:vcard

--------------B522C65B9D6CA72987A75E6F--



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

Date: 23 Nov 2001 17:03:43 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: calling perl scripts.
Message-Id: <9tlvhf$8pt$1@mamenchi.zrz.TU-Berlin.DE>

According to Samer Forzley  <samer.forzley@alcatel.com>:
> -=-=-=-=-=-
> 
> Hi
> 
> I wonder if you can help.
> 
> I need to call a perl script from another perl script and pass it a list
> of files to read. does anyone know what function to use.

As far as Perl is concerned, it doesn't matter if another executable
is a Perl script or not.  You call it using system(). See perldoc -f
system.

Anno


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

Date: 23 Nov 2001 17:10:22 +0000
From: nobull@mail.com
Subject: Re: calling perl scripts.
Message-Id: <u9r8qpct1d.fsf@wcl-l.bham.ac.uk>

Samer Forzley <samer.forzley@alcatel.com> writes:

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

This is not a MIME newsgroup - please refain from using MIME unless
there is a positive reason to use it.

> I need to call a perl script from another perl script and pass it a list
> of files to read. does anyone know what function to use.

The answer to the question you have asked is use system() or exec()
with an argument list.

However many people who ask this question are asking the wrong
question.  Depending on circumstances the answer you really need could
be:

1) Don't do it - make the common functionality into a module.

2) Use LWP (if you really meant CGI not Perl).

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


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

Date: Fri, 23 Nov 2001 17:25:12 +0000
From: greg loscombe <lovedaddy@heros-keep.com>
Subject: Difficulty with references and hashes
Message-Id: <vh1tvtc1ba46mugvf1j08nh5nrupm4kr5t@4ax.com>

Hi, Im kind of new to this programming lark, so please go easy.

Slight problem:

#!/usr/bin/perl -w

use strict;

my %search = ("id" => 3);
my $results = &search_hash('quote', 'search', 'foo');
#print $results;

# subs
sub search_hash {
	no strict;
	($table, $field_values, $test) = @_;
	print %$field_values;
	@fields = sort keys %$field_values;
}

Right, what Im basically trying to achieve is to pass arguments into a
sub (the quote, search, foo bit), and then use the second argument a
scalar reference to the %search hash.
The way I see it, in the sub $field_values = "search"
Thus print %$field_values should be the same as print %search.

Im guessing its just something I've missed, but I cannot for the life
of me work out what it is.  Any help, much appreciated.

Greg Loscombe


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

Date: Fri, 23 Nov 2001 19:44:23 +0100
From: "Steffen Müller" <5l259r001@sneakemail.com>
Subject: Re: Difficulty with references and hashes
Message-Id: <9tm5cr$6ad$07$1@news.t-online.com>

"greg loscombe" <lovedaddy@heros-keep.com> schrieb im Newsbeitrag
news:vh1tvtc1ba46mugvf1j08nh5nrupm4kr5t@4ax.com...
| Hi, Im kind of new to this programming lark, so please go easy.
|
| Slight problem:
|
| #!/usr/bin/perl -w
|
| use strict;
|
| my %search = ("id" => 3);
| my $results = &search_hash('quote', 'search', 'foo');
| #print $results;
|
| # subs
| sub search_hash {
| no strict;
# No. Don't.

| ($table, $field_values, $test) = @_;
| print %$field_values;
| @fields = sort keys %$field_values;
| }
|
| Right, what Im basically trying to achieve is to pass arguments into a
| sub (the quote, search, foo bit), and then use the second argument a
| scalar reference to the %search hash.
| The way I see it, in the sub $field_values = "search"
| Thus print %$field_values should be the same as print %search.
|
| Im guessing its just something I've missed, but I cannot for the life
| of me work out what it is.  Any help, much appreciated.

That's a symbolic reference. strict 'subs' prevents their use for a reason.
Please read the docs on strict for more information or search this group via
google for 'symbolic references'.

There's also a good paper on this somewhere... ("Why symbolic references are
bad" or something like that) I forgot who wrote it, but it should be found
on perl.com, I guess.

You barely ever need sym refs. I'd suggest creating a better data structure
right from the start and passing references.

#!/usr/bin/perl -w

use strict;

my %search = ("id" => 3);
my $results = &search_hash('quote', \%search, 'foo');
#print $results;

# subs
sub search_hash {
($table, $field_values, $test) = @_;
print %$field_values;
@fields = sort keys %$field_values;
}

HTH,
Steffen
--
$_=q;0cb212c210b0bb010c0113bb0c410c0b516c0bb3d212c2b0b0b016b6cb2b2c21010c0
b41110b3bba0e0c0d2c4b2b6bc013d2c0d0b01012b0b0;;s/\n//g;s/(\d)/$1<2?$1:'0'x
$1/ge;s/([a-f])/'1'x(ord($1)-97)/ge;$o=$_;push@o,substr($o,$_*8,8) for(0..
24);for(@o){print"\0"x(26-$i).chr(oct('0b'.($_)))."\r";$i++};print"\n"#stm





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

Date: Fri, 23 Nov 2001 14:35:37 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Enigma encryption
Message-Id: <3bfe5eb8.1c5e$10c@news.op.net>

In article <9tksfu$1nd$1@news.island.liu.se>,
Jonas Nilsson <jonni@ifm.liu.nospam.se> wrote:
>So my question. Is there some nice module that can wrap my code to measure
>where the bottlenecks are, 

Two people have already suggested Devel::DProf, so I'll suggest
Devel::SimpleProf. 

Good luck.
-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Fri, 23 Nov 2001 07:03:59 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Enigma encryption
Message-Id: <3BFE655F.8C1ACF30@stomp.stomp.tokyo>

Jonas Nilsson wrote:


> The problem is that the average run time is 40-130 hours
 
> So my question. Is there some nice module that can wrap my code to measure
> where the bottlenecks are, and thus where the code optimization is most
> needed. I know about the Benchmark module, but it would be nice to do the
> measurments in the complete script. Any suggestions?


Beneath my signature you will discover a script which can be
adapted to measuring any portion, portions or an entire script,
if you have a DOS box available. For multiple measurements,
just a matter of using my $start, $stop and subroutine call
as needed within a script.

It is not formatted for an hour rollover. Don't be surprised by this.

I have written it for fast scripts; measurements are milliseconds.
However, a little simple arithmetic coding can convert this script
to measure in minutes or hours. You could use localtime as well
with your script taking days to complete.

I do have some DOS com file timers. However, none are written
for such long time intervals. All my binaries are written for
millisecond timing under one hour.

Are you preparing for another World War? If so, for the right price,
my services as a Choctaw speaker are avaiable for true encryption.


Godzilla!  Chahta Okpulot Taha!
--
  "Do not pay any attention to what Godzilla says. It is a troll, and
   has no decent working knowledge of Perl or programming in general.
   Search groups.google.com to see a history of its posts and replies
   to these posts."

       - The CLPM Troll


TEST SCRIPT:
____________


#!perl

$start = `echo.|time`;

  (insert code for testing here)

$stop = `echo.|time`;

&Calculate_Time;


sub Calculate_Time
 {
  $start = substr ($start, 22, 5); 
  $stop = substr ($stop, 22, 5);

  ($second1, $millisecond1) = split (/\./, $start);
  ($second2, $millisecond2) = split (/\./, $stop);

  if ($second2 > $second1)
   {
    $thousands = $second2 - $second1 * 1000;
    $millisecond1 = $thousands - $millisecond1;
    $runtime = $millisecond1 + $millisecond2;
   }
  else
   { $runtime = $millisecond2 - $millisecond1; }

  print "Godzilla Runtime: $runtime milliseconds.\n\n";
 }


exit;


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

Date: Fri, 23 Nov 2001 07:17:50 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Enigma encryption
Message-Id: <3BFE689E.5C20D961@stomp.stomp.tokyo>

Godzilla! wrote:
 
> Jonas Nilsson wrote:
 

(snipped minute-by-minute)


> It is not formatted for an hour rollover. Don't be surprised by this.


Sorry, that should read, "...for a minute rollover."

Suppose the same is true for an hour rollover.


Godzilla!


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

Date: 23 Nov 2001 06:15:25 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: File locking question
Message-Id: <776e0325.0111230615.311dd52d@posting.google.com>

"J. op den Brouw" <J.E.J.opdenBrouw@st.hhs.nl> wrote in message news:<3BFD81D3.82188B0F@st.hhs.nl>...
> The question is, how to do it in Perl of course.
> But this solution is not doing it with
> file locking (so that others cannot play with
> the files). So this renders all solutions
> useless.
> 
> Laocoon wrote:
> > 
> > Is this a Perl question? If it is..
> > 
> > example :
> > 
> > open(IN,"input") or die "Input : $!";
> > open(OUT,">output") or die "Output : $!";
> > $in = join "" , <IN>;
> > close(IN);
> > `del input`;
> > print OUT $in;
> > close(OUT);
> 
> --Jesse


In his original question he asked about locking with dbm- doesn't dbm
manage locking? I'd read previously that you don't need to lock a file
tied to a hash with DBM (or perhaps only another xDBM?) as the locking
is already managed by xDBM. Is that so?


-GX


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

Date: Fri, 23 Nov 2001 14:27:55 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: File locking question
Message-Id: <3bfe5ceb.1c32$222@news.op.net>

In article <3BFA6EFC.DE0C41C9@st.hhs.nl>,
J.E.J. op den Brouw <J.E.J.opdenBrouw@st.hhs.nl> wrote:
>does anyone know how to lock a file move?
>
>file A -> file B
>
>File A is read and then removed, file B is written.
>A simple 'mv' is not sufficient, is it?

It depends on OS and circumstances.

For example, on a unix system, if the source and destination names are
on the same filesystem (that is, the same disk) then you can use the
Perl 'rename()' function and it will be safe.  The file is renamed all
at once.  rename does *not* read A, then remove it, then write B.  It
just renames the file.

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Fri, 23 Nov 2001 14:29:52 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: File locking question
Message-Id: <3bfe5d5f.1c3a$291@news.op.net>

In article <9tg2f3$r0t$1@mamenchi.zrz.TU-Berlin.DE>,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>> close(IN);
>> `del input`;
>
>This is wrong in multiple ways.  For one, don't use backticks to call
>an external program when you don't care for its output.  If you had
>switched on warnings, Perl would have told you so.  

There is no such warning.

Hope this helps.

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Fri, 23 Nov 2001 14:32:22 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: File locking question
Message-Id: <3bfe5df5.1c49$215@news.op.net>

In article <776e0325.0111230615.311dd52d@posting.google.com>,
Sara <genericax@hotmail.com> wrote:
>In his original question he asked about locking with dbm- doesn't dbm
>manage locking? 

It depends on the underlying package that is managing the DBM file.
So the most you can say in general is 'maybe'.
  
In particular, GDBM does do automatic locking, but SDBM, ODBM, NDBM,
and DB_File do not.

-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: 23 Nov 2001 15:18:14 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: File locking question
Message-Id: <9tlpbm$id7$1@mamenchi.zrz.TU-Berlin.DE>

According to Mark Jason Dominus <mjd@plover.com>:
> In article <9tg2f3$r0t$1@mamenchi.zrz.TU-Berlin.DE>,
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> >> close(IN);
> >> `del input`;
> >
> >This is wrong in multiple ways.  For one, don't use backticks to call
> >an external program when you don't care for its output.  If you had
> >switched on warnings, Perl would have told you so.  
> 
> There is no such warning.

True.  I thought I'd seen "Useless use of..." in that context, but I
don't see it now.  Shouldn't there be one?

Anno


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

Date: 23 Nov 2001 15:48:02 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: File locking question
Message-Id: <slrn9vsruc.4k5.rgarciasuarez@rafael.kazibao.net>

Anno Siegel wrote in comp.lang.perl.misc:
> According to Mark Jason Dominus <mjd@plover.com>:
> > >> close(IN);
> > >> `del input`;
> > >
> > >This is wrong in multiple ways.  For one, don't use backticks to call
> > >an external program when you don't care for its output.  If you had
> > >switched on warnings, Perl would have told you so.  
> > 
> > There is no such warning.
> 
> True.  I thought I'd seen "Useless use of..." in that context, but I
> don't see it now.  Shouldn't there be one?

From perldiag :

    Useless use of %s in void context
	(W void) You did something without a side effect in a context
	that does nothing with the return value...

qx// usually has side effects.
You're suggesting a "bad style" warning.

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: 23 Nov 2001 10:42:56 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: File locking question
Message-Id: <776e0325.0111231042.3ccdef3e@posting.google.com>

Ahh I KNEW there was a reason I always use GDBM- just forgot what it
was.. Oh that and the other thing that SDBM and some of the others can
only handle a small number of records.

Anyhow Steve- forgot about all of the external locking issues and just
use GDBM instead? Unless you ENJOY futzing with file locking. As
evident from the discussion here from Tom et al, there are no clean
elegant solutions. GDBM is probably as good as you can get it, as even
if someone else writes an ap against the same file, they'll need to
use GDBM to access it, and by default you know they implemented
locking correctly.


-GX


mjd@plover.com (Mark Jason Dominus) wrote in message news:<3bfe5df5.1c49$215@news.op.net>...
> In article <776e0325.0111230615.311dd52d@posting.google.com>,
> Sara <genericax@hotmail.com> wrote:
> >In his original question he asked about locking with dbm- doesn't dbm
> >manage locking? 
> 
> It depends on the underlying package that is managing the DBM file.
> So the most you can say in general is 'maybe'.
>   
> In particular, GDBM does do automatic locking, but SDBM, ODBM, NDBM,
> and DB_File do not.


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

Date: 23 Nov 2001 15:02:45 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How do I make several modules reference variables from one file?
Message-Id: <9tloel$nvj$2@mamenchi.zrz.TU-Berlin.DE>

According to Sara <genericax@hotmail.com>:
> 
> Exporter is a nice module that offers the allows classes to share
> methods, but in most cases I think it reduces maintainabilty and makes
> it more difficult to trace execution. If you full quality your
> objects, it's easier to go back later and figure out what's calling
> what. Exporter gives you the freedom to NOT name the class in an
> object reference, which can lead to ambiguity you may later regret.

But then, the primary purpose of Exporter is to be used with packages
that are *not* classes.  It is not meant to shuffle methods from one
class to another, the OO approach to that is inheritance.  Combining
Exporter with OO code is rather an exception and must offer distinct
advantages to be justified.

Anno


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

Date: Fri, 23 Nov 2001 19:59:40 +0100
From: "RJHM van den Bergh" <rvdb@comweb.nl>
Subject: Re: MX records.
Message-Id: <tvt76k4lhlr95d@corp.supernews.com>


<nobull@mail.com> wrote in message
news:4dafc536.0111220134.5485217f@posting.google.com...
> "RJHM van den Bergh" <rvdb@comweb.nl> wrote in message
news:<tvl9eclft74mf0@corp.supernews.com>...
> > How do I determine the MX record of a domain with Perl on NT servers.
>
> There may be an OS-specific way for NT, alternatively you could use a
> pure Perl implementation of the DNS client.  You can find one in the
> usual place (see FAQ "What modules and extensions are available for
> Perl?...")
>
> > The problem is the user only does have an account with a Perl but he
can't
> > install things on the server.
>
> So the user can only run scripts provided by the server admins, he
> can't install his own.  In that case he's onto a looser.  Perhaps you
> are really trying to ask "How do I keep my own module/library
> directory?"

I think I mean this.
I'm not that familiar with Perl modules.
Think I should read a book on the modul subjec.
I always assumed that only the root could insall Perl modules.
like net::DNS
So I think my assumtion is incorrect.
Is it ?

>
> > I'm not that familiar with Perl only some simple CGI script writing.
>
> I don't understand. What language are you writing those GCI scripts
> in?  Python?  Java?  Bourne shell?  If you have been writing CGI
> scripts in some other langauage what relevance does this information
> have to the matter in hand?

Normaly Perl.
But that are just some very simple scripts.
If I can I always try to solve the problem with Java.
It about a year ago I last programmed in Perl.

Rob,
rvdb@comweb.nl







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

Date: 23 Nov 2001 14:09:45 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Problems adding module to path
Message-Id: <slrn9vsm6k.3dh.rgarciasuarez@rafael.kazibao.net>

Boerge Haga wrote in comp.lang.perl.misc:
> Ok. Definitely a big misunderstanding on my part.
> However, it still doesn't work.
> I have now written:
> 
> use lib qw(/home/nfs/users/myhome/Modules/MD5-1.7);
> use MD5;
> 
> But still get:
> 
> $ myscript
> Can't find loadable object for module MD5 in @INC
[...]

You haven't installed your module. See in perlfaq8
"How do I install a module from CPAN?" and
"How do I keep my own module/library directory?"

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Fri, 23 Nov 2001 14:12:43 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Problems adding module to path
Message-Id: <f7msvtga4d4507jiiuivgviqev210249dk@4ax.com>

Boerge Haga wrote:

>Ok. Definitely a big misunderstanding on my part.
>However, it still doesn't work.
>I have now written:
>
>use lib qw(/home/nfs/users/myhome/Modules/MD5-1.7);
>use MD5;

>My MD5-1.7 directory contains:
>
>-r--r--r--   1 borgeh   borgeh      3177 Aug 12  1996 Changes
>-r--r--r--   1 borgeh   borgeh       463 Aug 12  1996 MANIFEST
>-rw-r--r--   1 borgeh   borgeh         0 Nov 23 12:57 MD5.bs
>-rw-rw-r--   1 borgeh   borgeh      3562 Nov 23 12:57 MD5.c
>-rw-rw-r--   1 borgeh   borgeh      6100 Nov 23 12:57 MD5.o
>-r--r--r--   1 borgeh   borgeh      6828 Aug 12  1996 MD5.pm
>-r--r--r--   1 borgeh   borgeh      1801 Aug 12  1996 MD5.xs
>-rw-r--r--   1 borgeh   borgeh     20610 Nov 23 12:54 Makefile
>-r--r--r--   1 borgeh   borgeh       515 Aug 12  1996 Makefile.PL
 ...

Oh horrors. You haven't INSTALLED the module, have you? This is a module
based on XS, i.e. you need to compile it with a C compiler.

See that other entry in perlfaq8:

	How do I keep my own module/library directory?

This does assume shell access...

-- 
	Bart.


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

Date: Fri, 23 Nov 2001 14:09:36 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Problems with Mirror - ftp.pl doesn't get the right octal for chmod
Message-Id: <f1msvtsj88dl3lmmddr1k0idqnj5svdmeu@4ax.com>

Garry Williams wrote:

>> This is bad code.  The author doesn't know how to use sprintf.  In
>> particular, variable strings ($path) do *not* belong in the sprintf
>> format.  The line should read
>> 
>>     &send( sprintf( "SITE CHMOD %o %s", $mode, $path ) );
>
>I suppose this is a matter of style.

No. I agree with Anno.

>The Perl manual page for
>sprintf() and sprintf(3) certainly don't agree with you.  Assuming
>that the interpolation results in no "conversion specification"
>characters, the stuff in $path will be treated as "ordinary
>characters", according to the manual pages.  
>
>printf "%s\n", "just another Perl hacker";

What if the actual path name contains a "%"? That is far from unlikely,
you know.

Don't do it, especially as the change required for doing it right
(without this bug) is so dead easy.

-- 
	Bart.


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

Date: 23 Nov 2001 14:49:11 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Problems with Mirror - ftp.pl doesn't get the right octal for chmod
Message-Id: <9tlnl7$nvj$1@mamenchi.zrz.TU-Berlin.DE>

According to Garry Williams <garry@zvolve.com>:
> On 23 Nov 2001 11:13:05 GMT, Anno Siegel
> <anno4000@lublin.zrz.tu-berlin.de> wrote:
> 
> > According to Dirk <dirk.drexler@web.de>:
> 
> [ snip ]
> 
> >>         &send( sprintf( "SITE CHMOD %o $path", $mode ) );
> > 
> > This is bad code.  The author doesn't know how to use sprintf.  In
> > particular, variable strings ($path) do *not* belong in the sprintf
> > format.  The line should read
> > 
> >     &send( sprintf( "SITE CHMOD %o %s", $mode, $path ) );
> 
> I suppose this is a matter of style.  The Perl manual page for
> sprintf() and sprintf(3) certainly don't agree with you.  Assuming
> that the interpolation results in no "conversion specification"
> characters, the stuff in $path will be treated as "ordinary
> characters", according to the manual pages.  

Oh, it certainly works in most cases.  The point is that you have to
make sure that no % (anything else?) appears in the interpolated
string.  For this, you either need a guarantee that it will never
be there in the first place (not true for path names in general), or
add code to detect that case (and then do what?).  Since you can
always replace an interpolation into the format string with a %s-
construct, string interpolation makes the code more fragile than it
has to be.  It is not merely a matter of style, IMHO.

This doesn't mean, of course, that string interpolation into the
format string is always wrong.  When used to build parts of formats,
as in "%${width}s", it is unexceptionable and powerful.

Anno


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

Date: Fri, 23 Nov 2001 09:27:57 -0600
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: Using CGI.pm to obtain a list of params
Message-Id: <9tlqsa$2h9$1@slb2.atl.mindspring.net>

"Helgi Briem" <helgi@decode.is> wrote in message
news:3bfe2ac0.3116077442@News.CIS.DFN.DE...
> On Thu, 22 Nov 2001 14:08:19 -0600, "William Alexander
> Segraves" <wsegrave@mindspring.com> wrote:
>
> > On Nov 22, William Alexander Segraves inscribed on the eternal scroll:
>
> >No problem, really. If CGI.pm is available on the host web server, it is
> >sometimes preferable to use it. If CGI.pm is not available, then ...
>
> It is always available.
>

Thanks, for your comments, Helgi. In the above "not available" may mean
"broken". I just haven't had time to sort that out at the particular ISP. It
is indeed "available" there, but doesn't work for my problem, so far.

> It is always preferable except occasionally when
> CGI::Lite will do the job.
>

True, except when it isn't. OTOH, perhaps I'm just unaware of a capability
CGI.pm has that can do what I need more efficiently.

In my previous (response to AJF) on the same thread, I gave a fragment of
Perl code that I use to convert the URL-encoded string of name-value pairs
from an Adobe Acrobat PDF form submittal into FDF, the form data format that
Acrobat understands.

In my next (response to JB) on the same thread, I gave the code from the
prior example, but converted to use CGI.pm.

Subjectively, I feel the code in the former is more efficient, as it doesn't
require any calls to functions provided by CGI.pm. I'd be delighted to find
out if CGI.pm can provide the same functionality more efficiently in my
particular application.

TIA for your opinions.

Bill Segraves
Auburn, AL





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

Date: Fri, 23 Nov 2001 09:42:43 -0600
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: Using CGI.pm to obtain a list of params
Message-Id: <9tlqsb$2h9$2@slb2.atl.mindspring.net>

"Alan J. Flavell" <flavell@mail.cern.ch> wrote in message
news:Pine.LNX.4.30.0111231229330.13774-100000@lxplus023.cern.ch...
> On Nov 22, William Alexander Segraves inscribed on the eternal scroll:
>
> > > Hangonabit, they already come back from CGI.pm in a hash.  So what's
> > > the problem?  ;-)
> >
> > No problem, really. If CGI.pm is available on the host web server,
>
> CGI.pm has been a core module for quite some time.  If it's not
> available, then either the Perl installation is hopelessly obsolete
> (and so, probably insecure), or they've deliberately removed part of
> the Perl core installation.  Either way, I don't think I'd want to
> work with such a server.
>

Alan, please read "available" as "working". I just haven't sorted out the
problems I've had with it at the particular ISP. CGI.pm works fine here.

FYI, I would much prefer to use CGI.pm for this particular application, as
it enjoys the favor of many Perl experts whose opinions I respect.

> > If CGI.pm is not available, then ...
>
> Well, I've never been in quite that position, but I did install a
> useful module on a service-provider's system whose CGI.pm version
> level didn't meet the module's minimum requirements.  So I installed
> my own copy of a recent CGI.pm, and pointed at it with an appropriate
> 'use' statement, just like it says in the Perl FAQs.
>

Thanks for the suggestion. I can certainly try uploading a more recent
CGI.pm, instead of using the one that the ISP provides.

So far, I'm pursuaded that my own code would be more difficult for the ISP
to break than it would be in the CGI.pm version. Your thoughts?

TIA.

Bill Segraves
Auburn, AL






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

Date: Fri, 23 Nov 2001 17:44:46 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Using CGI.pm to obtain a list of params
Message-Id: <Pine.LNX.4.30.0111231731030.13774-100000@lxplus023.cern.ch>

On Nov 23, William Alexander Segraves inscribed on the eternal scroll:

> Subjectively, I feel the code in the former is more efficient,

You evidently haven't been following this group for long!  Your point
is frequently raised and discussed.

If you were looking for computer efficiency, you wouldn't want to be
using the CGI as such, anyway (involving in practice, as it does, a
process startup overhead for every transaction).

The use of modules wins in terms of development time; in terms of
reliable/secure behaviour; in terms of long-term maintenance costs.
It doesn't generally win in terms of computer efficiency, but that
doesn't/shouln't matter.  The overhead isn't great in comparison to
the other things going on; CPU power is relatively cheap; it's the
experienced development staff which really costs.

And if/when you decide that the overheads of CGI startup are all too
much, then CGI.pm is ready to help you port your application to
mod_perl.



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

Date: Fri, 23 Nov 2001 12:31:45 -0600
From: "William Alexander Segraves" <wsegrave@mindspring.com>
Subject: Re: Using CGI.pm to obtain a list of params
Message-Id: <9tm4pu$47r$1@slb0.atl.mindspring.net>

"Alan J. Flavell" <flavell@mail.cern.ch> wrote in message
news:Pine.LNX.4.30.0111231731030.13774-100000@lxplus023.cern.ch...
> On Nov 23, William Alexander Segraves inscribed on the eternal scroll:
>
> > Subjectively, I feel the code in the former is more efficient,
>
> You evidently haven't been following this group for long!  Your point
> is frequently raised and discussed.
>

Thanks for your comments. WADR, how long is irrelevant. IIRC, there is very
little archived in clpm about my specific problem. A Google search confirms
this.

The reason I stated a subjective feeling is that in the areas you list,
CGI.pm has taken a lot more effort to employ than plain old Perl code. You
can probably tell us exactly when (which version) CGI.pm would have broken a
script for Acrobat form data processing. Thanks to the excellent books on
the subject, I was able to discover that the -no_xhtml pragma fixed a
problem I had with Perl v.5.6.1 and CGI.pm default headers.

> If you were looking for computer efficiency, you wouldn't want to be
> using the CGI as such, anyway (involving in practice, as it does, a
> process startup overhead for every transaction).
>

True. My concern is overall, efficiency, especially conservation of my own
development time.

> The use of modules wins in terms of development time; in terms of
> reliable/secure behaviour; in terms of long-term maintenance costs.

Having done it both ways, with and without CGI.pm, I see your point. In the
case of FDF, though, I still had to write functions/methods not supported by
CGI.pm, e.g., the headers and trailers required for Acrobat FDF.

I see the discourse is drifting away from the thread; so I enter
end-of-thread mode.

Thanks again for your comments.

Bill Segraves
Auburn, AL







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

Date: 23 Nov 2001 06:06:54 -0800
From: genericax@hotmail.com (Sara)
Subject: what are the diff between -w and "use warnings" and $^W
Message-Id: <776e0325.0111230606.3ed553aa@posting.google.com>

I found a modicum of info on this with perldoc -q warnings, but what
are the differences? and is $^W depreciated? I always use -w but never
use

  "use warnings;"


is that sort of the norm? The other guy with the $row getting
clobbered sort of has a point, it would be nice to be able to set
warning severity with more granularity. I've been caught with similar
latent errors only having to discover them on my own.


Thanks and happy T-Day!
GX


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

Date: 23 Nov 2001 14:17:15 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: what are the diff between -w and "use warnings" and $^W
Message-Id: <slrn9vsmko.3dh.rgarciasuarez@rafael.kazibao.net>

Sara wrote in comp.lang.perl.misc:
> I found a modicum of info on this with perldoc -q warnings, but what
> are the differences? and is $^W depreciated? I always use -w but never
> use
> 
>   "use warnings;"
> 
> 
> is that sort of the norm?

Read the perllexwarn section of the docs for discussion of this issue.

The warnings pragma is in Perl since version 5.6.0 ; if you are worried
about backward compatibilities issues, don't use it.

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Fri, 23 Nov 2001 14:35:31 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: what are the diff between -w and "use warnings" and $^W
Message-Id: <3BFE5F79.C6B0ACD9@acm.org>

Sara wrote:
> 
> Thanks and happy T-Day!

OMG ... Ts have their own day now?


John
-- 
use Perl;
program
fulfillment


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

Date: Fri, 23 Nov 2001 16:37:51 +0100
From: "Oliver Bork" <oliver.bork@comtrue.de>
Subject: Win32::GUI sample
Message-Id: <9tlqg2$3e2ke$1@ID-36486.news.dfncis.de>

Hi ng,

anybody got a working code example of a button with image on it ?

Appreciate any help. Oliver




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

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


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