[19617] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1812 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 25 11:05:37 2001

Date: Tue, 25 Sep 2001 08:05:07 -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: <1001430307-v10-i1812@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 25 Sep 2001     Volume: 10 Number: 1812

Today's topics:
        $0 and Win NT <horst.fickenscher@sealsystems.de>
    Re: Creating modules <bart.lateur@skynet.be>
        current dir. <jeff@metadyne.uk.com>
    Re: current dir. <mjcarman@home.com>
    Re: Dump raw data (Garry Williams)
    Re: Environnement problem under Linux (Hardy Merrill)
    Re: Environnement problem under Linux <comdog@panix.com>
    Re: faster execution <bart.lateur@skynet.be>
    Re: how to replace several blank lines with 1 <bart.lateur@skynet.be>
    Re: installing modules in WinNT <bart.lateur@skynet.be>
    Re: multipul http connections <ilya@martynov.org>
    Re: non-persistent cookies management <ilya@martynov.org>
    Re: non-persistent cookies management <simon.oliver@umist.ac.uk>
    Re: Please Help with Sockets! <bart.lateur@skynet.be>
    Re: Setting max. values (cpu/ram usage) for mod_perl sc <ilya@martynov.org>
        Transforming HTML <oneconcept@yahoo.co.uk>
    Re: Unusual error message... <bart.lateur@skynet.be>
        Validating 2 Sets of Languages! <ofda@hotmail.co.il>
    Re: Validating 2 Sets of Languages! <ilya@martynov.org>
    Re: What good is the hyphen for named parameters? <mjcarman@home.com>
    Re: Windows2000: CPAN.pm woes <alicia090677@hotmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 25 Sep 2001 15:13:29 +0200
From: Horst Fickenscher <horst.fickenscher@sealsystems.de>
Subject: $0 and Win NT
Message-Id: <3BB082F9.D3C43F43@sealsystems.de>

I'm using FindBin.pm to get the directory where
a script was started. As far as I can see FindBin.pm
uses $0.

Say, we call the script findbin.pl from the
directory e:\mastertools. Then:

$0 is 'E:\MASTE~3W\findbin.pl'

Actually E: is a Samba share and mastertools
should be passed to a remote process on a linux
box, so the 8.3 name is useless.

This is perl, version 5.005_02 built for winnt4.
I know how to get the long file name from the
8.3 name, but I'm just curious.

I'm pretty sure that I got the long file name in
$0 some weeks ago (yes, before my holidays).

Yes, I know, that's not a perl question:

Are there any settings (registry) or circumstances
that could lead to this different behaviour?

Any hints or suggestions welcome. Cheers

--
Horst




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

Date: Tue, 25 Sep 2001 14:01:00 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Creating modules
Message-Id: <0a31rt4t9l7ulah1oso243dshsel7570ik@4ax.com>

GunneR wrote:

>Im having trouble creating a simple module (just to get started). I've
>had a bit of trouble finding good documentation on creating modules.
>Anyone know any informative sites?

Start you module file with

	package Foo::Bar;

if Foo::Bar is the name of the module you'd like to write, thus
Foo/Bar.pm is the file name/path; and end it with 

	1;

Save the file. You now have got an empty module that does nothing ,wbut
which works.

If you don't need import(), i.e. no exportable functions/variables, for
example if it's a pure OO module, just leave it like this, just add you
variable declarations and subs, and initialisation if that is needed. If
you do, look at the docs for Exporter.

It can be that simple.

-- 
	Bart.


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

Date: Tue, 25 Sep 2001 14:40:37 +0100
From: Jeffrey Porter <jeff@metadyne.uk.com>
Subject: current dir.
Message-Id: <3BB08955.81D08C63@metadyne.uk.com>

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



I'm trying to write a perl program to go through each directory and list
the files in it & the path to that file.

I've managed to write the code to list/change directories & list the
files in them.

What I can't work out is how to get the full path of the current
directory I am in.


Can some one please help.

Thanks
JP.


-- it builds, quick ship it!



--------------5DC71650AE9537D21B5F9108
Content-Type: text/x-vcard; charset=us-ascii;
 name="jeff.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Jeffrey Porter
Content-Disposition: attachment;
 filename="jeff.vcf"

begin:vcard 
n:Porter;Jeffrey
tel;work:44 (0)1895 254 254
x-mozilla-html:FALSE
org:Metadyne Ltd.;Research & Development
adr:;;;;;;
version:2.1
email;internet:jeff@metadyne.uk.com
title:Software Architect
x-mozilla-cpt:;27728
fn:Jeffrey Porter
end:vcard

--------------5DC71650AE9537D21B5F9108--



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

Date: Tue, 25 Sep 2001 09:17:24 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: current dir.
Message-Id: <3BB091F4.ABB76A37@home.com>

Jeffrey Porter wrote:
> 
> [...]
> What I can't work out is how to get the full path of the current
> directory I am in.

use Cwd;
my $dir = getcwd;

-mjc


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

Date: Tue, 25 Sep 2001 13:05:21 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Dump raw data
Message-Id: <slrn9r108h.98j.garry@zfw.zvolve.net>

On Tue, 25 Sep 2001 09:31:19 +0200, Philippe PERRIN
<philippe.perrin@sxb.bsf.alcatel.fr> wrote:

> I need to regularly dump a whole hash on disk, and reload it later. Is
> there a way to write its "raw data" on a file descriptor (I mean the way
> Perl stores it in memory) ? I'm looking for a pair of functions which
> would work that way :

You're looking for the Storable module and the pair of functions are
freeze() and thaw().  

Visit CPAN.  

-- 
Garry Williams


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

Date: 25 Sep 2001 06:49:47 -0700
From: merrill@missioncriticallinux.com (Hardy Merrill)
Subject: Re: Environnement problem under Linux
Message-Id: <fdfedf4b.0109250549.df2cc0c@posting.google.com>

friedman@math.utexas.edu (Chas Friedman) wrote in message news:<3baff165.47700676@news.itouch.net>...
> On Tue, 25 Sep 2001 04:28:46 +0200, "Younes ALAOUI"
> <yalaoui@lexbase.fr> wrote:
> 
> >    Hi,
> >
> >I use perl on Linux RH.
> >The problem is that i have 4 (four) perl executables. And i don't know
> >which on is used .
> >
> >Here is the ouput of  "ls -l /usr/lib/perl5" :
> >
> >drwxr-xr-x  29 root     root         4096 Sep 25 03:30 5.00503/
> >drwxr-xr-x  31 root     root         4096 Sep 13 12:19 5.6.0/
> >drwxr-xr-x   3 root     root         4096 Oct  9  2000 man/
> >drwxr-xr-x   5 root     root         4096 May  8  2000 site_perl/
> >
> >I know that i have perl5.6.1 under "/usr/local/lib/perl5". I am confused of
> >too many .... executables.
> >
> Try the command "which perl". That should indicate which one "perl"

You can also do "perl -V" which will print out a lot of stuff - but
down at the bottom it prints out the contents of the @INC array, which
tells you exactly what directories, and in what order perl searches
those directories to find scripts and modules.

> refers to. Probably the most recent executable is under the 5.6.0
> directory listed above. You could also do "ls -l /usr/bin/perl" to see
> what that is linked to.
> >I want to user Amavis, when it's launched it try to locate modules under
> >those directories :
> >
> >/usr/lib/perl5/5.6.0/i386-linux
> >/usr/lib/perl5/5.6.0
> >/usr/lib/perl5/site_perl/5.6.0/i386-linux
> >/usr/lib/perl5/site_perl/5.6.0
> >/usr/lib/perl5/site_perl/5.005
> >/usr/lib/perl5/site_perl
> >
> >The question is : How can i can specifie that i would like it to use modules
> >located undet '/usr/local/lib/perl5/'
> >
> You can put the line: use lib '/usr/local/lib/perl5'; at the beginning
> of your perl script.  
> (One remark: it may be that /usr/local/lib/perl5
> is linked to one of the directories you listed above. You could try
> ls -l /usr/local/lib  to see if the perl5 directory is linked to one
> of the above.)
> >Thanks in advance.
> >
> >Y.A.
> >
> >
>              chas

Chas is correct - when you do

    use '/usr/local/lib/perl5';

perl *pre*pends that directory to the front of the @INC array -
therefore that directory will be the first one searched for modules.

I don't have experience running more than one version of perl on a
machine, but there are ways to do that.  One thing to keep in mind is
that at the top of each perl script you normally specify something
like

   #!/usr/bin/perl -w

and you can make that absolute directory path point at any perl you
have on your system.

HTH.

Hardy Merrill
Mission Critical Linux, Inc.
http://www.missioncriticallinux.com


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

Date: Tue, 25 Sep 2001 09:50:57 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: Environnement problem under Linux
Message-Id: <comdog-31A911.09505725092001@news.panix.com>

In article <3baff165.47700676@news.itouch.net>, 
friedman@math.utexas.edu (Chas Friedman) wrote:

> On Tue, 25 Sep 2001 04:28:46 +0200, "Younes ALAOUI"
> <yalaoui@lexbase.fr> wrote:
> 
> >    Hi,
> >
> >I use perl on Linux RH.
> >The problem is that i have 4 (four) perl executables. And i don't know
> >which on is used .
> >
> >Here is the ouput of  "ls -l /usr/lib/perl5" :
> >
> >drwxr-xr-x  29 root     root         4096 Sep 25 03:30 5.00503/
> >drwxr-xr-x  31 root     root         4096 Sep 13 12:19 5.6.0/
> >drwxr-xr-x   3 root     root         4096 Oct  9  2000 man/
> >drwxr-xr-x   5 root     root         4096 May  8  2000 site_perl/
> >
> >I know that i have perl5.6.1 under "/usr/local/lib/perl5". I am confused of
> >too many .... executables.

> Try the command "which perl". That should indicate which one "perl"
> refers to.

that will just tell you where "perl" is.

    brian[1064]$ which perl
    /usr/bin/perl


you can check the version of perl with the -v switch

    brian[1065]$ perl -v

    This is perl, v5.6.1 built for i386-freebsd

    [snip]

and see the compile time options, including @INC,
with the -V switch.

-- 
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html



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

Date: Tue, 25 Sep 2001 13:17:14 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: faster execution
Message-Id: <tj01rtgh830hnnrj6co8uv26e62qh4gie2@4ax.com>

venus wrote:

> What if I have an array that has different keys pointing to the same
>value?
>
>      %LOCATION = (
>	"GBE",   'Gaborone,,BC',
>        "GBC",   'Gaborone,,BC', 
>        "ADL",   'Amman,,JD', );

>       	%LOCATIONS = reverse %LOCATION;

 ...

>but this will eliminate those repeated values and only prints one of
>the associated key. Any other way to do it?
>
>Appreciate if you could help.

Indeed. That's the effect you get if you do:

	%hash = ( a => 1, a => 2, a => 3 );

all that is left is $hash{a} = 3 (the rightmost entry for "a" on the
list).

Instead, try something like:

	while(my($k, $v) = each %LOCATION) {
	     push @{$LOCATIONS{$v}}, $k;
	}


This will make an anonymous array entry for each old value, with all
associated keys pushed onto each.

You'll have to loop through them:

	foreach (@{$LOCATIONS{$location}} {
	    print OUTPUT_FILE "$_,$max1,$min1,$cond1\n";
	}

-- 
	Bart.


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

Date: Tue, 25 Sep 2001 13:56:00 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: how to replace several blank lines with 1
Message-Id: <is21rtkd2ahqvds2pnm5iti6gl6qu82jdp@4ax.com>

Tam McLaughlin wrote:

>Thanks for the replies folks.
>I should have been more clear and said I wante to replace multiple blank
>lines
>with 2 blank lines.

Two? Are you sure?

Oh well. Here's an approach nobody has mentioned in this thread yet.

    @ARGV = $0 unless @ARGV;  #defaults to script itself, for testing
    while(<>) {
        if(my $c = (/^$/ .. (/\S/ || eof))) {
            next if !/\S/ and $c>2;
        }
        print;
    }

$c gets the value of the .. operator, which is a counter, starting at 1
(and with "E0" appended for the final condition). The eof serves to
reset the .. operator at the end of a/each file.

Modification to set the ceiling for any number of successive blank lines
is trivial.

-- 
	Bart.


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

Date: Tue, 25 Sep 2001 14:10:55 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: installing modules in WinNT
Message-Id: <nn31rtsuaqn5qkkid38gm4eb47c0llb8cs@4ax.com>

Eli the Bearded wrote:

>Modules install nicely, double clicking perl scripts works, but I can't
>right click and 'Open With...' perl scripts. Anything simple to fix
>that?

I'm not using NT but Win98...

Open "Folder Options", choose "File Types", search for PL (likely under
"Perl File"). Edit these settings. Now add a menu item with the "New"
button, like "Edit", and add a command line to open the script with your
favourite editor (don't forget the "%1", preferably with quotes). That
is what you want to do, right?

On Win98, adding a link to your editor in the SendTo directory is nice,
too. It is then available to all files.

-- 
	Bart.


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

Date: 25 Sep 2001 17:32:27 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: multipul http connections
Message-Id: <87elov8kgk.fsf@abra.ru>

>>>>> On Tue, 25 Sep 2001 14:52:23 +0200, "Edwin B" <edwin@notthis.com> said:

EB> I want to fetch content from the web but as it's quite a bit and
EB> from different url's I am looking for a way to open multiple
EB> connections.

EB> I have looked at the fork function but I am not sure if this is
EB> what I should use.

EB> Can anybody help me a bit and give some pointers into
EB> the right direction?

You can try LWP::Parallel instead of using fork.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: 25 Sep 2001 17:29:47 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: non-persistent cookies management
Message-Id: <87ite78kl0.fsf@abra.ru>

>>>>> On 25 Sep 2001 05:50:53 -0700, ljb_fr@yahoo.fr (ljb) said:

l> Hello,
l> I just want to store any incoming "non-persistent" cookies and then
l> return the cookies with the next request like a web browser does.

l> If somebody has an exemple to do this  

Are you writting user agent? Use LWP and let it manage your
cookies. Read libwww-perl cookbook (perldoc lwpcook) chapter
COOKIES. It has an example.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: Tue, 25 Sep 2001 14:39:44 +0100
From: "Simon Oliver" <simon.oliver@umist.ac.uk>
Subject: Re: non-persistent cookies management
Message-Id: <3bb08cdf$1@news.umist.ac.uk>

use HTTP::Cookies;
use LWP::UserAgent;

my  $ua = LWP::UserAgent->new;
$request = HTTP::Request->new('GET', 'file://localhost/etc/motd');
$response = $ua->request($request);
$cookie_jar = HTTP::Cookies->new;
$cookie_jar->extract_cookies($response);

Will retrieve the cookies for you.  You can use the
$cookie_jar->add_cookie_header($request) method send the coockie back.

--
  Simon Oliver







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

Date: Tue, 25 Sep 2001 13:20:07 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Please Help with Sockets!
Message-Id: <a011rtsuti2sclr8dmvsj0qo6hs062sju1@4ax.com>

Raj wrote:

>Using
>
>    while (<S> ne ".") {
>
>        blah...
>
>     }
>
>doesn't seem to work though.  Can someone please shed some light?

Because of a trailing newline/crlf? BTW if you do your check like this,
$_ won't ever be set.

	while (<S>) {
	    tr/\r\n//d; # get rid of CR and LF
	    last if $_ eq '.';
	    blah...
	}

Note that if you need a newline at the end of each, you'll have to add
them again yourself.

-- 
	Bart.


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

Date: 25 Sep 2001 17:26:50 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Setting max. values (cpu/ram usage) for mod_perl scripts?
Message-Id: <87n13j8kpx.fsf@abra.ru>

>>>>> On Tue, 25 Sep 2001 14:33:19 +0200, EXP <nospaming@gmx.net> said:

E> Hi
E> I wonder, is it somehow possible to restrict the maximal cpu usage and
E> ram usage for apache mod_perl scripts? Either per script (script x may
E> use 14MB ram, script y 20MB ram), as global per script (each script may
E> use 15MB ram and run max. 10cpu seconds) or global mod_perl (each
E> mod_perl/apache instance may use max 30MB{<- this should be possible via
E> ulimit, or? But it would terminate the whole apache process?} and
E> 15seconds cpu time{<- possible?}) restriction?

E> I think the ram usage of the apache process could be restricted via
E> ulimit but how can I restrict the cpu usage for mod_perl? And I don't
E> want to kill an apache child just because some script bloated it up.

Use ulimit. There is no anything terribly wrong with killing apache
child process (at least when it happens relatively seldom). Apache
will spawn another.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: Tue, 25 Sep 2001 14:31:29 +0100
From: "Raj" <oneconcept@yahoo.co.uk>
Subject: Transforming HTML
Message-Id: <1001424684.19552.0.nnrp-02.c2d95a2c@news.demon.co.uk>

Hi all,

Thanks to all who helped with my socket problem earlier.  Now I have another
problem.  I am using a Perl script to output HTML.  I need to take the
values that I have in an associative array and plug them into text boxes.
This is what I currently have, and it doesn't work:

while(<PAGE>) {
                        print;
                        if (/<FORM/) {
                                if (/<INPUT TYPE="text" NAME="x(.*?)" /) {
                                        tr/$&/$& VALUE="$address{$1}"/;
                                }
                        }
}

I have text boxes in the HTML file which is opened which are named the same
as the corresponding key in the associative array, preceded by an "x", e.g.
The text box NAME="xFname" needs to have the value from $address{"Fname"}.

Any ideas please?

Regards,
Raj





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

Date: Tue, 25 Sep 2001 14:18:47 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Unusual error message...
Message-Id: <d641rto78155r52hqpkg9nefqbb30666pl@4ax.com>

Ilmari Karonen wrote:

>In article <3BAE5642.53FE388A@earthlink.net>, Benjamin Goldberg wrote:
>>Ilmari Karonen wrote:
>>[snip]
>>> The "EXPR for LIST;" syntax was introduced in perl 5.005.  It
>>> is exactly equivalent to "for (LIST) {EXPR}", 
>>
>>Not *exactly* equivilant... it doesn't introduce a new scope.
>
>Actually, it does.  Some might argue that this is a bug.  Certainly none
>of the other statement modifiers do that.

It must be. Well: if you add a my() declaration in your expression, you
can't do anything with that variable because it is not available until
the expression, or rather the statment containing it, is finished
executing. Like:

	my $foo = 123 and print $foo;

This does ordinarily *not* print "123", because it doesn't print *this*
$foo.

	$foo = 'Old';
 	(my $foo = 123), print $foo for 1;
	print $foo;
-->
	Use of uninitialized value in print at test.pl line 4.
	Old

Bloody Hell. What is *that* good for.

-- 
	Bart.


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

Date: Tue, 25 Sep 2001 15:38:19 +0200
From: "biG" <ofda@hotmail.co.il>
Subject: Validating 2 Sets of Languages!
Message-Id: <9oq1bq$3to$1@news.netvision.net.il>

How do I validating 2 sets of languages or character sets?
i.e. - I'm working on a bi-lingual system: English and Hebrew.
The Hebrew uses a different set of characters, so when I'm
validating a string for an input box like: $myValidation =
'm/([A-Za-z\-\. ]){1,100}/';
it won't let Hebrew characters to be inserted, and once I validate like
this: (sorry for the Hebrew characters which might be shown as garbage...:
$myHebrewValidation = 'm/([à-ú\-\. ]){1,100}/'; - it won't let me insert the
English characters!

Can someone help me please !!!!!
Ofir
Microsoft Certified Professional
http://ofir.tayind.com/dw






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

Date: 25 Sep 2001 18:10:33 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: Validating 2 Sets of Languages!
Message-Id: <8766a78ip2.fsf@abra.ru>

>>>>> On Tue, 25 Sep 2001 15:38:19 +0200, "biG" <ofda@hotmail.co.il> said:

b> How do I validating 2 sets of languages or character sets?
b> i.e. - I'm working on a bi-lingual system: English and Hebrew.
b> The Hebrew uses a different set of characters, so when I'm
b> validating a string for an input box like: $myValidation =
b> 'm/([A-Za-z\-\. ]){1,100}/';
b> it won't let Hebrew characters to be inserted, and once I validate like
b> this: (sorry for the Hebrew characters which might be shown as garbage...:
b> $myHebrewValidation = 'm/([X-x\-\. ]){1,100}/'; - it won't let me insert the
b> English characters!

What is the problem? Combine two regexps.

m/([A-Za-zX-x\-\. ]){1,100}/

I use here X-x instead of Hebrew characters since I can't type them.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


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

Date: Tue, 25 Sep 2001 07:56:52 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: What good is the hyphen for named parameters?
Message-Id: <3BB07F14.7B703618@home.com>

"Stephen O. Lidie" wrote:
> 
> my $therm = $mw->Thermometer(
>     -label  => 'Reactants Temp',
>     -tscale => 'Celsius',
> )->pack;
> 
> And yes, it does make the option distinct from its value.

Much of the time, perhaps, but not always. (Which is what Bart was
taking issue with.) There's no reason you can't say

    my %hash = (-key => '-sometext', -nextkey => '-moretext');

At any rate, if you format your code as above, the leading '-' doesn't
add anything anyway. All you have to do is look at which side of the =>
the text is on.

[To Bart] I don't think there's a particularly useful reason (from a
perl perspective) for doing it -- it's just tradition.

-mjc


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

Date: 25 Sep 2001 09:57:16 -0400
From: Alicia <alicia090677@hotmail.com>
Subject: Re: Windows2000: CPAN.pm woes
Message-Id: <9oq2fs$kah$1@panix3.panix.com>



In <9oonq5$cbd$1@canopus.cc.umanitoba.ca> "Randy Kobes" <randy@theory.uwinnipeg.ca> writes:

>> There's no make on this machine, nor a whole bunch of other standard
>> Unix programs that CPAN.pm seems to need (gzip, etc.).

>Many modules for ActivePerl are available through the included PPM
>utility - a listing is at http://www.activestate.com/ppmpackages/.
>However, if one you want isn't there, you'll need nmake to use
>CPAN.pm; this is available from
>   ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe
>Win32 ports of Unix tools are available from
>     http://www.cygnus.com/misc/gnu-win32/
>    http://www.itribe.net/virtunix
>Also, Win32 tar and gzip programs are available at
>    ftp://gatekeeper.dec.com/pub/GNU/

>in the appropriate directories. Once you install these
>in your PATH, reconfigure CPAN.pm and it will pick them
>up and use them.


Thanks.  That did the trick.  But now I have another problem.  When I
tried to install Bundle::CPAN, CPAN.pm eventually typed:

    If you live behind a firewall or your favourite WAIT server is down,
    the test fot this module may block for minutes.
    
    Should I run the tests anyway? [n] y
    Checking if your kit is complete...
    Looks good
    Writing Makefile for CPAN::WAIT
    
    Microsoft (R) Program Maintenance Utility   Version 1.50
    Copyright (C) Microsoft Corp 1988-94. All rights reserved.
    
    cp lib/CPAN/WAIT.pm blib\lib\CPAN\WAIT.pm
    cp lib/WAIT/Client.pm blib\lib\WAIT\Client.pm
      C:\WINNT\SYSTEM32\nmake.EXE  -- OK
    Running make test
    
    Microsoft (R) Program Maintenance Utility   Version 1.50
    Copyright (C) Microsoft Corp 1988-94. All rights reserved.
    
	    C:\Perl\bin\Perl.exe -Mblib -IC:\Perl\lib -IC:\Perl\lib -e "use Test::Harness qw(&runtests $verbose): $verbose=0; runtests @ARGV;" t\basic.t
    Using C:/.cpan/build/CPAN-WAIT-0.27/blib
    t\basic.............Use of uninitialized value in string eq at C:\Perl\lib/ExtUtils/MM_Win32.pm line 181
    t\basic............ok 2/5Could not connect to the WAIT server at ls6.informatik.uni-dortmund.de port 1404
    You did not tell the CPAN module about an http proxy.
    I could use such a beast instead of a direct connection.
    No searching available!
    t\basic.............NOK 3Could not connect to the WAIT server at ls6.informatik.uni-dortmund.de port 1404
    You did not tell the CPAN module about an http proxy.
    I could use such a beast instead of a direct connection.
    No searching available!
    t\basic.............NOK 4Could not connect to the WAIT server at ls6.informatik.uni-dortmund.de port 1404
    You did not tell the CPAN module about an http proxy.
    I could use such a beast instead of a direct connection.
    No searching available!
    t\basic.............FAILED tests 3-5
	    Failed 3/5 tests, 40.00% okay
    Failed Test Status Wstat Total Fail  Failed  List of Failed
    --------------------------------------------------------------------------------
    
    t\basic.t                      5    3  60.00%  3-5
    Failed 1/1 test scripts, 0.00% okay. 3/5 subtests failed, 40.00% okay.
    NMAKE : fatal error U1077: 'C:\WINNT\system32\cmd.exe' : return code '0xff'
    Stop.
      C:\WINNT\SYSTEM32\nmake.EXE test -- NOT OK
    Running make install
      make test had returned bad status, won't install without force
    CPAN is up to date.
    Bundle summary:  The following items in bulde Bundle::CPAN had installation problems:
      Compress::Zlib Archive::tar Term::ReadKey CPAN::WAIT
    
    cpan>


(whew!  That was a lot of typing!  The blasted cmd.exe window doesn't
seem to have cut and paste!)

I'm at a loss.  Never heard of ls6.informatik.uni-dortmund.de, and I
really don't have a "favourite WAIT server", whatever that is.

Any suggestions on how to proceed?

Thanks!

ali



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

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


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