[24704] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6861 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 12 18:06:17 2004

Date: Thu, 12 Aug 2004 15: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)

Perl-Users Digest           Thu, 12 Aug 2004     Volume: 10 Number: 6861

Today's topics:
        .pl -> .exe not so obvious ... <simecom.hvoisin@thales-bm.com>
    Re: .pl -> .exe not so obvious ... <ThomasKratz@REMOVEwebCAPS.de>
    Re: .pl -> .exe not so obvious ... <minter@lunenburg.org>
    Re: .pl -> .exe not so obvious ... <simecom.hvoisin@thales-bm.com>
    Re: .pl -> .exe not so obvious ... <simecom.hvoisin@thales-bm.com>
        data comprised of regexs (while loop weirdness) jason@cyberpine.com
    Re: data comprised of regexs (while loop weirdness) <noreply@gunnar.cc>
    Re: data comprised of regexs (while loop weirdness) <noreply@gunnar.cc>
    Re: data comprised of regexs (while loop weirdness) <gifford@umich.edu>
    Re: fdqn and hostname conflict <usenet@morrow.me.uk>
    Re: How to catch CTRL-C in Windows NT cmd.exe??? (Solo)
        Module to print out all package variables...? (alex)
    Re: Module to print out all package variables...? <dug@plusthree.com>
    Re: My own handy Pocket Reference notes (please share y (Randal L. Schwartz)
    Re: My own handy Pocket Reference notes (please share y <xx087@freenet.carleton.ca>
    Re: My own handy Pocket Reference notes (please share y <go@away.spam.invalid>
    Re: My own handy Pocket Reference notes (please share y <nobull@mail.com>
        Newbie question about NTLM and web sites (kipp b)
    Re: Newbie question about NTLM and web sites <jgibson@mail.arc.nasa.gov>
    Re: Newbie question about NTLM and web sites <1usa@llenroc.ude.invalid>
    Re: News::Scan question (Greg Bacon)
        Perl - Parse UNC Path in a string variable (Kevin Joseph)
    Re: Perl - Parse UNC Path in a string variable <1usa@llenroc.ude.invalid>
        preserving last modified <jeff@spamalanadingong.com>
    Re: preserving last modified (Greg Bacon)
    Re: Reading next line, finding missing number in sequen (Pea)
    Re: Reading next line, finding missing number in sequen (Anno Siegel)
    Re: Totally inappropriate subject lines <mr@sandman.net>
        What packages are installed? <admin@asarian-host.net>
    Re: What packages are installed? <dug@plusthree.com>
    Re: What packages are installed? <skweek@no.spam>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 12 Aug 2004 17:05:48 +0200
From: TBM <simecom.hvoisin@thales-bm.com>
Subject: .pl -> .exe not so obvious ...
Message-Id: <cfg10l$u3v$1@news-reader2.wanadoo.fr>

Hi,
I've been trying to compile my perl script into an executable for 
windows, but it doesn't work. I tried perlcc, PerlBin 0.02 and Tinyperl 
2.0b (not updated since 01-05-03), and none is working. Tinyperl can 
compile it, but when I launch myscript.exe, it hangs and/or takes 100% 
cpu. Of course, I've tested my script by "c:\perl myscript.pl" and it 
works ...
Is there any other _free_ programs to compile a pl script in an exe ? I 
can't use Perl2exe or PerlApp from ActiveState as they're not free :(

Thank you for any help or clue ;)


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

Date: Thu, 12 Aug 2004 17:18:01 +0200
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: .pl -> .exe not so obvious ...
Message-Id: <411b8a28$0$14510$bb690d87@news.main-rheiner.de>

TBM wrote:

> Hi,
> I've been trying to compile my perl script into an executable for 
> windows, but it doesn't work. I tried perlcc, PerlBin 0.02 and Tinyperl 
> 2.0b (not updated since 01-05-03), and none is working. Tinyperl can 
> compile it, but when I launch myscript.exe, it hangs and/or takes 100% 
> cpu. Of course, I've tested my script by "c:\perl myscript.pl" and it 
> works ...
> Is there any other _free_ programs to compile a pl script in an exe ? I 
> can't use Perl2exe or PerlApp from ActiveState as they're not free :(
> 
> Thank you for any help or clue ;)

http://par.perl.org

or get the PAR module from CPAN

Thomas

-- 
open STDIN,"<&DATA";$=+=14;$%=50;while($_=(seek( #J~.> a>n~>>e~.......>r.
STDIN,$:*$=+$,+$%,0),getc)){/\./&&last;/\w| /&&( #.u.t.^..oP..r.>h>a~.e..
print,$_=$~);/~/&&++$:;/\^/&&--$:;/>/&&++$,;/</  #.>s^~h<t< ..~. ...c.^..
&&--$,;$:%=4;$,%=23;$~=$_;++$i==1?++$,:_;}__END__#....>>e>r^..>l^...>k^..


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

Date: Thu, 12 Aug 2004 15:20:25 GMT
From: "H. Wade Minter" <minter@lunenburg.org>
Subject: Re: .pl -> .exe not so obvious ...
Message-Id: <ZULSc.252138$2o2.14734621@twister.southeast.rr.com>

TBM <simecom.hvoisin@thales-bm.com> wrote:
> Hi,
> I've been trying to compile my perl script into an executable for 
> windows, but it doesn't work. I tried perlcc, PerlBin 0.02 and Tinyperl 
> 2.0b (not updated since 01-05-03), and none is working. Tinyperl can 
> compile it, but when I launch myscript.exe, it hangs and/or takes 100% 
> cpu. Of course, I've tested my script by "c:\perl myscript.pl" and it 
> works ...
> Is there any other _free_ programs to compile a pl script in an exe ? I 
> can't use Perl2exe or PerlApp from ActiveState as they're not free :(

Use PAR (http://par.perl.org/) - it's very similar to Perl2EXE and PerlAPP,
but it's both free and Free.  Lots of other good things with PAR as well.

I'm using it to bundle a fairly complex Perl/Tk app, and it works great.

--Wade


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

Date: Thu, 12 Aug 2004 17:39:27 +0200
From: TBM <simecom.hvoisin@thales-bm.com>
Subject: Re: .pl -> .exe not so obvious ...
Message-Id: <cfg2vn$iiu$1@news-reader3.wanadoo.fr>

Thomas Kratz wrote:

> TBM wrote:
> 
>> Hi,
>> I've been trying to compile my perl script into an executable for 
>> windows, but it doesn't work. I tried perlcc, PerlBin 0.02 and 
>> Tinyperl 2.0b (not updated since 01-05-03), and none is working. 
>> Tinyperl can compile it, but when I launch myscript.exe, it hangs 
>> and/or takes 100% cpu. Of course, I've tested my script by "c:\perl 
>> myscript.pl" and it works ...
>> Is there any other _free_ programs to compile a pl script in an exe ? 
>> I can't use Perl2exe or PerlApp from ActiveState as they're not free :(
>>
>> Thank you for any help or clue ;)
> 
> 
> http://par.perl.org
> 
> or get the PAR module from CPAN
> 
> Thomas
> 

Thank you for this new clue ! :)


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

Date: Thu, 12 Aug 2004 17:40:12 +0200
From: TBM <simecom.hvoisin@thales-bm.com>
Subject: Re: .pl -> .exe not so obvious ...
Message-Id: <cfg314$iiu$2@news-reader3.wanadoo.fr>

Thomas Kratz wrote:

> TBM wrote:
> 
>> Hi,
>> I've been trying to compile my perl script into an executable for 
>> windows, but it doesn't work. I tried perlcc, PerlBin 0.02 and 
>> Tinyperl 2.0b (not updated since 01-05-03), and none is working. 
>> Tinyperl can compile it, but when I launch myscript.exe, it hangs 
>> and/or takes 100% cpu. Of course, I've tested my script by "c:\perl 
>> myscript.pl" and it works ...
>> Is there any other _free_ programs to compile a pl script in an exe ? 
>> I can't use Perl2exe or PerlApp from ActiveState as they're not free :(
>>
>> Thank you for any help or clue ;)
> 
> 
> http://par.perl.org
> 
> or get the PAR module from CPAN
> 
> Thomas
> 

Thank you for this new clue !  I'll try it ... :)


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

Date: 12 Aug 2004 13:22:54 -0700
From: jason@cyberpine.com
Subject: data comprised of regexs (while loop weirdness)
Message-Id: <ef0a04d7.0408121222.68c00def@posting.google.com>

Sure this is a newbie issue. And please pardon any reposting I might
have done.


My simple example doesn't work and there are few quirks I'm trying to
understand about perl.

for the below code, 

1. why do I only see a yes when passing the last data entry (test3) as
an argument?
2. Why do results vary depending on whether $_ is  on the left or
right of the if compare with $request?
3. why does only my last entry display if I uncomment the chomp

My real objective is to read a text file with a list of regular
expression in it that I can test against user input (that file may
have 200 expressons). If none of the expression find a match my user
input, then I would reject the input with a message. Any help or
information is appreciated.

<code snipet>

#!/usr/bin/perl -w
use strict;
my $request = shift @ARGV;
my @data = <DATA>;
for(@data) 
#chomp;
{
print $_;
if ($request =~ $_) {print 'yes';}
#if ($_ =~ $request) {print 'yes';}
#if ($request =~ /$_/) {print 'yes';} #what i really want to do is
test for regex match coming in from an a flat file.

}

__DATA__
test1
test2
test3

<end code snipet>


testing:

perl m3.pl test3
test1
test2
test3yes$ 

perl m3.pl test2
test1
test2
test3$


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

Date: Thu, 12 Aug 2004 22:55:10 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: data comprised of regexs (while loop weirdness)
Message-Id: <2o23u7F60ql4U1@uni-berlin.de>

jason@cyberpine.com wrote:
> And please pardon any reposting I might have done.

It's fine that you move the discussion from the defunct group 
comp.lang.perl, but it would have been suitable to state that fact.

> My simple example doesn't work and there are few quirks I'm trying 
> to understand about perl.
> 
> for the below code, 
> 
> 1. why do I only see a yes when passing the last data entry (test3) 
> as an argument?

Because your script file ends with "test3" without a trailing newline.

> 2. Why do results vary depending on whether $_ is  on the left or 
> right of the if compare with $request?

Because it searches the string to the left for the pattern to the 
right. Please read about the m// operator in "perldoc perlop".

> 3. why does only my last entry display if I uncomment the chomp

A correctly placed chomp makes the code print 'yes' for any of 
'temp1', 'temp2' or 'temp3'.

> my $request = shift @ARGV;
> my @data = <DATA>;
> for(@data)
> #chomp;
> {

     chomp;

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Thu, 12 Aug 2004 23:10:35 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: data comprised of regexs (while loop weirdness)
Message-Id: <2o24r6F66hmtU1@uni-berlin.de>

Gunnar Hjalmarsson wrote:
> jason@cyberpine.com wrote:
>> 3. why does only my last entry display if I uncomment the chomp
> 
> A correctly placed chomp makes the code print 'yes' for any of 
> 'temp1', 'temp2' or 'temp3'.
> 
>> my $request = shift @ARGV;
>> my @data = <DATA>;
>> for(@data)
>> #chomp;
>> {
> 
>     chomp;

Did you see Joe's and Jim's theories in comp.lang.perl? Can it 
possibly be a DOS to Unix confusion?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: 12 Aug 2004 16:36:34 -0400
From: Scott W Gifford <gifford@umich.edu>
Subject: Re: data comprised of regexs (while loop weirdness)
Message-Id: <qszy8kkw0tp.fsf@mspacman.gpcc.itd.umich.edu>

jason@cyberpine.com writes:

> Sure this is a newbie issue. And please pardon any reposting I might
> have done.

[...]

> 1. why do I only see a yes when passing the last data entry (test3) as
> an argument?

Not sure; as written, your code didn't work for me at all.

> 2. Why do results vary depending on whether $_ is  on the left or
> right of the if compare with $request?

If it's on the left, it's the string being tested; if it's on the
right, it's the pattern being tested against.

> 3. why does only my last entry display if I uncomment the chomp

I'm not sure why it works at all without the chomp.

With some slight changes it worked OK for me, though.  Actually I
pretty much uncommented the chomp and moved it inside the loop and it
worked:

    #!/usr/bin/perl -w
    
    use strict;
    
    my $request = shift @ARGV;
    
    my @data = <DATA>;
    for(@data)
    {
      chomp;
      print "'$request' ?~ /$_/: ";
      if ($request =~ /$_/) {print 'yes';}
      print "\n";
    }
    __DATA__
    test1
    test2
    test3

Produces:

    [gifford@gifford gifford]$ perl /tmp/t2 test
    'test' ?~ /test1/:
    'test' ?~ /test2/:
    'test' ?~ /test3/:
    [gifford@gifford gifford]$ perl /tmp/t2 test1
    'test1' ?~ /test1/: yes
    'test1' ?~ /test2/:
    'test1' ?~ /test3/:
    [gifford@gifford gifford]$ perl /tmp/t2 test2
    'test2' ?~ /test1/:
    'test2' ?~ /test2/: yes
    'test2' ?~ /test3/:
    [gifford@gifford gifford]$ perl /tmp/t2 test3
    'test3' ?~ /test1/:
    'test3' ?~ /test2/:
    'test3' ?~ /test3/: yes

I assume that the contents of the file you're reading from is under
your control, BTW; regular expressions can contain code, so if
somebody can write to that file they'll have the ability to cause your
script to execute code of their choice.

----ScottG.


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

Date: Wed, 11 Aug 2004 19:14:20 +0100
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: fdqn and hostname conflict
Message-Id: <s84qu1-696.ln1@mauzo.dyndns.org>


Quoth aj_rafferty@yahoo.com (Adrian Rafferty):
> Hi,
> 
> i'm trying a dummy perl script on solaris ....
> 
> # cat test
> 
> #!/bin/perl -w
> use Sys::Hostname;
> my $hostname = hostname();
> 
> print "Hostname = $hostname\n";
> #
> 
> How can i change the output of the  script to be "gdwtest"
> i.e. the first field of the fqdn ??
> 
> I have tried ...
> 
> root@gdwtest.au.thenational.com: #  hostname | perl -lne 'print
> ((gethostbyname $_)[0])'
> gdwtest
> root@gdwtest.au.thenational.com: #  
> 
> which returns the correct o/p , but i'm not sure how to integrate it
> with the
> original perl script.

Try 

print "Hostname = ", (gethostbyname hostname)[0];

if the other reply (simply extracting the first bit) isn't good enough. 

You may also be better off with Net::Domain, which will return the fqdn,
hostname and domainname separately.

Ben

-- 
"The Earth is degenerating these days. Bribery and corruption abound.
Children no longer mind their parents, every man wants to write a book,
and it is evident that the end of the world is fast approaching."
     -Assyrian stone tablet, c.2800 BC                         ben@morrow.me.uk


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

Date: 12 Aug 2004 08:13:09 -0700
From: solo11051970@yahoo.ca (Solo)
Subject: Re: How to catch CTRL-C in Windows NT cmd.exe???
Message-Id: <66999c27.0408120713.30d17753@posting.google.com>

Sisyphus <kalinaubears@iinet.net.au> wrote in message news:<411b063c$0$16324$5a62ac22@per-qv1-newsreader-01.iinet.net.au>...
> Solo wrote:
> > I wrote the following code just to test the catch of Ctrl-C:
> > ---------------
> > 
> > {
> > 
> >   $SIG{'INT'} = \&cmd1;
> > 
> > 
> >   print "Entering the loop \n\n";
> >   while (1)
> >   {
> >   }
>  
> > }
> > 
> > sub cmd1
> > {
> >   my ($sig) = @_;
> >   print "The Interrupt was caught: <$sig>\n";
> >   exit (0);
> > }
> > 
> > --------------------
> > It works perfectly on UNIX,  But in the windows NT cmd.exe or 4NT prompt, it
> > just kills the process and does not display the print message...
> > 
> > HELP!!!
> 
> It works fine for me in a cmd.exe shell on Windows 2000, and displays 
> the print message. Is that a copy'n'paste of the actual program that's 
> failing on NT ?
> 
> Cheers,
> Rob


Yes, it's an actual cut'n'paste.....


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

Date: 12 Aug 2004 09:29:06 -0700
From: alex522@mailinator.com (alex)
Subject: Module to print out all package variables...?
Message-Id: <90030f0e.0408120829.9aeedda@posting.google.com>

I'm looking for a module to dump out all (or as much
as possible :-) the package variables.
ie. something like:

 Data::Dumper->Dump([ \%:: ], ['\%::']) # Dump the main symbol table

 ...but which then recursively follows the package name globs's.

I couldn't find anything on CPAN, but then i may not
have been looking in the right place :-\

Thanks, and best regards!


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

Date: 12 Aug 2004 17:15:33 GMT
From: Douglas Hunter <dug@plusthree.com>
Subject: Re: Module to print out all package variables...?
Message-Id: <slrnchn962.1u5.dug@plusthree.com>

On 2004-08-12, alex <alex522@mailinator.com> wrote:
> I'm looking for a module to dump out all (or as much
> as possible :-) the package variables.
> ie. something like:
>
>  Data::Dumper->Dump([ \%:: ], ['\%::']) # Dump the main symbol table
>
> ...but which then recursively follows the package name globs's.
>
> I couldn't find anything on CPAN, but then i may not
> have been looking in the right place :-\

Does Devel::Symdump do what you want?

-- Douglas Hunter



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

Date: 12 Aug 2004 10:47:31 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: My own handy Pocket Reference notes (please share your own also)
Message-Id: <864qn89rkc.fsf@blue.stonehenge.com>

>>>>> "David" == David Filmer <IneverReadAnythingSentToMe@hotmail.com> writes:

David>    print map { $_->[0] }             #Randall Schwartz Rocks!!!

*Ahem*  See headers or sig of this posting.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: 12 Aug 2004 18:20:34 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: My own handy Pocket Reference notes (please share your own also)
Message-Id: <slrnchnd7j.ore.xx087@smeagol.ncf.ca>

At 2004-08-11 08:52PM, David Filmer <IneverReadAnythingSentToMe@hotmail.com> wrote:
>  To pass a only single hash to a subroutine (without using references):
>     &MySubroutine(%foo);   #call the sub and pass it a hash directly
>     sub MySubroutine () { my %bar = @_; }

You don't want the "()" prototype and the &, unless you have read
perlsub thoroughly:

    MySubroutine(%foo);
    sub MySubroutine { my %bar = @_; }

although references are required if you need to pass more than one
hash/array:
    myOtherSub(\%foo, \@bar, @baz);
    sub myOtherSub {
        my ($fooref, $barref, @baz) = @_;
        #...
    }

>  To pass a hash from a subroutine (using references):
>     %foo = %{&MySubroutine()};
>     sub MySubroutine () { my $bar{'candy'}='chocolate'; return \%bar; }

Similarly, without & and (prototype):
    %foo = %{MySubroutine()};
    sub MySubroutine { my $bar{'candy'}='chocolate'; return \%bar; }

or return the hash directly
    %foo = mysub()
    sub mysub { 
        #... create %bar
        return %bar; 
    }

-- 
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca


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

Date: Thu, 12 Aug 2004 18:25:15 GMT
From: LaDainian Tomlinson <go@away.spam.invalid>
Subject: Re: My own handy Pocket Reference notes (please share your own also)
Message-Id: <rfosu1-ruf.ln1@news.bclennox.com>

On 2004-08-12, 'John W. Krahn' <someone@example.com> wrote in
comp.lang.perl.misc:

<snip>

> What's wrong with one comma instead of two braces?  :-)  Anyway, you should
> use for instead of map in void context.

Or should you? :-)

http://tinyurl.com/6cmbl

Brandan L.
-- 
bclennox \at eos \dot ncsu \dot edu


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

Date: Thu, 12 Aug 2004 22:18:28 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: My own handy Pocket Reference notes (please share your own also)
Message-Id: <cfgmr4$lju$1@slavica.ukpost.com>


John W. Krahn wrote:
> David Filmer wrote:
>> To strip leading/trailing spaces:
>>    $foo =~ s/^\s+//;    $foo =~ s/\s+$//;
> 
> 
> Or a bit more idiomatic:
> 
> s/^\s+//, s/\s+$// for $foo;
> 
>> To replace $foo with $bar across an array:
>>    map {s/$foo/$bar/} @list;    #no comma!
> 
> What's wrong with one comma instead of two braces?

Er, braces are more ideomatic.  A block should look like a block.

> Anyway, you should use for instead of map in void context.

Yes indeed.



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

Date: 12 Aug 2004 08:16:33 -0700
From: kipp_groups@yahoo.com (kipp b)
Subject: Newbie question about NTLM and web sites
Message-Id: <e9c899a8.0408120716.b8a99b4@posting.google.com>

Sorry about the simplicity of this question:

I noticed within a lot of web sites there is an NTLM authentication
when a user does a simple HTTP GET.

Example:

http://www.amazon.com/exec/obidos/subst/home/home.html

GET http://www.amazon.com/exec/obidos/subst/home/home.html HTTP/1.1
Host: www.amazon.com:80
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7)
Gecko/20040803 Firefox/0.9.3
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Cookie: session-id=104-4473924-0563158; ubid-main=430-7321142-9950765;
session-id-time=1092816000
Proxy-Authorization: NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA=



Question .... why does a user who has no login account need to
authenticate?  What is the thought process behind this?

Thanks in advance


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

Date: Thu, 12 Aug 2004 09:00:07 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Newbie question about NTLM and web sites
Message-Id: <120820040900078137%jgibson@mail.arc.nasa.gov>

In article <e9c899a8.0408120716.b8a99b4@posting.google.com>, kipp b
<kipp_groups@yahoo.com> wrote:

> Sorry about the simplicity of this question:
> 
> I noticed within a lot of web sites there is an NTLM authentication
> when a user does a simple HTTP GET.
> 
> Example:
> 
> http://www.amazon.com/exec/obidos/subst/home/home.html
> 
> GET http://www.amazon.com/exec/obidos/subst/home/home.html HTTP/1.1
> Host: www.amazon.com:80
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7)
> Gecko/20040803 Firefox/0.9.3
> Accept:
> text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.
> 8,image/png,*/*;q=0.5
> Accept-Language: en-us,en;q=0.5
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Proxy-Connection: keep-alive
> Cookie: session-id=104-4473924-0563158; ubid-main=430-7321142-9950765;
> session-id-time=1092816000
> Proxy-Authorization: NTLM TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA=
> 
> 
> 
> Question .... why does a user who has no login account need to
> authenticate?  What is the thought process behind this?

This question, having nothing to do with perl, might better be posted
on a newsgroup having to do with HTTP, such as
comp.infosystems.www.authoring.


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

Date: 12 Aug 2004 16:04:07 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Newbie question about NTLM and web sites
Message-Id: <Xns95437AC4BE32asu1cornelledu@132.236.56.8>

kipp_groups@yahoo.com (kipp b) wrote in
news:e9c899a8.0408120716.b8a99b4@posting.google.com: 

> Question .... why does a user who has no login account need to
> authenticate?  What is the thought process behind this?

This is not a Perl question. You might want to search for a group that 
deals with the particular platform you are interested in.

-- 
A. Sinan Unur
1usa@llenroc.ude.invalid 
(remove '.invalid' and reverse each component for email address)



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

Date: Thu, 12 Aug 2004 17:19:37 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: News::Scan question
Message-Id: <10hn9l9e179vlf4@corp.supernews.com>

In article <mr-086588.17030512082004@individual.net>,
    Sandman  <mr@sandman.net> wrote:

: Thanks for your example, you set me on the right path.

The while loop needs a

    continue {
        close ARGV if eof;
    }

block appended to the while loop to get the chunk numbers right.

Glad it helped.

Greg
-- 
Indeed I tremble for my country when I reflect that God is just, that His
justice cannot sleep forever . . .
    -- Thomas Jefferson


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

Date: 12 Aug 2004 08:43:59 -0700
From: kejoseph@hotmail.com (Kevin Joseph)
Subject: Perl - Parse UNC Path in a string variable
Message-Id: <54c48ac0.0408120743.4930c9b7@posting.google.com>

I have written a Perl script to modify some files over the network.
All PCs are Win2k. Most of the files reside on a share in the form of
\\server\share_name. Some of the files are on dirves in the form of
\\server\d$ and this is where my problem is.

My script prompts the user for the file name. It store the information
in a variable, parses it and then accesses it. If the file name
entered is \\server\share_name\filename, I do not have a problem. With
\\server\d$\filename however it simply fails. I have the logic to
convert \ to \\ which is why the former works
(\\server\share_name\filename). I tried escaping the $ (using \$) but
that did not work. I have tried various permutations and combinations
thus far and as a last option am sending my request to this newsgroup.

Kindly help.

Kevin.


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

Date: 12 Aug 2004 16:02:18 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Perl - Parse UNC Path in a string variable
Message-Id: <Xns95437A761361Basu1cornelledu@132.236.56.8>

kejoseph@hotmail.com (Kevin Joseph) wrote in 
news:54c48ac0.0408120743.4930c9b7@posting.google.com:

> I have written a Perl script to modify some files over the network.
> All PCs are Win2k. Most of the files reside on a share in the form of
> \\server\share_name. Some of the files are on dirves in the form of
> \\server\d$ and this is where my problem is.
> 
> My script prompts the user for the file name. It store the information
> in a variable, parses it and then accesses it. If the file name
> entered is \\server\share_name\filename, I do not have a problem. With
> \\server\d$\filename however it simply fails. I have the logic to
> convert \ to \\ which is why the former works
> (\\server\share_name\filename). I tried escaping the $ (using \$) but
> that did not work. I have tried various permutations and combinations
> thus far and as a last option am sending my request to this newsgroup.
> 
> Kindly help.

Kindly provide some useful information then. You indicate that you 
'parse' the variable, that you have the 'logic' to convert \ to \\ etc 
but never show code. We are not mind readers here. Please read

http://www.catb.org/~esr/faqs/smart-questions.html

to learn how to formulate your question so others can understand and help 
you. Smart questions get answers. 'Does not work' doesn't. 

-- 
A. Sinan Unur
1usa@llenroc.ude.invalid 
(remove '.invalid' and reverse each component for email address)



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

Date: Thu, 12 Aug 2004 16:50:47 GMT
From: Jeff Thies <jeff@spamalanadingong.com>
Subject: preserving last modified
Message-Id: <HdNSc.14132$nx2.7671@newsread2.news.atl.earthlink.net>

I'm writing to files and would like to preserve the "last modified" stamp.

   I'm unsure of how to do this. I'll be using both win32 and *nix.

   I've looked at File::Copy (which I've grown to like a lot).

It looks to me that this want I want, but I'm unsure:

use File::Copy;
syscopy('data to copy as text','path_to_file');

It looks like I can do this also:

rmscopy('data to copy as text','path_to_file',-1);

But that doesn't appear to be supported in *nix.

   Jeff


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

Date: Thu, 12 Aug 2004 17:40:30 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: preserving last modified
Message-Id: <10hnasel7od9j46@corp.supernews.com>

In article <HdNSc.14132$nx2.7671@newsread2.news.atl.earthlink.net>,
    Jeff Thies  <jeff@spamalanadingong.com> wrote:

: I'm writing to files and would like to preserve the "last modified"
: stamp.
: [...]

Use the utime operator:

    #! /usr/local/bin/perl

    sub show_times {
        my $path = shift;

        my($atime,$mtime) = (stat $path)[8,9];
        die "$0: stat: $!" unless defined $atime;

        print "  $path:\n",
              "    - atime = ", (scalar localtime $atime), "\n",
              "    - mtime = ", (scalar localtime $mtime), "\n";

        ($atime, $mtime);
    }

    my($p1,$p2) = qw/ foo bar /;
    unlink $p1, $p2;

    print "Before:\n";

    system("touch $p1") == 0 or die "$0: touch exited " . ($ >> 8);
    my($p1a,$p1m) = show_times $p1;

    sleep 2;

    system("touch $p2") == 0 or die "$0: touch exited " . ($ >> 8);
    show_times $p2;

    print "After:\n";

    # keep same atime
    my $p2a = (stat $p2)[8];
    die "$0: stat: $!" unless defined $p2a;

    # make $p2 have $p1's mtime
    utime $p2a, $p1m, $p2 or warn "$0: utime: $!";
    show_times $p1;
    show_times $p2;

Hope this helps,
Greg
-- 
Liberty means responsibility.  That is why most men dread it.
    -- George Bernard Shaw


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

Date: 12 Aug 2004 11:20:49 -0700
From: taralish@yahoo.com (Pea)
Subject: Re: Reading next line, finding missing number in sequence
Message-Id: <f4bfa101.0408121020.6ca10419@posting.google.com>

That one works perfectly.  
Thank you!

"Andrew Palmer" <andrewpalmer@email.com> wrote in message news:<qntSc.4462$5s3.37@fe40.usenetserver.com>...
> Here's an idea
> 
> my $expected = 1;
> while(<DATA>) {
>   for(;$expected < $_;++$expected) {
>    print "Missing $expected\n";
>   }
>  $expected=$_+1;
> }
> 
> Some of the other solutions posted here, handle this scenario as well,
> though.
>


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

Date: 12 Aug 2004 20:53:41 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Reading next line, finding missing number in sequence
Message-Id: <cfglcl$t8t$1@mamenchi.zrz.TU-Berlin.DE>

bowsayge  <bowsayge@nomail.afraid.org> wrote in comp.lang.perl.misc:
> Pea said to us:
> 
> > Thank you, Brian.  I used your suggestion and modification and it
> > worked well, except when there were two numbers in a row missing.  
> [...]
> 
> As a learning experience, Bowsayge created a program that seems
> to be able to list the missing numbers from a range:
> 
> #!/usr/bin/perl
> use strict;
> use warnings;
> 
> chomp (my @numbers = <DATA>);
> s/\D+//g for (@numbers);

Ignoring non-digits is an extra feature.  It may be useful, but maybe not.
There is no good reason to bring it in here.

> @numbers = sort { $a <=> $b } @numbers;

You are sorting the numbers only to get their minimum and maximum (the
rest of the algorithm doesn't need them sorted).  In general, that is
wasteful, especially when the lists are long.  The standard module
List::Util has functions that find the minimum and maximum in linear
time.  For this example you could dodge the issue and simply assume
the numbers come sorted.

> my ($min, $max) = ($numbers[0], $numbers[$#numbers]);

$numbers[$#numbers] can be written as $numbers[-1].

> my %hash = map +($_, 1), @numbers;
> my @missing = grep !defined($hash{$_}), ($min..$max);

You have taken care to set the hash values to 1, so defined() is not
necessary.

> printf "%-20s %s\n", 'numbers', 'missing';
> printf "%-20s %s\n", "@numbers", "@missing";

[snip data]

Your code shows a very plausible use of a hash.  In general, a hash
is the structure of choice when the problem can be expressed in terms
of sets.  The set elements get to be the hash keys (or the keys a hash
gets probed for).  The values are of little importance in this application
of hashes.  Your code is a good example.

The sets in this case are the integers in a range, and some (explicitly
given) subset thereof.  The problem is to find the set difference.
With sets of integers it can be of advantage to use arrays for the
representation instead of hashes, especially if the integers are small.
Arrays use substantially less storage and are a little faster than
hashes.  You may find it instructive to re-write your code to use
an array.  You will have to change very little, except for the "map"
line.

Going a step farther in storage conservation, a bit vector could be
used.  It is the most compact way to store a set of small integers.
With @numbers, $min and $max being set:

    my $set = '';
    vec( $set, $_, 1) = 1 for @numbers;
    my @missing = grep !vec( $set, $_, 1), $min .. $max;

Again, there isn't much change from your code to this variant.

Anno


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

Date: Thu, 12 Aug 2004 17:14:09 +0200
From: Sandman <mr@sandman.net>
Subject: Re: Totally inappropriate subject lines
Message-Id: <mr-A7EF3B.17140912082004@individual.net>

In article <JMsSc.131329$eM2.126204@attbi_s51>,
 Joe Smith <Joe.Smith@inwap.com> wrote:

> Sandman wrote:
> 
> > In article <slrnchhgrh.3tt.tadmc@magna.augustmail.com>, Tad McClellan
> >>Then the Subject header should say something about News::Scan.
> > 
> > My original post, the one I wanted Greg to view, did exactly that.
> 
> You should always change the subject line in a reply when changing topics.
> 
> >>Please help us keep threads threaded, don't put things unrelated to
> >>the Subject into the thread.
> > 
> > I replied to a post, I didn't create the thread. My reply was directed to a 
> > specific poster.
> 
> You should always change the subject line in a reply when changing topics.
> 
> 	-Joe

*plonk*

-- 
Sandman[.net]


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

Date: Thu, 12 Aug 2004 19:50:18 +0200
From: "Mark" <admin@asarian-host.net>
Subject: What packages are installed?
Message-Id: <G--dnWHpYLDIM4bcRVn-sw@giganews.com>

Hello,

I like to upgrade to Perl 5.8.5 (FreeBSD 4.10-p2); I was wondering, though,
is there a quick way to determine what packages have been installed under
the old Perl hierarchy? (5.8.2).

Thanks,

- Mark




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

Date: 12 Aug 2004 18:43:31 GMT
From: Douglas Hunter <dug@plusthree.com>
Subject: Re: What packages are installed?
Message-Id: <slrnchneb0.26b.dug@plusthree.com>

On 2004-08-12, Mark <admin@asarian-host.net> wrote:
> Hello,
>
> I like to upgrade to Perl 5.8.5 (FreeBSD 4.10-p2); I was wondering, though,
> is there a quick way to determine what packages have been installed under
> the old Perl hierarchy? (5.8.2).

One of the entries here might help:
http://www.cpan.org/misc/cpan-faq.html#How_installed_modules

>
> Thanks,
>
> - Mark

-- Douglas Hunter


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

Date: Thu, 12 Aug 2004 21:49:45 +0200
From: AlV <skweek@no.spam>
Subject: Re: What packages are installed?
Message-Id: <411bc9da$0$26987$626a14ce@news.free.fr>

Mark wrote:
> Hello,
> 
> I like to upgrade to Perl 5.8.5 (FreeBSD 4.10-p2); I was wondering, though,
> is there a quick way to determine what packages have been installed under
> the old Perl hierarchy? (5.8.2).

Something like this might help you...
(I am *not* the author of this program)


: # -*-perl-*-
eval 'exec perl -w -S $0 ${1+"$@"}'
   if 0;

use warnings;
use strict;
use ExtUtils::Installed;

# Find all the installed modules
print("Finding all installed Perl modules...\n");

my $installed = ExtUtils::Installed->new();
my $max_length = 0;

# Let's find the longest name
foreach my $module (grep(!/^Perl$/, $installed->modules()))
{
     (length ($module) > $max_length) and $max_length = length ($module);
}

# A nice way to print the results
my $format = "    %-".$max_length."s  Version %s\n";

# We display all the modules along with their version
foreach my $module (grep(!/^Perl$/, $installed->modules()))
{
     my $version = $installed->version($module) || "???";
     printf($format, $module, $version);
}


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

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


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