[25522] in Perl-Users-Digest
Perl-Users Digest, Issue: 7766 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 10 14:05:43 2005
Date: Thu, 10 Feb 2005 11:05:21 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 10 Feb 2005 Volume: 10 Number: 7766
Today's topics:
adding webmin user with commandline <sam.wun@authtec.com>
Re: adding webmin user with commandline <nospam@bigpond.com>
Re: Alternative in regexps <grabek@invalid.com>
Re: installing modules to ActiveState Perl from cpan do <toddrw69@excite.com>
Re: Is LWP thread-safe? <postmaster@castleamber.com>
Re: Lexical scoping question. <larry_wallet@yahoo.com>
Re: Lexical scoping question. <do-not-use@invalid.net>
Re: Lexical scoping question. <matternc@comcast.net>
Re: Lexical scoping question. <dwall@fastmail.fm>
Re: Lexical scoping question. <noreply@gunnar.cc>
Re: Lexical scoping question. <dwall@fastmail.fm>
Re: need to remove a function from c source code <webwesen@gmail.com>
opening a file to read and write ioneabu@yahoo.com
Re: opening a file to read and write <mritty@gmail.com>
Re: opening a file to read and write <matternc@comcast.net>
Re: opening a file to read and write <mkorte@gmx.de>
Re: opening a file to read and write <dwall@fastmail.fm>
Re: opening a file to read and write <1usa@llenroc.ude.invalid>
Re: opening a file to read and write ioneabu@yahoo.com
Re: opening a file to read and write <noreply@gunnar.cc>
Re: opening a file to read and write ioneabu@yahoo.com
Re: opening a file to read and write <1usa@llenroc.ude.invalid>
Re: opening a file to read and write <nobull@mail.com>
Re: perl and samba <noeldamonmiller@gmail.com>
Re: perl and samba <toreau@gmail.com>
Re: ptk_steal <cchiesa1@rochester.rr.com>
Re: string and pattern problem (Anno Siegel)
Re: TCP connection close after starting a command sessi <nobull@mail.com>
Re: The Problem with Perl <goedicke@brandeis.edu>
Re: The Problem with Perl xhoster@gmail.com
Re: The Problem with Perl <cwilbur@mithril.chromatico.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 11 Feb 2005 00:29:48 +0800
From: sam <sam.wun@authtec.com>
Subject: adding webmin user with commandline
Message-Id: <cug3l9$ggk$1@news.hgc.com.hk>
Hi,
Can anybody please tell me a way to add a webmin user using unix shell
commandline?
Thanks
Sam
------------------------------
Date: Fri, 11 Feb 2005 03:13:45 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: adding webmin user with commandline
Message-Id: <371j29F57h50fU1@individual.net>
sam wrote:
> Hi,
>
> Can anybody please tell me a way to add a webmin user using unix shell
> commandline?
>
> Thanks
> Sam
No, because its offtopic.
gtoomey
------------------------------
Date: Thu, 10 Feb 2005 17:43:40 +0000 (UTC)
From: Lukasz Grabun <grabek@invalid.com>
Subject: Re: Alternative in regexps
Message-Id: <slrnd0n7as.2p8.grabek@localhost.localdomain>
On Wed, 09 Feb 2005 16:00:55 -0500, Chris Mattern wrote:
> No, it can't. Do NOT parse HTML with regular expressions. That way lies
> madness.
After postin this question to c.l.p.m. I ran across an article in which
author stated something like: "breaking the rule of not parsing the HTML
with plain vanilla regexps I came up with this little script" or
something similar.
Shouldn't it be in FAQ - you shan't parse HTML with regular expressions,
ye wannabe perl hacker? :-)
> Go to CPAN, get an HTML-parsing module that looks like it'll meet your
> needs, live happily ever after.
I've found few. Looking into documentation was like opening another can
of worms. Well, we'll see.
Thank you all for the answers. I guess I'll post another stupid question
sooner or later.
------------------------------
Date: Thu, 10 Feb 2005 16:08:21 GMT
From: "Todd W" <toddrw69@excite.com>
Subject: Re: installing modules to ActiveState Perl from cpan downloads
Message-Id: <VFLOd.4257$hU7.3798@newssvr33.news.prodigy.com>
<ioneabu@yahoo.com> wrote in message
news:1107991363.539352.22570@z14g2000cwz.googlegroups.com...
> Nevermind. Sorry, I found the ppms I need at:
>
> http://ppm.activestate.com/PPMPackages/zips/8xx-builds-only/Windows/
>
Make sure you also have the actual module. If you open up a .ppd file in a
text editor, you'll see its an xml file that describes what needs to be done
to intall the module. To do what you want, you'll need to download the
.tar.gz file the .ppd file references, and then change the .ppd file to
point at the local .tar.gz file. You also cant forget about dependencies.
This part can get really confusing if you try to do it all by hand.
Todd W.
------------------------------
Date: 10 Feb 2005 17:46:42 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Is LWP thread-safe?
Message-Id: <Xns95F977D0C99F7castleamber@130.133.1.4>
Agent2002 wrote:
> Hi,
> I enjoyed LWP so much that it can help me automating nearly all the
> tasks a web browser can do. I also found that combining LWP with Perl's
> new multi-thread model "ithread" can improve the efficiency of my web
> scripts significantly, about ten or more times faster, perhaps.
> For example, I've written a Perl script that can download the latest
> news from CNN.com very quickly since it uses ten threads every instant
> and it works very fine and has never got any problem. However, the
> script I wrote recently using LWP and ithread together crashes every
> time when it has accessed a URL using sufficient proxies. And I always
> get the following error message:
> Free to wrong pool 15306e48 not 272770.
> I really have no idea whether it is caused by the LWP module. Could any
> one tell me doubtlessly the LWP module is thread-safe or not? Thank you
> very much.
Have you looked at the parallel useragent module? It doesn't use threads
(AFAIK), but does work in parallel (maybe less efficient)
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: 10 Feb 2005 06:12:55 -0800
From: "Larry" <larry_wallet@yahoo.com>
Subject: Re: Lexical scoping question.
Message-Id: <1108044775.001335.15950@l41g2000cwc.googlegroups.com>
Louis. wrote:
> Hi,
>
> The below script will print "var is apple". I find this weird,
because
> in textbooks you are taught to pass variable to subroutines as
> parameters. What is the point of doing this, if the variable is
> visible anyway?
>
> How can I make the variable exist in main and yet be invisible to the
> subroutine? I know I can create another variable with "my" and with
> the same name in the subroutine. This will block the subroutine from
> seeing variable in main, but is this really the way to do it, it
seems
> very cumbersom.
>
> TIA,
> Louis.
>
> my $var = "apple";
> routine();
>
> sub routine {
> print "var is $var.\n";
> }
>
>
>
>
> Solution???
>
> {
> my $var = "apple";
> routine($var);
> }
>
> sub routine {
> my $var = $_[0];
> print "var is $var.\n";
> }
#include <stdio.h>
int print_a();
int a = 5;
int main()
{
print_a();
}
int print_a()
{
printf("%d\n",a);
}
looks like you can mess it up in C too.
------------------------------
Date: 10 Feb 2005 15:47:12 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Lexical scoping question.
Message-Id: <yzdfz04321b.fsf@invalid.net>
> The below script will print "var is apple". I find this weird, because
> in textbooks you are taught to pass variable to subroutines as
> parameters. What is the point of doing this, if the variable is
> visible anyway?
>
> How can I make the variable exist in main and yet be invisible to the
> subroutine? I know I can create another variable with "my" and with
> the same name in the subroutine. This will block the subroutine from
> seeing variable in main, but is this really the way to do it, it seems
> very cumbersom.
>
> my $var = "apple";
> routine();
>
> sub routine {
> print "var is $var.\n";
> }
You can declare the function before the variable:
sub routine {
print "var is $var.\n";
}
my $var = "apple";
routine();
------------------------------
Date: Thu, 10 Feb 2005 10:15:25 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: Lexical scoping question.
Message-Id: <HKydncLBhuES55bfRVn-gg@comcast.com>
Louis. wrote:
> Hi,
>
> The below script will print "var is apple". I find this weird, because
> in textbooks you are taught to pass variable to subroutines as
> parameters. What is the point of doing this, if the variable is
> visible anyway?
You avoid using global effects because it's good programming practice
and significantly improves the maintainability of your scripts, not
because the language makes you do it.
>
> How can I make the variable exist in main and yet be invisible to the
> subroutine?
Lexical variables don't exist in main; they don't exist in *any*
package. That's why they're lexical. Lexical variables are
statically scoped to the block that contains them. If they're
not contained in a block, they're scoped to the file they're in.
> I know I can create another variable with "my" and with
> the same name in the subroutine. This will block the subroutine from
> seeing variable in main, but is this really the way to do it, it seems
> very cumbersom.
Really? Doesn't seem that way to me. YMMV, I guess.
>
> TIA,
> Louis.
>
> my $var = "apple";
> routine();
>
> sub routine {
> print "var is $var.\n";
> }
>
>
>
>
> Solution???
>
> {
> my $var = "apple";
> routine($var);
> }
>
> sub routine {
> my $var = $_[0];
> print "var is $var.\n";
> }
Yes, that's how you do it. You should *always* define lexicals in the
smallest possible block. A good way to help you do this is to get in
the habit of not declaring variables until you need them.
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Thu, 10 Feb 2005 15:37:37 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: Lexical scoping question.
Message-Id: <Xns95F96C1AA4DFAdkwwashere@216.168.3.30>
Louis. <louis@despammed.com> wrote:
> The below script will print "var is apple". I find this weird,
> because in textbooks you are taught to pass variable to
> subroutines as parameters. What is the point of doing this, if the
> variable is visible anyway?
I think the point is that you have a choice. If you want to use a
variable from a larger scope inside a subroutine you're free to do so.
Perl itself doesn't pass judgement on it; Perl *programmers*, on the
other hand....
> my $var = "apple";
> routine();
>
> sub routine {
> print "var is $var.\n";
>}
--
David Wall
------------------------------
Date: Thu, 10 Feb 2005 18:12:37 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Lexical scoping question.
Message-Id: <371istF58b0miU1@individual.net>
David K. Wall wrote:
> I think the point is that you have a choice. If you want to use a
> variable from a larger scope inside a subroutine you're free to do so.
> Perl itself doesn't pass judgement on it;
That's not always true.
sub outer {
my $var = 'apple';
sub inner {
".. but \$var is still '$var' acc. to inner().\n"
}
if (shift) {
$var =~ s/apple/banana/;
print "\$var is now '$var' ..\n";
print inner();
return;
}
print "\$var is '$var'.\n";
}
outer();
outer(1);
Outputs:
$var is 'apple'.
$var is now 'banana' ..
.. but $var is still 'apple' acc. to inner().
(plus the warning: Variable "$var" will not stay shared)
When running a program under mod_perl, this phenomenon may occur also
when non-nested subroutines use file scoped variables.
> Perl *programmers*, on the other hand....
Making passing of variables a habit is not only a matter of style.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Thu, 10 Feb 2005 18:05:58 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: Lexical scoping question.
Message-Id: <Xns95F985413737Ddkwwashere@216.168.3.30>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> David K. Wall wrote:
>> I think the point is that you have a choice. If you want to use
>> a variable from a larger scope inside a subroutine you're free to
>> do so. Perl itself doesn't pass judgement on it;
>
> That's not always true.
>
> sub outer {
> my $var = 'apple';
> sub inner {
> ".. but \$var is still '$var' acc. to inner().\n"
> }
> if (shift) {
> $var =~ s/apple/banana/;
> print "\$var is now '$var' ..\n";
> print inner();
> return;
> }
> print "\$var is '$var'.\n";
> }
>
> outer();
> outer(1);
>
> Outputs:
> $var is 'apple'.
> $var is now 'banana' ..
> .. but $var is still 'apple' acc. to inner().
>
> (plus the warning: Variable "$var" will not stay shared)
>
> When running a program under mod_perl, this phenomenon may occur
> also when non-nested subroutines use file scoped variables.
I don't see a problem there. The results might not be what you
expect, but perl will still let you use a variable from a larger
scope inside a subroutine, and even warn you when it sees what it
"thinks" are possibly unintended consequences. Doesn't seem very
judgemental to me.
>> Perl *programmers*, on the other hand....
>
> Making passing of variables a habit is not only a matter of style.
I certainly never intended to say that, but since you're on about it,
how about expanding on that comment? Offhand I can think of two
situations where you HAVE to pass parameters to a sub: recursive
functions and OOP.
(For some truly tangled code that uses global variables for
everything, take a look at the Greymatter blogging code. Urgh...)
--
David Wall
------------------------------
Date: 10 Feb 2005 07:56:46 -0800
From: "webwesen" <webwesen@gmail.com>
Subject: Re: need to remove a function from c source code
Message-Id: <1108051006.909002.66270@l41g2000cwc.googlegroups.com>
well, i would have written scan + brackets search in Perl...
thanks
------------------------------
Date: 10 Feb 2005 06:39:56 -0800
From: ioneabu@yahoo.com
Subject: opening a file to read and write
Message-Id: <1108046396.098348.238470@o13g2000cwo.googlegroups.com>
open $file, '+>', $File::Find::name;
This did not do what I expected. It deleted all my file's contents!
Here's my whole program:
#!/c:/perl/bin/perl.exe
#change shebang line for my Windows computer for all scripts
use warnings;
use strict;
my $shebang = '#!/c:/perl/bin/perl.exe';
use File::Find;
find(\&wanted, $ARGV[0]);
sub wanted
{
if (/\.pl$/)
{
open my $file, '<', $File::Find::name;
my $contents = <$file>;
close $file;
return if not $contents;
chomp $contents;
return if $contents =~/^$shebang$/;
if ($contents =~/^#!/)
{
open $file, '<', $File::Find::name;
my @contents = <$file>;
close $file;
$contents[0] = $shebang."\n";
open $file, '>', $File::Find::name;
print $file @contents;
close $file;
print "Changed: $File::Find::name\n";
}
}
}
Did I really have to open and close so many times? Thanks!
wana
------------------------------
Date: Thu, 10 Feb 2005 15:11:07 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: opening a file to read and write
Message-Id: <fQKOd.9498$sR5.2134@trndny05>
<ioneabu@yahoo.com> wrote in message
news:1108046396.098348.238470@o13g2000cwo.googlegroups.com...
> open $file, '+>', $File::Find::name;
>
> This did not do what I expected. It deleted all my file's contents!
Which is, of course, exactly what the documentation says it will do. It
is your expectations that were misguided.
> Here's my whole program:
>
> #!/c:/perl/bin/perl.exe
> #change shebang line for my Windows computer for all scripts
Why? Windows couldn't care less what path is specified in the shebang.
> use warnings;
> use strict;
>
> my $shebang = '#!/c:/perl/bin/perl.exe';
>
> use File::Find;
> find(\&wanted, $ARGV[0]);
> sub wanted
> {
> if (/\.pl$/)
Arrrrg. More horribly formatted code. Please use a real newsserver
until Google Groups gets their act together.
> {
> open my $file, '<', $File::Find::name;
> my $contents = <$file>;
> close $file;
> return if not $contents;
> chomp $contents;
> return if $contents =~/^$shebang$/;
> if ($contents =~/^#!/)
> {
> open $file, '<', $File::Find::name;
> my @contents = <$file>;
Why did you open, read one line, close, and open again? If you want to
'rewind' the input file, just use seek. Or you could even just read the
rest of the file in without seeking, storing everything in @contents:
my @contents = $contents, <$file>;
> close $file;
> $contents[0] = $shebang."\n";
> open $file, '>', $File::Find::name;
> print $file @contents;
> close $file;
> print "Changed: $File::Find::name\n";
> }
> }
> }
> Did I really have to open and close so many times? Thanks!
No. I would strongly suggest you read the documentation. In this case,
perldoc perlopentut
See the section "Mixing Reads and Writes", and read the part that tells
you this is almost certainly not the approach you should be using (3rd
paragraph of this section)
Paul Lalli
------------------------------
Date: Thu, 10 Feb 2005 10:19:07 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: opening a file to read and write
Message-Id: <HKydnf3BhuH25pbfRVn-gg@comcast.com>
ioneabu@yahoo.com wrote:
> open $file, '+>', $File::Find::name;
>
> This did not do what I expected. It deleted all my file's contents!
>
Why did you not read perldoc -f open, then? It would've told you
that's what would happen. It also tells you the right way to do
it, and given you warning about doing it that way, and suggested
yet another approach.
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Thu, 10 Feb 2005 16:23:55 +0100
From: "Michael Korte" <mkorte@gmx.de>
Subject: Re: opening a file to read and write
Message-Id: <cufuad$ihb$1@pentheus.materna.de>
<ioneabu@yahoo.com> schrieb im Newsbeitrag
news:1108046396.098348.238470@o13g2000cwo.googlegroups.com...
> Did I really have to open and close so many times? Thanks!
why do you need a shebang at DOS ? there is no need in, because DOS will
know what interpreter should work with your string while you use extension
*.pl
I do not know any possibility to open a file for both reading and writing,
but i can offer you a smaller version of your function wanted that needs
only a 2times opening.
sub wanted{
if(/\.pl$/){
open my $file, '<', $File::Find::name;
my @cont = <$file>; # read the whole file to array
close($file);
if($cont[0]=~/^#!/){ # ahh there is a shebang ..
$cont[0] = $shebang . "\n"; # overwrite the first line
}
open my $file, '>', $File::Find::name;
print $file @cont;
close($file);
print "Changed: $File::Find::name\n";
}
}
if you would use an OS you also could do your work even faster and with a
less amount of lines ;-)
HTH
Michael
--
$J=$A=$P=@H;
$JAPH=\&JAPH;@H=split("","j".&$JAPH."t".&$JAPH."lcuahp".
&$JAPH."ksneehetorrar");$JA=1;$PP=@H-1;
$JAP=@H/6;while($JA){print$PH.$JAH.$H[$A];$P++;$A+=6;if($P%
$JAP==$HHH){$J++;$A=$PH+$J;}if($JJA+$P>$PP){undef
$JA;$PH;printeval(reverse";))01(rhc(nruter")}}sub
JAPH{eval(reverse";))23(rhc(nruter")}
------------------------------
Date: Thu, 10 Feb 2005 15:35:48 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: opening a file to read and write
Message-Id: <Xns95F96BCBA41D8dkwwashere@216.168.3.30>
<ioneabu@yahoo.com> wrote:
> open $file, '+>', $File::Find::name;
>
> This did not do what I expected. It deleted all my file's
> contents!
That's what it's supposed to do. See 'perldoc -f open', and pay
particular attention to the 6th paragraph.
--
David Wall
------------------------------
Date: Thu, 10 Feb 2005 15:43:19 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: opening a file to read and write
Message-Id: <Xns95F96D12AB396asu1cornelledu@127.0.0.1>
ioneabu@yahoo.com wrote in news:1108046396.098348.238470
@o13g2000cwo.googlegroups.com:
> #!/c:/perl/bin/perl.exe
> #change shebang line for my Windows computer for all scripts
There is absolutely no reason for this.
Sinan
------------------------------
Date: 10 Feb 2005 07:51:17 -0800
From: ioneabu@yahoo.com
Subject: Re: opening a file to read and write
Message-Id: <1108050677.542425.313570@z14g2000cwz.googlegroups.com>
Michael Korte wrote:
> <ioneabu@yahoo.com> schrieb im Newsbeitrag
> news:1108046396.098348.238470@o13g2000cwo.googlegroups.com...
>
> > Did I really have to open and close so many times? Thanks!
>
> why do you need a shebang at DOS ? there is no need in, because DOS
will
> know what interpreter should work with your string while you use
extension
> *.pl
Thanks to all for advice. I'll go do my reading.
The reason the shebang is needed in Windows is for Apache. Maybe my
Apache config is not set up right, but it only runs my scripts in
cgi-bin with the right shebang line.
The reason for opening and reading the first line only was to try and
prevent reading in the whole file if it didn't need to be changed. I
guess none of my scripts are that long that it will save much time.
wana
------------------------------
Date: Thu, 10 Feb 2005 17:20:17 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: opening a file to read and write
Message-Id: <371fpgF52b7m2U1@individual.net>
ioneabu@yahoo.com wrote:
> The reason the shebang is needed in Windows is for Apache.
If you put a copy of perl.exe in C:/usr/bin, the 'standard' shebang line
works, and you don't need to struggle with changing it.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 10 Feb 2005 08:42:21 -0800
From: ioneabu@yahoo.com
Subject: Re: opening a file to read and write
Message-Id: <1108053741.175524.44900@o13g2000cwo.googlegroups.com>
Gunnar Hjalmarsson wrote:
> ioneabu@yahoo.com wrote:
> > The reason the shebang is needed in Windows is for Apache.
>
> If you put a copy of perl.exe in C:/usr/bin, the 'standard' shebang
line
> works, and you don't need to struggle with changing it.
>
Brilliant! Thank you!
wana (kicking self)
------------------------------
Date: Thu, 10 Feb 2005 17:12:29 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: opening a file to read and write
Message-Id: <Xns95F97C30DD6D3asu1cornelledu@127.0.0.1>
ioneabu@yahoo.com wrote in
news:1108053741.175524.44900@o13g2000cwo.googlegroups.com:
>
> Gunnar Hjalmarsson wrote:
>> ioneabu@yahoo.com wrote:
>> > The reason the shebang is needed in Windows is for Apache.
>>
>> If you put a copy of perl.exe in C:/usr/bin, the 'standard' shebang
> line
>> works, and you don't need to struggle with changing it.
>>
>
> Brilliant! Thank you!
>
> wana (kicking self)
None of this hassle is necessary if you have:
ScriptInterpreterSource Registry-Strict
in httpd.conf (can be set on a location or directory basis as well) and:
[HKEY_CLASSES_ROOT\Perl\shell\ExecCGI\command]
@="\"C:\\opt\\Perl\\bin\\perl.exe\" \"%1\" %*"
in the windows registry
Sinan
------------------------------
Date: Thu, 10 Feb 2005 17:33:26 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: opening a file to read and write
Message-Id: <cug5iu$84q$1@sun3.bham.ac.uk>
ioneabu@yahoo.com wrote:
> open $file, '+>', $File::Find::name;
>
> This did not do what I expected. It deleted all my file's contents!
Others have directed you to perlfunc and perlopentut.
But nobody as far as I can see has mentioned FAQ: "How come when I open
a file read-write it wipes it out?".
If you do nothing else before asking a question you should at the very
least ensure that your question is not _exactly_ the same as one in the FAQ.
------------------------------
Date: 10 Feb 2005 08:56:00 -0800
From: "noeldamonmiller@gmail.com" <noeldamonmiller@gmail.com>
Subject: Re: perl and samba
Message-Id: <1108054560.462490.95190@c13g2000cwb.googlegroups.com>
man smbclient (the -L option is probably what you need)
as for the hooks into samba with perl I suggest you go to cpan.org and
do a module search for samba.
Best of luck to you :)
Noel
------------------------------
Date: Thu, 10 Feb 2005 18:26:09 +0100
From: Tore Aursand <toreau@gmail.com>
Subject: Re: perl and samba
Message-Id: <JOMOd.8382$IW4.196117@news2.e.nsc.no>
Alexandre Jaquet wrote:
> Hi again, anbody knows how I can retrieve a directory strucutre using
> samba ? (as windows explorer does when we explore network)
<http://www.cpan.org/>
--
Tore Aursand <tore@aursand.no>
"There are three kinds of lies: lies, damn lies, and statistics."
(Benjamin Disraeli)
------------------------------
Date: 10 Feb 2005 06:49:41 -0800
From: "Chris" <cchiesa1@rochester.rr.com>
Subject: Re: ptk_steal
Message-Id: <1108046981.370131.185510@f14g2000cwb.googlegroups.com>
If you don't mind having the xterm temporarily come up in its own
window, a different approach may be easier for you: let the xterm, et
al, create its window "as usual," then REPARENT it into the desired
"container" window in your app.
All YOUR code needs to do is launch the xterm, find its top-level
window (left as an exercise for the reader), and reparent it into the
window of your desired container. I imagine you would have to find
ways to deal with resize, reconfigure, etc. events on the container
window, but... this should get you at least MOST of the way to where
you want to be.
Your mileage may vary.
Chris
------------------------------
Date: 10 Feb 2005 18:50:44 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: string and pattern problem
Message-Id: <cugae4$j63$1@mamenchi.zrz.TU-Berlin.DE>
Steven Kuo <skuo@mtwhitney.nsc.com> wrote in comp.lang.perl.misc:
> On 10 Feb 2005, Anno Siegel wrote:
> > while ( m{ ((\d+) / (\d+) - (\d+)) }xg ) {
> > print "$1\n" if $allowed{ (), map length() => $2, $3, $4};
> > }
>
>
>
>
> Interesting. I realize the expression to generate the hash key is in
> list context -- I've just not seen it written that way before. My
> usual syntax would be
>
> print "$1\n" if $allowed{ join $; => map length() => $2, $3, $4};
>
> Thanks for the "golf lesson".
The content of the hash braces must look like a list, you need a literal
comma there.
However, looking at it again, the use of map is a bit silly here, it
would be better written
print "$1\n" if $allowed{ length $2, length $3, length $4};
Now the commas come naturally.
Anno
------------------------------
Date: Thu, 10 Feb 2005 17:42:06 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: TCP connection close after starting a command session
Message-Id: <cug638$8hn$1@sun3.bham.ac.uk>
bahat@topio.com wrote:
[ lot's of prose]
> When I changed the 'close $client' to 'shutdown($client,2) it worked
> but I want to understand what I'm seeing.
Rather than trying to describe what you've done in English, please post
a _minimal_ but _complete_ script to illustrate what you are saying.
It got rather lost as to exactly which bits of what you were describing
were happening on the client and which on the server.
------------------------------
Date: Thu, 10 Feb 2005 12:00:05 -0500
From: William Goedicke <goedicke@brandeis.edu>
Subject: Re: The Problem with Perl
Message-Id: <m3is50gxka.fsf@goedsole.com>
Dear Charlton et al -
>>>>> "Charlton" == Charlton Wilbur <cwilbur@mithril.chromatico.net> writes:
>>>>> "WG" == William Goedicke <goedicke@brandeis.edu> writes:
WG> What are the other similar mechanisms people use effectively
WG> to make their Perl code more comprehensible and maintainable?
Charlton> The same approaches I use in any language: variables are
Charlton> minimally scoped, with names that are proportional to
Charlton> the size of their scope; sensible modular design, often
Charlton> object-oriented, with a test suite for any module that
Charlton> is more than minimally complex; documentation as
Charlton> necessary.
That's good advice, thanks.
- Billy
============================================================
William Goedicke goedicke@goedsole.com
Cell 617-510-7244 http://www.goedsole.com:8080
============================================================
Lest we forget:
War is caused by the squabling of princes.
- Machievelli
------------------------------
Date: 10 Feb 2005 17:41:42 GMT
From: xhoster@gmail.com
Subject: Re: The Problem with Perl
Message-Id: <20050210124142.599$1g@newsreader.com>
Abigail <abigail@abigail.nl> wrote:
> Charlton Wilbur (cwilbur@mithril.chromatico.net) wrote on MMMMCLXXX
> September MCMXCIII in <URL:news:87wtthxqlp.fsf@mithril.chromatico.net>:
> ''
> '' Which is a good philosophy -- but if I were a manager for a large
> '' project, it would certainly be *safer* to hire a bunch of mediocre
> '' programmers and give them a bondage-and-discipline language than to
> '' hire a few brilliant programmers and give them Perl -- because it's
> '' hard to distinguish in the hiring process between a mediocre
> '' programmer and a brilliant programmer who doesn't interview well, or
> '' between a brilliant programmer who is quirky but productive and a
> '' brilliant programmer who is impossible to work with.
>
> If you have a project where you can't distinguish the difference between
> a bunch of mediocre programmers, and a few brilliant coders, by all
> means, hire the mediocre programmers.
The problem is not in distinguishing between the results of mediocre
programmers and brilliant programmers. The problem is figuring which
is which during the hiring process. All programmer claim to be brilliant
while seeking jobs. And the pointy haired manager who has to make the
hiring decision is probably not so competent at seeing through that.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Thu, 10 Feb 2005 18:09:21 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: The Problem with Perl
Message-Id: <87ekfoxpl7.fsf@mithril.chromatico.net>
>>>>> "WG" == William Goedicke <goedicke@brandeis.edu> writes:
WG> Dear Y'all -
>>>>> "Charlton" == Charlton Wilbur <cwilbur@mithril.chromatico.net>
WG> writes:
A> [...] hire the mediocre programmers.
Charlton> Well, the only way to tell if a coder is going to be
Charlton> brilliant is to observe what he or she produces.
WG> A *good* manager should be expected to recoginze the talents
WG> of both those who are working for them and candidates for
WG> positions. That ability is what justifies the higher manager
WG> salary.
WG> It's a difficult task to identify the critical information to
WG> gather about somebody before you hire them and, to accurately
WG> evaluate that information before awarding them the position.
WG> This is another skill that should be expected of somebody who
WG> warrents the salary of a manager.
You might want to take a look at some of the literature on this. I
agree that both those skills are frequently expected; but especially
in the case of the latter, that skill seems about as common as the
ability to turn lead into gold with a touch. It's also a fairly
subjective call to make, which means that people who are convinced
that they are good managers (often in stark contradiction to
observable evidence) are convinced that they are far better than they
actually are at making that determination.
WG> "Brilliant coders" aren't better in one environment than
WG> another. Rather they're commonly subjected to stupid
WG> organizations which preclude/inhibit their inherent
WG> effectiveness.
And sometimes it's not any individual coder that is brilliant, but the
interplay between several coders that work together. A coder in an
organization that suits him will do better than a coder in an
organization that does not suit him; the environment can substantially
enhance a coder's skills as well as substantially impairing them.
The point is, you *can't* be assured that a coder who was brilliant at
every prior job and who interviews well will continue to be a
brilliant coder in this environment. It's *not* well-understood what
makes people more or less productive -- though factors like stupid
organizations are significant, some people thrive even in stupid
organizations -- and the only way to know for sure is to put the
programmer into the situation and see.
And that difficulty -- to return to the original point of the thread
-- is why stricter languages than Perl are so popular. They
substantially reduce the risk of project failure due to technical
issues with the coding, and they reduce the business's dependence on
finding brilliant talent.
Charlton
--
cwilbur at chromatico dot net
cwilbur at mac dot com
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 7766
***************************************