[19096] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1291 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 12 09:05:43 2001

Date: Thu, 12 Jul 2001 06: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)
Message-Id: <994943112-v10-i1291@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 12 Jul 2001     Volume: 10 Number: 1291

Today's topics:
    Re: about fcntl (Joe Smith)
    Re: Advanced Sorting (Joe Smith)
    Re: Advanced Sorting <wyzelli@yahoo.com>
    Re: Advanced Sorting <iltzu@sci.invalid>
        Archive::Zip problem - how to extract Winzip 8.0 zip fi <Georg.Vassilopulos@SoftwareAG.de>
    Re: argument in regular expression <leclerc.fabrice@wanadoo.fr>
    Re: argument in regular expression (Anno Siegel)
    Re: Execution time for a script <andrew@mvt.ie>
    Re: How popular is Python, anyway? (was: Long Live Pyth (phil hunt)
        How to get the array size with an object ? <nicolas.menoux@wanadoo.fr>
    Re: How to get the array size with an object ? <dbe@wgn.net>
    Re: How to get the array size with an object ? (Anno Siegel)
        How to resolve multi process issue??? (Gururaj Upadhye)
    Re: I'm starting to think our 5.6 install is braindead <ns@cfl.rr.com>
    Re: mod_perl question <jason@uklinux.net>
    Re: my $ref; vs. my $ref = {}; (Garry Williams)
    Re: passing quotes to the command line (Alan)
        rand confusion (Philip Lees)
    Re: rand confusion nobull@mail.com
    Re: rand confusion (Philip Lees)
    Re: Settings locale failed (Karl Orbell)
        Socks 4/5 connections <jeremyalansmith@netscapeonline.co.uk>
    Re: sortlen -- filter to sort text by line length (Yves Orton)
    Re: Text variable containing '$' <jocke30_gbg@hotmail.com>
    Re: Text variable containing '$' (Villy Kruse)
        Textarea / var storage format problem?! (chenit)
        vvp:CGI.pm printing vs executing statments? <vprasad@americasm01.nt.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 12 Jul 2001 07:39:19 +0000 (UTC)
From: inwap@best.com (Joe Smith)
Subject: Re: about fcntl
Message-Id: <9ijk77$qfu$1@nntp1.ba.best.com>

In article <9ijfr6$g8q$1@crchh14.us.nortel.com>,
sarah <lijinzhi@263.net> wrote:
>Hi,
>
>The following is a very simple example of mine:
>
>if (open(FILEH,"test.pl")) {
>    $flag_1=fcntl(FILEH, F_GETFL, 0);
>    $ret_1=fcntl(FILEH, F_SETFL, O_RDWR);
>    $flag_2=fcntl(FILEH, F_GETFL, 0);
>
>    $ret_2=fcntl(FILEH, F_SETLK, F_RDLCK);
>    $ret_3=fcntl(FILEH, F_SETLK, F_WRLCK);
>}
>
>The value of all variables printed are:
>    $flag_1:   "0 but true"
>    $flag_2:   "0 but true" ( I think it should be O_RDWR, ie.3)
>    $ret_1:   "0 but true"
>    $ret_2 & $ret_3: undefined (I think both should be "0 but true")
>
>Why the results are not what I wish?

You left out two very important pieces of information.
What version of perl are you using?
What operating system?  (fcntl works mostly on Unix, not as good on Win32)
	-Joe

--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.


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

Date: Thu, 12 Jul 2001 07:29:27 +0000 (UTC)
From: inwap@best.com (Joe Smith)
Subject: Re: Advanced Sorting
Message-Id: <9ijjkn$qf9$1@nntp1.ba.best.com>

In article <Ova37.24$x84.1434@vic.nntp.telstra.net>,
Wyzelli <wyzelli@yahoo.com> wrote:
>> So really, the documentation tells you how to write this:
>>
>> my $x = { map { $_ => 1 } @Trees };
>
>Assumed typo - %x

No, that is not a typo.  $x is a reference to an anon hash.

>> my @NewTrees = sort keys %$x;
>>
>> and all you've got to do is compose those two lines together into
>> the above.
>
>I don't quite see how it becomes obvious that a block with map in it can
>become a hash by the addition of %

The map does not create a hash.  The outermost set of braces do.

$reference_to_an_anonymous_hash = { key1 => "one", key2 => "two" };
print "The value for 'key1' is ",$reference_to_an_anonymous_hash->{'key1'};

The use of map above was to generate the key+value pairs that will
be stored in the newly created anonymous hash.
	-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.


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

Date: Thu, 12 Jul 2001 17:35:07 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Advanced Sorting
Message-Id: <nNc37.33$x84.1625@vic.nntp.telstra.net>

"Joe Smith" <inwap@best.com> wrote in message
news:9ijjkn$qf9$1@nntp1.ba.best.com...
> In article <Ova37.24$x84.1434@vic.nntp.telstra.net>,
> Wyzelli <wyzelli@yahoo.com> wrote:
> >> So really, the documentation tells you how to write this:
> >>
> >> my $x = { map { $_ => 1 } @Trees };
> >
> >Assumed typo - %x
>
> No, that is not a typo.  $x is a reference to an anon hash.

Agh!  I missed the dereference below...

> >> my @NewTrees = sort keys %$x;
> >>
> >> and all you've got to do is compose those two lines together into
> >> the above.
> >
> >I don't quite see how it becomes obvious that a block with map in it can
> >become a hash by the addition of %
>
> The map does not create a hash.  The outermost set of braces do.

You missed my point, (OK, I probably didn't quite word it right), I am not
concerned here with what is happening so much as that it is not 'obvious'
from the documentation how to get to this point.

> $reference_to_an_anonymous_hash = { key1 => "one", key2 => "two" };
> print "The value for 'key1' is
",$reference_to_an_anonymous_hash->{'key1'};
>
> The use of map above was to generate the key+value pairs that will
> be stored in the newly created anonymous hash.

All that was well understood.  But thanks anyway. :)

Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;




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

Date: 12 Jul 2001 11:25:31 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Advanced Sorting
Message-Id: <994936618.5011@itz.pp.sci.fi>

In article <x7hewiyi71.fsf@home.sysarch.com>, Uri Guttman wrote:
>
>who needs temp variables?
>
>my @NewTrees = sort keys %{ map { $_ -> 1 } @Trees } ;

I'm sure you _meant_ to type:

  my @NewTrees = sort keys %{{ map { $_ => 1 } @Trees }} ;

The outer set of braces is a hash dereference.  The inner set of braces
is obviously a map block.  The _middle_ set is needed to construct an
anonymous hash, so that the outer set has something to dereference.

ObJAPH:

print@{{"buitdtcsxrprlrhognqlvkshjhweoekeuctafanPaJy,r m e z\n"=~/./sg}}{a..z}

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post something,
we discuss its implications.  If the discussion happens to answer a question
you've asked, that's incidental."           -- nobull in comp.lang.perl.misc




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

Date: Thu, 12 Jul 2001 12:50:18 +0200
From: "Georg Vassilopulos" <Georg.Vassilopulos@SoftwareAG.de>
Subject: Archive::Zip problem - how to extract Winzip 8.0 zip files?
Message-Id: <9ijvd9$hva$1@gamma.ecomp.net>

Hello.

With this pice of code it works to extract files compressed with
Archive::Zip - but does not work with files zipped by WinZip 8.0.

Anyone knows if it is possible and how?


if ($myFile =~ /\.zip$/) {
my $zip = Archive::Zip->new($myFile);
my @members = $zip->members();
unlink $myFile;
foreach $memb(@members) {
     $zip -> extractMember($memb);
}


Thank you all a lot!!

Georg Vassilopulos
georg.vassilopulos@softwareag.com




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

Date: Thu, 12 Jul 2001 10:41:33 +0200
From: Fabrice Leclerc <leclerc.fabrice@wanadoo.fr>
Subject: Re: argument in regular expression
Message-Id: <leclerc.fabrice-E024B7.10413312072001@persmail.uhp-nancy.fr>

In article <3B4CEFA2.2EAAE1D7@acm.org>, "John W. Krahn" 
<krahnj@acm.org> wrote:
> 
> Actually you should change that so that $/ isn't set each time in the
> loop (_may_ be faster)
> 
> perl -ne'BEGIN {$/="\n\n"} print if /position:(\d+)-/ and $1 >= 1 and $1
> <= 3000;' input >> output
> 

one more question about this case:
if I already use the $1 variable in the shell script (script.csh \$1), 
how do I do to avoid any confusion with the $1 given in the perl command 
(... and $1 >= 1 ...) ?


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

Date: 12 Jul 2001 09:47:16 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: argument in regular expression
Message-Id: <9ijrn4$pbu$1@mamenchi.zrz.TU-Berlin.DE>

According to Fabrice Leclerc  <leclerc.fabrice@wanadoo.fr>:
> In article <3B4CEFA2.2EAAE1D7@acm.org>, "John W. Krahn" 
> <krahnj@acm.org> wrote:
> > 
> > Actually you should change that so that $/ isn't set each time in the
> > loop (_may_ be faster)
> > 
> > perl -ne'BEGIN {$/="\n\n"} print if /position:(\d+)-/ and $1 >= 1 and $1
> > <= 3000;' input >> output
> > 
> 
> one more question about this case:
> if I already use the $1 variable in the shell script (script.csh \$1), 
> how do I do to avoid any confusion with the $1 given in the perl command 
> (... and $1 >= 1 ...) ?

Since you are quoting the Perl code with '' the shell won't interpret
$1.  No need to worry about that.

Anno


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

Date: Thu, 12 Jul 2001 11:58:24 +0100
From: "Andrew" <andrew@mvt.ie>
Subject: Re: Execution time for a script
Message-Id: <9ijvsm$30q$1@kermit.esat.net>

"Andrew Isherwood" <andy_isherwood@hotmail.com> wrote in message
news:3b49b812.423579134@news.aber.ac.uk...
> Could someone please tell me the easiest way of getting the execution
> time for a script. I'd like to assign this to a variable.
>
> Many thanks
> Andrew

If you're looking to get the time that a script took to execute, you can use
something like this;

$start_time = time;   # Put this at the start of your script

$end_time = time;
$run_time = $end_time - $start_time;  # This will print the time, in
seconds, that the script took to execute.

Andrew




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

Date: Thu, 12 Jul 2001 02:25:13 +0100
From: philh@comuno.freeserve.co.uk (phil hunt)
Subject: Re: How popular is Python, anyway? (was: Long Live Python!)
Message-Id: <slrn9kpv3p.ooh.philh@comuno.freeserve.co.uk>

On 11 Jul 2001 21:20:02 GMT, Gergo Barany <gergo.barany@gmx.net> wrote:
>phil hunt <philh@comuno.freeserve.co.uk> wrote:
>> [snip flamebait crap]
>
>If anyone is going to to respond to this thread, *please* take
>comp.lang.c out of the Newsgroups: list. We don't do advocacy here.
>Followups set.

My post was an entirely objective statistical summary, and contained 
no subjective or opinion-based data at all.

If you think that facts are "crap" and hard statistical analysis
is "flamebait" then all I can say is that it is up to others to
decide, on the basis of your posts, how "crappy" you are.

-- 
## Philip Hunt ## philh@comuno.freeserve.co.uk ##






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

Date: Thu, 12 Jul 2001 11:04:25 +0200
From: "Nicolas MENOUX" <nicolas.menoux@wanadoo.fr>
Subject: How to get the array size with an object ?
Message-Id: <9ijpdt$5d0$1@wanadoo.fr>

Hi,

As I got troubles to get the size of my array, I found on the web that I've
to use the scalar function like my $size = scalar @foo. It works fine BUT
when I want to use the same function with an object item, I've got strange
result.

I've an object (foo_object) which contains one item :

===============
package foo_object;
sub new
{
    my $cela = shift;
    my $classe = ref($cela) || $cela;
    my $self
    {
        foo_array => (),
    };
    bless($self,$classe);
    return ($self);
}
===============
in my main program...
use foo_object;
my $object = new foo_object;
my $size = scalar $object->{foo_array};

Although my foo_array is empty I got always a size set to 1. Why ?

Why the results are not what I wish (ie 0)?
Thanks for help

Nicolas




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

Date: Thu, 12 Jul 2001 02:29:08 -0700
From: "$Bill Luebkert" <dbe@wgn.net>
Subject: Re: How to get the array size with an object ?
Message-Id: <3B4D6DE4.E6FE3E79@wgn.net>

Nicolas MENOUX wrote:
> 
> Hi,
> 
> As I got troubles to get the size of my array, I found on the web that I've
> to use the scalar function like my $size = scalar @foo. It works fine BUT
> when I want to use the same function with an object item, I've got strange
> result.
> 
> I've an object (foo_object) which contains one item :
> 
> ===============
> package foo_object;
> sub new
> {
>     my $cela = shift;
>     my $classe = ref($cela) || $cela;
>     my $self
>     {
>         foo_array => (),
>     };
>     bless($self,$classe);
>     return ($self);
> }
> ===============
> in my main program...
> use foo_object;
> my $object = new foo_object;
> my $size = scalar $object->{foo_array};
> 
> Although my foo_array is empty I got always a size set to 1. Why ?
> 
> Why the results are not what I wish (ie 0)?

Maybe try more like this:

use strict;

#use foo_object;
my $object = new foo_object;
my $size = @{$object->{foo_array}};
print $size, "\n";

package foo_object;

sub new {
	my $cela = shift;
	my $classe = ref ($cela) || $cela;
	my $self = { foo_array => [], };

bless $self, $classe;
return $self;

}


-- 
  ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
 (_/   /  )    // //       DBE Collectibles   Mailto:dbe@todbe.com 
  / ) /--<  o // //      http://dbecoll.webjump.com/ (Free Perl site)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/


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

Date: 12 Jul 2001 10:44:09 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How to get the array size with an object ?
Message-Id: <9ijv1p$8f$1@mamenchi.zrz.TU-Berlin.DE>

According to Nicolas MENOUX <nicolas.menoux@wanadoo.fr>:
> Hi,
> 
> As I got troubles to get the size of my array, I found on the web that I've
> to use the scalar function like my $size = scalar @foo. It works fine BUT

Since $size is a scalar variable, you don't need the "scalar" keyword
on the right side, though it doesn't hurt.

> when I want to use the same function with an object item, I've got strange
> result.
> 
> I've an object (foo_object) which contains one item :
> 
> ===============
> package foo_object;
> sub new
> {
>     my $cela = shift;
>     my $classe = ref($cela) || $cela;
>     my $self
>     {
>         foo_array => (),

You can't assign an array to a hash value, you need an array reference.
Perl would have warned you if you had switched on warnings.  You should
always do that when a program puzzles you.  Actually, you should always
do that.

The effect of your line is the same as if you had written

    { foo_array => }

which inserts the key "foo_array" into the hash with an undefined
value.  Change that to

    { foo_array => [] }

That assigns a reference to an anonymous empty array.

>     };
>     bless($self,$classe);
>     return ($self);
> }
> ===============
> in my main program...
> use foo_object;
> my $object = new foo_object;
> my $size = scalar $object->{foo_array};

Again, "scalar" isn't necessary.

> Although my foo_array is empty I got always a size set to 1. Why ?

That's not what I get.  It assigns an undefined value to $size.

If you correct your code as suggested, you will have to de-reference
the array:

    $size = @{ $object->{ foo_array} };

Anno


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

Date: 12 Jul 2001 05:49:13 -0700
From: gururaj@powertec.com (Gururaj Upadhye)
Subject: How to resolve multi process issue???
Message-Id: <23c54ab6.0107120449.5b154206@posting.google.com>

I have set this on windows NT, with mod perl 1.25. The behaviour is
very
unusual. The first, 3rd, 5th, (odd) access to the script result in
user name and password prompt page to be displayed. At this point if I
hit the browser's back button and try again, the operation is
successful. This has puzzled me a lot and I donot have any solution
for this. 

My guess is that one of the apache processes is responding properly
but other one is not. I am starting Apache as a NT service. How to
resolve this issue?

Thanks and regards,
-Gururaj.


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

Date: Thu, 12 Jul 2001 10:53:06 GMT
From: tuxy <ns@cfl.rr.com>
Subject: Re: I'm starting to think our 5.6 install is braindead
Message-Id: <3B4D8261.2F648304@cfl.rr.com>

Philip Newton wrote:
> 
> On Wed, 11 Jul 2001 20:34:56 GMT, tuxy <ns@cfl.rr.com> wrote:
> 
> > The debugger doesn't show me the blocks as it steps.
> 
> Try using the 'w' command occasionally to show you a 'w'indow of lines
> around the current line.
> 
> Cheers,
> Philip
> --
> Philip Newton <nospam.newton@gmx.li>
> That really is my address; no need to remove anything to reply.
> If you're not part of the solution, you're part of the precipitate.

Wilco!


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

Date: Thu, 12 Jul 2001 10:08:07 +0100
From: Jason Clifford <jason@uklinux.net>
Subject: Re: mod_perl question
Message-Id: <Pine.LNX.4.30.0107121007160.12644-100000@s1.uklinux.net>

On Thu, 12 Jul 2001, it was written:

> Why is this?  Does mod_perl need to be "compiled" into the binary?
>
> My host gives me access to Apache configuration files.  I was hoping I could
> just compile mod_perl and supply Apache with a shared object (.so file).
>
> I've tried this, but with little luck so far.... I'm worried that mod_perl
> might require integration with the Apache binary in some way.

mod_perl needs the header files from the release of apache you'll be
running it on to build properly.

The key here is to remember that it will be running as a module of the web
server.

Jason Clifford



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

Date: Thu, 12 Jul 2001 10:24:24 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: my $ref; vs. my $ref = {};
Message-Id: <slrn9kqumo.jpm.garry@zfw.zvolve.net>

On Wed, 11 Jul 2001 13:05:07 -0400, Benjamin Goldberg
<goldbb2@earthlink.net> wrote:

> When a scalar will autovivify is a confusing issue.  Perhaps someone
> could explain it in some detail?

Someone has: 

  http://tlc.perlarchive.com/articles/perl/ug0002.shtml

-- 
Garry Williams


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

Date: 12 Jul 2001 01:19:57 -0700
From: slush@oceanfree.net (Alan)
Subject: Re: passing quotes to the command line
Message-Id: <880a70aa.0107120019.1518896f@posting.google.com>

> Alan wrote:
> > 
> > Sorry to bother you all,
> > I am trying to pass a single quote properly to the command line and it

Cheers All for your help... most appreciated


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

Date: Thu, 12 Jul 2001 11:33:23 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: rand confusion
Message-Id: <3b4d882b.81064144@news.grnet.gr>

Actually, I'm the one who's confused. This works as expected.

if( rand() < 0.5 ){
	print "Small\n";
}else{
	print "Big\n";
}

However, when I omit the parens after rand, thus:

if( rand < 0.5 ){
	print "Small\n";
}else{
	print "Big\n";
}

perl complains, saying:

> Warning: Use of "rand" without parens is ambiguous at blah.pl line 6
 .
> Unterminated <> operator at blah.pl line 6.

What's going on? What might rand be expecting here? Putting > instead
of < eliminates the problem.

This is ActiveState perl v. 5.6.0, if that makes any difference.

Phil
-- 
Philip Lees
ICS-FORTH, Heraklion, Crete, Greece
Ignore coming events if you wish to send me e-mail
'The aim of high technology should be to simplify, not complicate' - Hans Christian von Baeyer


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

Date: 12 Jul 2001 13:11:19 +0100
From: nobull@mail.com
Subject: Re: rand confusion
Message-Id: <u9k81e8hzs.fsf@wcl-l.bham.ac.uk>

pjlees@ics.forthcomingevents.gr (Philip Lees) writes:

> > Warning: Use of "rand" without parens is ambiguous at blah.pl line 6
> .
> > Unterminated <> operator at blah.pl line 6.
> 
> What's going on?

See the descriptions of these messages in the perldiag manual (or use
diagnostics).

> What might rand be expecting here?

An argument. For details see the description of the rand() function in
the perlfunc manual.

> Putting > instead of < eliminates the problem.

Yes, because > cannot be mistaken for the start of a <> operator.

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


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

Date: Thu, 12 Jul 2001 12:47:33 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: rand confusion
Message-Id: <3b4d9b40.85949228@news.grnet.gr>

On 12 Jul 2001 13:11:19 +0100, nobull@mail.com wrote:

>pjlees@ics.forthcomingevents.gr (Philip Lees) writes:
>
>> > Warning: Use of "rand" without parens is ambiguous at blah.pl line 6
>> .
>> > Unterminated <> operator at blah.pl line 6.
>> 
>> What's going on?
>
>See the descriptions of these messages in the perldiag manual (or use
>diagnostics).
>
>> What might rand be expecting here?
>
>An argument. For details see the description of the rand() function in
>the perlfunc manual.
>
>> Putting > instead of < eliminates the problem.
>
>Yes, because > cannot be mistaken for the start of a <> operator.

Thank you, but I already understood that rand was expecting an
argument. What I didn't understand was how the <> operator could be an
argument for rand? According to the docs the argument should be a
positive number.

Sorry my question wasn't clearer.

Phil
-- 
Philip Lees
ICS-FORTH, Heraklion, Crete, Greece
Ignore coming events if you wish to send me e-mail
'The aim of high technology should be to simplify, not complicate' - Hans Christian von Baeyer


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

Date: 12 Jul 2001 10:11:16 GMT
From: kao98@texel02.doc.ic.ac.uk (Karl Orbell)
Subject: Re: Settings locale failed
Message-Id: <slrn9kqtu4.2ju.kao98@texel02.doc.ic.ac.uk>

I've had this problem myself recently and I traced it down to the fact 
that I didn't have the locales I was requesting setup.  I'm a debian user,
so I'm not sure if this is the same as RedHat, but the default install
only sets up the en_US locale, which is stored in /usr/lib/locale.

To get the others setup, I had to edit a configuration file 
/etc/locale.gen and uncomment all of the locales that I required.

I then had to run locale-gen (as root), this generates the required 
locales.  After this the locales all worked fine, for everything.

Note that this setups the locales using the strict xx_XX language codes,
so if you want french - french ( as apposed to canadian french fr_CA) you 
have to specify fr_FR.  Likewise there is no "en" on it's own, if you want 
these two letter versions you'll have to add an entry in 
/etc/locale.alias.

Hope that helps.

Karl.


On 2 Jul 2001 12:28:39 -0700, les ander <les_ander@yahoo.com> wrote:
>anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message news:<9hg21g$njg$4@mamenchi.zrz.TU-Berlin.DE>...
>
>> According to Andy Dougherty <doughera@maxwell.phys.lafayette.edu>:
>
>> > In article <a2972632.0106281008.38edf409@posting.google.com>, les ander wrote:
>
>> > >Hi, 
>
>>  
>
>> > >perl: warning: Setting locale failed.
>
>> > 
>
>> > [etc.]
>
>> > 
>
>> > Try 
>
>> > 	man perllocale
>
>> > 
>
>> > and check out the section "LOCALE PROBLEMS".
>
>> 
>
>> ...or, if you don't really care about the locale, just unset the $LANG
>
>> environment variable in your shell setup.
>
>> 
>
>> Anno
>
>
>
>I am using tcsh so i did setenv $LANG=""
>
>but i still get this dreadfull message...
>can someone please help me fix it. 
>thanks


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

Date: Wed, 11 Jul 2001 13:44:08 +0100
From: "jeremyalansmith" <jeremyalansmith@netscapeonline.co.uk>
Subject: Socks 4/5 connections
Message-Id: <QNe37.30523$B56.5496986@news2-win.server.ntlworld.com>

Hello,

This is more than an internet question than a Perl one, however it does
relate to an internet app. I posted recently and got a good response.

I am trying to capture sent and received data from an application (mIRC, an
IRC client) to monitor the data it sends, and one easy way to do this is set
up a socks 4 (or 5) proxy within the app, and then monitor the input and
output data through a dummy proxy server (running on my own machine), which
captures all the data.

The Socks 5 specification is quite sketchy on the exact response, and the
Socks 5 white paper has vanished off the web!

From what I can monitor, mIRC (setup to use a proxy on 127.0.0.1 port 80)
sends the bytes 0x04, and 0x01. 04 is the Socks version number, and 01 means

Jeremy.





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

Date: 12 Jul 2001 04:17:00 -0700
From: demerphq@hotmail.com (Yves Orton)
Subject: Re: sortlen -- filter to sort text by line length
Message-Id: <74f348f7.0107120317.54c631c7@posting.google.com>

Benjamin Goldberg <goldbb2@earthlink.net> wrote in message news:<3B49CB78.BD415164@earthlink.net>...

> Or combine things even further:
>     print sort { length($a) <=> length($b) } <>;
> or, with GRT:
>     print map { substr $_, 4 } sort map { pack 'Na*', length, $_ } <>;

Curious about something, surely the following is more efficient
(focusing only on the sort part, input/output concerns aside....)

#Shwarzian Transform
my @sorted=map {
                 $_->[1]
               } sort { 
                       $a->[0] <=> $b->[0]
                      } map {
                             [length($_),$_]
                            } @string_list;

From what Ive read/experienced this type of transform is MUCH more
efficient than repeatedly calling function on each element in the
compare part of the sort, especially on large arrays. (Although
length() may be a special case.  I believe Perl stores the string
length as part of the SV so it does not need to be mapped out
first...)

Obviously this is basically the same as your last example with no
substr overhead.


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

Date: Thu, 12 Jul 2001 10:39:01 +0200
From: "JJ" <jocke30_gbg@hotmail.com>
Subject: Re: Text variable containing '$'
Message-Id: <9ijnm8$91o$1@vg170.it.volvo.se>

"Michael Carman" <mjcarman@home.com> wrote in message
news:3B4C759E.57BFA7FC@home.com...
> JJ wrote:
> >
> > I collect table names from a database and stores them in a array.
> > The table names can contain the character '$' such as 'My$Table'.
> > Before I store the value in the array I need to determine if it
> > contains the character and replace '$' with '\$'.
>
> Hmm. Why do you think you need to do this? I highly doubt that it's
> necessary.

I have a Perl program that calls another perl program via system(...) with
an parameter value, such as:

system('./myOtherPerlApp.pl $param1');

$param1 contains the value 'test$again'.
When myOtherPerlApp.pl get this value it only uses 'test' since it handles
'$again' as a uninitilized variable.

>
> > How can I do this?
>
> s/\$/\\\$/g;

Thanks!

BR
Jocke




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

Date: 12 Jul 2001 09:51:09 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: Text variable containing '$'
Message-Id: <slrn9kqsoc.rh6.vek@pharmnl.ohout.pharmapartners.nl>

On Thu, 12 Jul 2001 10:39:01 +0200,
    JJ <jocke30_gbg@hotmail.com> wrote:


>
>I have a Perl program that calls another perl program via system(...) with
>an parameter value, such as:
>
>system('./myOtherPerlApp.pl $param1');
>
>$param1 contains the value 'test$again'.
>When myOtherPerlApp.pl get this value it only uses 'test' since it handles
>'$again' as a uninitilized variable.
>


As written the shell will see the variable $param1 and do the substitution.


system("./myOtherPerlApp.pl $param1");

This version the $param1 will be interpolated by perl an get the value
'test$again', which the shell will try to interpolate.

Using the list form of system you eliminate the shell as in:

system("./myOtherPerlApp.pl",  "$param1");

And as "$param1" is the only thing in the string you could use the
$param1 directly instead, as in:

system("./myOtherPerlApp.pl",  $param1);

If you want your program to see the litteral string '$param1' instead
of the value of the variable $param1 then single quote it as in:

system("./myOtherPerlApp.pl",  '$param1');

When eliminating the shell you also eliminate the need for quoting
the shell metcharacters, which in some cases makes things easier.

Villy


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

Date: 12 Jul 2001 05:45:10 -0700
From: chenit@surtax.com (chenit)
Subject: Textarea / var storage format problem?!
Message-Id: <464eb995.0107120445.37468399@posting.google.com>

I have a question regarding a textarea input that gives me problem in
the following case:

I have pre-written templates which I use in e-mail messages. I can
modify those templates by using textarea inputs in the program setup
module.

I short I got this:

if (!$REG_MESSAGE) { $REG_MESSAGE=      $t{'welcome_email'}     }

in the above : $t{'welcome_email'} is an hash value I set to allow
different languages module..

By default the above send a valid message to the recipient.

But If I modify $REG_MESSAGE using a textarea input, the recipient
gets a incomplete message, often truncated from place to place??

$REG_MESSAGE is then stored in a setup file I read when calling the
program between "qq~ ~" boundaries

like this:

$REG_MESSAGE = qq~blah blah

blah blah

blah~;

I haven't been able to figure out why it does that. I had wrap=hard
but after removing it it still does it What is wrong with this damn
thing?

I am not sure if it is the textarea or the way I store the new value
of $REG_MESSAGE that does this

On a Unix server running Perl 5

Any help would be quite welcome..


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

Date: Thu, 12 Jul 2001 07:51:00 -0400
From: "Prasad, Victor [FITZ:K500:EXCH]" <vprasad@americasm01.nt.com>
Subject: vvp:CGI.pm printing vs executing statments?
Message-Id: <3B4D8F24.DAF607BE@americasm01.nt.com>

Hello,

I have a litte piece of code - where the first to lines in the if
statement just print to the screen -whereas the elsif actually execustes
a statement - they are very much the same.  How do I make the first if
execute - not display?

print $cgi->p("catalog: $catalog dataset: $dataset");<--THIS PRINTS

        if ($catalog && $dataset)
                {
                print $cgi->p (`/home/netsite/upd_catalog/upd_catalog
$catalog s
umitt_aaa`) or die "Error from script."; <--this prints the URL

                print $cgi->p (`/home/netsite/upd_catalog/upd_dataset
$dataset s
umitt_aaa`) or die "Error from script."; <--this prints the URL
                }

        elsif ($catalog && !$dataset)
                {
                print $cgi->p (`/home/netsite/upd_catalog/upd_catalog
$catalog s
umitt_aaa`) or die "Error from script.";<--this EXECUTES upd_catalog
with the parameter $catalog


I am using backquotes on each statement - but one executes and the first
one just prints.  

The parameters are passed.

Output (first 'if')- if $catalog and $dataset are given the values 1:

catalog: 1 dataset: 1

/home/netsite/upd_catalog/upd_catalog $catalog sumitt_aaa

/home/netsite/upd_catalog/upd_dataset $dataset sumitt_aaa

Output (elsif)- if $catalog is given the value 1:

catalog ID: 1 Updating: TO sumitt_aaa About to update catalog: 1 ... to
DB sumitt_aaa. Catalog 1 exists on the destination server. Replacing it
with the source information... Just saved old data to file
old_prod_catalog_data.unl ... Just started a transaction ... Just
obtained lock on sumitt_aaa table catalog... Just deleted old data ...
Just inserted new data ... Just saved all changes successfully. 
<script is run> - this is what I want.


Help?

Thanks,

V


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

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


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