[30089] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1332 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 4 16:14:39 2008

Date: Tue, 4 Mar 2008 13:09:07 -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           Tue, 4 Mar 2008     Volume: 11 Number: 1332

Today's topics:
    Re: evaluating shared rescources on remote system. <ben@morrow.me.uk>
    Re: evaluating shared rescources on remote system. <ramakrishnadeepak@gmail.com>
    Re: FAQ 4.53 How do I manipulate arrays of bits? <uri@stemsystems.com>
    Re: help with LWP and log in after redirect <ben@morrow.me.uk>
    Re: inquiry for bioperl <smallpond@juno.com>
    Re: inquiry for bioperl <uri@stemsystems.com>
    Re: inquiry for bioperl xhoster@gmail.com
    Re: Rename File Using Strring Found in File? <ben@morrow.me.uk>
    Re: Rename File Using Strring Found in File? <Entwadumayla@HyenaKiller.com>
    Re: Rename File Using Strring Found in File? <Entwadumayla@HyenaKiller.com>
    Re: Rename File Using Strring Found in File? <Entwadumayla@HyenaKiller.com>
    Re: sorting index-15, index-9, index-110 "the human way <tch@nospam.syneticon.net>
        SSPI perl module vincent.ho@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 4 Mar 2008 16:19:30 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: evaluating shared rescources on remote system.
Message-Id: <id90a5-pj5.ln1@osiris.mauzo.dyndns.org>


Quoth deepak <ramakrishnadeepak@gmail.com>:
> thanks Ben it worked for me, similarly is there any module for
> accessing remote registry and remote desktop.

http://search.cpan.org/search?query=win32+registry

I don't know what you mean by 'remote desktop'. If you mean a module
that talks Microsoft's RDP protocol, then I somewhat doubt it.

Ben



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

Date: Tue, 4 Mar 2008 10:05:52 -0800 (PST)
From: deepak <ramakrishnadeepak@gmail.com>
Subject: Re: evaluating shared rescources on remote system.
Message-Id: <0f38f016-0387-473f-b0f5-b02dd7093e97@d4g2000prg.googlegroups.com>

Thanx Ben.What i mean about 'remote desktop' is whether there is any
perl module that can connect to the remote desktop server, like we
connect to a sshd server using Net::SSH and execute a simple linux
command.


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

Date: Tue, 04 Mar 2008 18:14:18 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: FAQ 4.53 How do I manipulate arrays of bits?
Message-Id: <x763w2jr0l.fsf@mail.sysarch.com>

>>>>> "s" == sheinrich  <sheinrich@my-deja.com> writes:

  s> On Mar 3, 10:12 pm, Uri Guttman <u...@stemsystems.com> wrote:
  >> >>>>> "bdf" == brian d foy <brian.d....@gmail.com> writes:
  >> 
  bdf> In article
  bdf> <ca334bbf-a028-4179-bcac-6fe5105b1...@13g2000hsb.googlegroups.com>,
  bdf> <sheinr...@my-deja.com> wrote:
  >> 
  >> >> On Feb 29, 9:03 pm, PerlFAQ Server <br...@stonehenge.com> wrote:
  >> >> <snip>
  >> >> >     For example, this sets $vec to have bit N set if $ints[N] was set:
  >> >> >
  >> >> >             $vec = '';
  >> >> >             foreach(@ints) { vec($vec,$_,1) = 1 }
  >> >>
  >> and the code is wrong too.

  s> That depends on how you see it.

huh? the code doesn't do what the comment says. and even if the comment
were fixes, the example has bit offsets of only 1 and 0 so it will never
touch any bits other than 1 (the second bit). it would be hard to find a
use for that logic.

  s> The use of vec() as a replacement for pack() on a ready list of bits
  s> has never occurred to me.

  s> Hence my 2nd example above with some distinct bit indices specified:
  s> my @ints = (5,0,2,4);

but the CODE didn't have any indices other than 1 and 0. so it was
useless as an example and it didn't even agree with the text. the whole
thing is wrong.

  s> ACK
  s> Beside the ubiquitous example for the use of vec() with select() I
  s> only ever found an application in creating symbol distribution
  s> patterns for sudoku solvers.

and even using it for select is not a good example since IO::Select is
so much easier to use. only people like me who know select very well
(over 20 years of coding with it in c and perl) use it directly.

  s> And Bit::Vector would most certainly have proven more adequate for the
  s> task.

that should be mentioned in the FAQ for sure. vec() is a very wimpy
function in general. its word size is fixed to a power of two which is
very bizarre. pack/unpack do much more useful things for single bits and
4 bit (nibble) lengths. bit::vector does all the really useful things
you want and faster (and with any word size). vec() in general should be
deprecated IMO. i never teach it in my classes and would recommend other
solutions if asked about it.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Architecture, Development, Training, Support, Code Review  ------
-----------  Search or Offer Perl Jobs  ----- http://jobs.perl.org  ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Tue, 4 Mar 2008 16:05:21 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: help with LWP and log in after redirect
Message-Id: <1j80a5-pj5.ln1@osiris.mauzo.dyndns.org>


Quoth eatmoreoats <eatmoreoats@gmail.com>:
> I'm trying to automate the log in to a website, which I've done before
> successfully with lwp. However in this case I'm having problems and
> need some help.  After posting the username/password, a redirect
> occurs to a new url where the username and password have been encoded.
> With post redirects enabled, I end up back at the log in page, rather
> than following the redirect.
> 
> Here are the request and response headers, as observed with Firefox
> plugins (HTTP LIve Headers, and Tamper Data). These are observed
> during a successful login with my firefox browser.
> 
> REQUEST HEADER
> 
<snip>
> Referer=http://www.mywebsite.com/newmywebsite/logon.aspx
<snip>
> 
> RESPONSE HEADER
> 
> Status=Moved Temporarily - 302
<snip>
> Location=http://www.mywebsite.com/newmywebsite/somenewurl/
> somenewscript.wotever?
> cmd=login&username=YWR2YW5jZWludGVybmV0&password=c2FuaXR5
<snip>
> 
> Notice the Location in the response - if I take that url and do a get
> request on it, I'm logged in. However, I can't seem to get the code to
> follow the redirect down this url path. If I disable redirects, and
> grab the Location header value, it is Location=http://
> www.mywebsite.com/newmywebsite/somenewurl/somenewscript.wotever?
> cmd=login&username=null.

So whatever LWP is sending, the server doesn't like it and doesn't
accept it as a valid logon.

> I'd like the script to just follow the redirect to the new location
> but its not clear why thats not working. Any ideas how to make this
> work ?
> 
> Here is the code example :
> 
> use HTTP::Cookies;
> use LWP::UserAgent;
> 
> $ua = LWP::UserAgent->new;
> $cookies = new HTTP::Cookies();
> $ua->cookie_jar($cookies);
> $ua->timeout(300);
> $ua->requests_redirectable   (['GET', 'HEAD', 'POST']);

You shouldn't need this. requests_redirectable refers to the method used
to follow the redirect, not the method the redirect is a reply to; and
LWP treats 302 as 'GET this URL' rather than 'repeat the previous
request with a different URL', in line with the behaviour of most (all?)
actual browsers (this is strictly against the letter of the standard,
but RFC2616 recognises that this is the actual implemented behaviour).

> # step 1 - hit the login page first
> $response = $ua->get('http://www.mywebsite.com/newmywebsite/
> logon.aspx');
> 
> # step 2 - post in the username/password
> $response = $ua->post('http://www.mywebsite.com/newmywebsite/
> logonvalidate.aspx',
>                          [
>                             username=>"theusername",
>                             password=>"thepassword",
>                          ]
>                       );

This will not set the Referer header. I would recommend using
WWW::Mechanize instead, which tries as hard as possible to emulate an
actual browser.

Ben



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

Date: Tue, 4 Mar 2008 09:17:42 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: inquiry for bioperl
Message-Id: <30878c2e-1dbd-4bb0-aa37-88455217c1d0@s8g2000prg.googlegroups.com>

On Mar 4, 9:35 am, "Rose" <r...@russ.org> wrote:
> Dear all,
>
> Since I'm unable to identify a newsgroup at bioperl, i post a message here.
> Please tell me if I should post this somewhere else. Are bioperl modules
> capable of handling genomes (characters of larger than 4M or even giga)?


bioperl looks like a very interesting project.  perl certainly can
deal with
large data files.  If the bioperl modules are like CPAN modules, it is
probably
best to check the documentation for each module that you want to use
on what
it's limits are. This article:

http://www.bioperl.org/wiki/How_Perl_saved_human_genome

seems to imply that bioperl is used on 3G sequences.  The article is
pretty good
except for the wrong-headed decision not to use pTk.
--S


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

Date: Tue, 04 Mar 2008 18:21:03 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: inquiry for bioperl
Message-Id: <x71w6qjqpb.fsf@mail.sysarch.com>

>>>>> "R" == Rose  <rose@russ.org> writes:

  R> Since I'm unable to identify a newsgroup at bioperl, i post a
  R> message here.  Please tell me if I should post this somewhere
  R> else. Are bioperl modules capable of handling genomes (characters
  R> of larger than 4M or even giga)?

i doubt you will find many bioperl users in this newsgroup. i can't
recall ever seeing it discussed here as it is a very specialized package.

bioperl has its own mailing list. you can subscribe to it from this page:

	http://lists.cpan.org/showlist.cgi?name=bioperl-l

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Architecture, Development, Training, Support, Code Review  ------
-----------  Search or Offer Perl Jobs  ----- http://jobs.perl.org  ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: 04 Mar 2008 20:44:18 GMT
From: xhoster@gmail.com
Subject: Re: inquiry for bioperl
Message-Id: <20080304154420.455$3P@newsreader.com>

"Rose" <rose@russ.org> wrote:
> Dear all,
>
> Since I'm unable to identify a newsgroup at bioperl, i post a message
> here. Please tell me if I should post this somewhere else. Are bioperl
> modules capable of handling genomes (characters of larger than 4M or even
> giga)?

BioPerl covers a lot of different functionalities.  I think that at least
some of them will *not* be able to handle gigabases, while others will be
able to (provided your hardware is up to it--what do you have?).

There hasn't been much BioPerl traffic here in the past.  That community
seems to prefer mailing lists and wikis over usenet, see
http://www.bioperl.org/wiki/Main_Page



Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

Date: Tue, 4 Mar 2008 16:15:20 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Rename File Using Strring Found in File?
Message-Id: <o590a5-pj5.ln1@osiris.mauzo.dyndns.org>


Quoth He Who Greets With Fire <Entwadumayla@HyenaKiller.com>:
> 
> OK, thanks, but the script does not seem to rename the files. 
> I added some troubleshooting code, most of which I commented out. I
> also moved a copy of the personalinjury folder and all its files
> inside the C:\Perl directory so it can access it directly.

Don't do that. You can set the working directory from within your Perl
script using the chdir function. In any case, the working directory may
not be what you expect under Win32.

> See below for my additional comments.
>   
> #!/bin/perl

Perl is *never* installed as /bin/perl.

> #sleep 2;
> print "here I am! \n";

Diagnostics like this are better given with warn, which will .a. print
them to STDERR, where they ought to be and .b. tell you where you are in
the script.

> #sleep 2;
> my $counter =1;
> 
> foreach my $file ( glob 'personalinjury/*.htm' ) { 
> 
> # print "here I am A \n";
> # sleep 1;
> 
>  open my $PI, '<', $file or die "could not open '$file' $!";
> 
> # print "here I am! B \n";
> # sleep 1;
> 
>  print $counter;
>  print "\n";
>  while ( <$PI> ) {
>  #   print "\n inside whileloop";
> 
> I AM getting to this point here.
> 
>   next unless /Citation: [\d-]+.*([\d.]+)/;
> 
> but I never get to this point here--apparently the regex never sees a
> match for the "Citation:" etc string.
> 
> Here is a screen shot of the typical file, with a red arrow pointing
> to the string in this particular file that I want to match. 
> I do not know why the regex does not see a match, because it looks
> like it matches it???
> 
> See here:
> http://img225.imageshack.us/img225/91/citationue2.jpg

*DON'T* do that. Had you done the right thing, and copy-pasted a small
section of the relevant file into your message, you would have found
that the file doesn't in fact contain the string 'Citation: whatever' at
all. It's an HTML file, so there is markup in there as well, and the
string may well be spread across several lines. Get into the habit of
looking at files in a text editor before you try parsing them with Perl.

>     my $newfile = $1;
>     rename $file, "$newfile.htm" or die "could not mv '$file' $!";
>     print "\n renamed a file";
>     sleep 1;
>     last;
>    }#end while

If you had used proper indentation, you would be able to see that
comments like this are completely useless.

Ben



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

Date: Tue, 04 Mar 2008 11:13:44 -0600
From: He Who Greets With Fire <Entwadumayla@HyenaKiller.com>
Subject: Re: Rename File Using Strring Found in File?
Message-Id: <u8vqs39oe7en9l5oqh4nfqf470pgnept81@4ax.com>

On Tue, 4 Mar 2008 16:15:20 +0000, Ben Morrow <ben@morrow.me.uk>
wrote:

>
>Quoth He Who Greets With Fire <Entwadumayla@HyenaKiller.com>:
>> 
>> OK, thanks, but the script does not seem to rename the files. 
>> I added some troubleshooting code, most of which I commented out. I
>> also moved a copy of the personalinjury folder and all its files
>> inside the C:\Perl directory so it can access it directly.
>
>Don't do that. You can set the working directory from within your Perl
>script using the chdir function. In any case, the working directory may
>not be what you expect under Win32.
>

the directory/folder location is not a problem. Like I said, the
script is indeed able to access the files in the folder and open them
and increment through them. So, everything seems to be OK on that
front.



>> See below for my additional comments.
>>   
>> #!/bin/perl
>
>Perl is *never* installed as /bin/perl.

but it already works in that regard--the script executes



>
>> #sleep 2;
>> print "here I am! \n";
>
>Diagnostics like this are better given with warn, which will .a. print
>them to STDERR, where they ought to be and .b. tell you where you are in
>the script.

Well, I'm not actually a programmer, just someone trying to do some
organization of my files. So, that issue is not a concern right now.



>
>> #sleep 2;
>> my $counter =1;
>> 
>> foreach my $file ( glob 'personalinjury/*.htm' ) { 
>> 
>> # print "here I am A \n";
>> # sleep 1;
>> 
>>  open my $PI, '<', $file or die "could not open '$file' $!";
>> 
>> # print "here I am! B \n";
>> # sleep 1;
>> 
>>  print $counter;
>>  print "\n";
>>  while ( <$PI> ) {
>>  #   print "\n inside whileloop";
>> 
>> I AM getting to this point here.
>> 
>>   next unless /Citation: [\d-]+.*([\d.]+)/;
>> 
>> but I never get to this point here--apparently the regex never sees a
>> match for the "Citation:" etc string.
>> 
>> Here is a screen shot of the typical file, with a red arrow pointing
>> to the string in this particular file that I want to match. 
>> I do not know why the regex does not see a match, because it looks
>> like it matches it???
>> 
>> See here:
>> http://img225.imageshack.us/img225/91/citationue2.jpg
>
>*DON'T* do that. 

Don't do what?

>Had you done the right thing, and copy-pasted a small
>section of the relevant file into your message, you would have found
>that the file doesn't in fact contain the string 'Citation: whatever' at
>all. It's an HTML file, so there is markup in there as well, and the
>string may well be spread across several lines. Get into the habit of
>looking at files in a text editor before you try parsing them with Perl.

That is a good point. When I wrote my financial news project that
parsed news stories for negative and positive words, I passed over all
words that were surrounded by html brackets.
Here are two excerpts from the source html for a typical file in that
folder:


here is the html source snippet that the script is looking for:
<td class="toolbar" align=right valign=top width="1%"
nowrap>Citation:&nbsp;&nbsp;</td>
<td class="toolbar" valign=top width="99%"><b>21-340 Dorsaneo, Texas
Litigation Guide § 340.02</b></td>


Yes, you are correct: the HTML code is throwing off the script.

Here is another snippet that looks much more promising. The TITLE of
the html page. This is not the instance of "citation....etc" that I
was looking for, but now that I see it, it looks like a good candidate
for use as a filename:

<title>Get a Document - by Citation - 21-340 Dorsaneo, Texas
Litigation Guide § 340.02</title>

Are the angle brackets special characters in perl so that they have to
be backslashed inside the regex?

I wonder if this regex would work?
next unless /\<title\>Get a Document - by Citation -
[\d-]+.*([\d.]+)\<\/title\>/;







>
>>     my $newfile = $1;
>>     rename $file, "$newfile.htm" or die "could not mv '$file' $!";
>>     print "\n renamed a file";
>>     sleep 1;
>>     last;
>>    }#end while
>
>If you had used proper indentation, you would be able to see that
>comments like this are completely useless.

Not sure what you mean?
>
>Ben



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

Date: Tue, 04 Mar 2008 11:19:15 -0600
From: He Who Greets With Fire <Entwadumayla@HyenaKiller.com>
Subject: Re: Rename File Using Strring Found in File?
Message-Id: <n01rs3pakhv66m57524nlnd1fi1b3aej2q@4ax.com>

On Tue, 04 Mar 2008 11:13:44 -0600, He Who Greets With Fire
<Entwadumayla@HyenaKiller.com> wrote:

>Here is another snippet that looks much more promising. The TITLE of
>the html page. This is not the instance of "citation....etc" that I
>was looking for, but now that I see it, it looks like a good candidate
>for use as a filename:
>
><title>Get a Document - by Citation - 21-340 Dorsaneo, Texas
>Litigation Guide § 340.02</title>
>
>Are the angle brackets special characters in perl so that they have to
>be backslashed inside the regex?
>
>I wonder if this regex would work?
>next unless /\<title\>Get a Document - by Citation -
>[\d-]+.*([\d.]+)\<\/title\>/;



well, I modified it by adding backslashes in front of the dashes like
so:
next unless /\<title\>Get a Document \- by Citation \-
[\d-]+.*([\d.]+)\<\/title\>/;

But it still does not work. Again, it does seem to cycle through all
the files, but nothing matches.





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

Date: Tue, 04 Mar 2008 20:20:05 GMT
From: He Who Greets With Fire <Entwadumayla@HyenaKiller.com>
Subject: Re: Rename File Using Strring Found in File?
Message-Id: <8gbrs3dtl59ucseg7sj2q5gfgt7m1lerhj@4ax.com>

On Tue, 04 Mar 2008 11:13:44 -0600, He Who Greets With Fire
<Entwadumayla@HyenaKiller.com> wrote:

>On Tue, 4 Mar 2008 16:15:20 +0000, Ben Morrow <ben@morrow.me.uk>
>wrote:
>
>>
>>Quoth He Who Greets With Fire <Entwadumayla@HyenaKiller.com>:
>>> 
>>> OK, thanks, but the script does not seem to rename the files. 
>>> I added some troubleshooting code, most of which I commented out. I
>>> also moved a copy of the personalinjury folder and all its files
>>> inside the C:\Perl directory so it can access it directly.
>>
>>Don't do that. You can set the working directory from within your Perl
>>script using the chdir function. In any case, the working directory may
>>not be what you expect under Win32.
>>
>
>the directory/folder location is not a problem. Like I said, the
>script is indeed able to access the files in the folder and open them
>and increment through them. So, everything seems to be OK on that
>front.
>
>
>
>>> See below for my additional comments.
>>>   
>>> #!/bin/perl
>>
>>Perl is *never* installed as /bin/perl.
>
>but it already works in that regard--the script executes
>
>
>
>>
>>> #sleep 2;
>>> print "here I am! \n";
>>
>>Diagnostics like this are better given with warn, which will .a. print
>>them to STDERR, where they ought to be and .b. tell you where you are in
>>the script.
>
>Well, I'm not actually a programmer, just someone trying to do some
>organization of my files. So, that issue is not a concern right now.
>
>
>
>>
>>> #sleep 2;
>>> my $counter =1;
>>> 
>>> foreach my $file ( glob 'personalinjury/*.htm' ) { 
>>> 
>>> # print "here I am A \n";
>>> # sleep 1;
>>> 
>>>  open my $PI, '<', $file or die "could not open '$file' $!";
>>> 
>>> # print "here I am! B \n";
>>> # sleep 1;
>>> 
>>>  print $counter;
>>>  print "\n";
>>>  while ( <$PI> ) {
>>>  #   print "\n inside whileloop";
>>> 
>>> I AM getting to this point here.
>>> 
>>>   next unless /Citation: [\d-]+.*([\d.]+)/;
>>> 
>>> but I never get to this point here--apparently the regex never sees a
>>> match for the "Citation:" etc string.
>>> 
>>> Here is a screen shot of the typical file, with a red arrow pointing
>>> to the string in this particular file that I want to match. 
>>> I do not know why the regex does not see a match, because it looks
>>> like it matches it???
>>> 
>>> See here:
>>> http://img225.imageshack.us/img225/91/citationue2.jpg
>>
>>*DON'T* do that. 
>
>Don't do what?
>
>>Had you done the right thing, and copy-pasted a small
>>section of the relevant file into your message, you would have found
>>that the file doesn't in fact contain the string 'Citation: whatever' at
>>all. It's an HTML file, so there is markup in there as well, and the
>>string may well be spread across several lines. Get into the habit of
>>looking at files in a text editor before you try parsing them with Perl.
>
>That is a good point. When I wrote my financial news project that
>parsed news stories for negative and positive words, I passed over all
>words that were surrounded by html brackets.
>Here are two excerpts from the source html for a typical file in that
>folder:
>
>
>here is the html source snippet that the script is looking for:
><td class="toolbar" align=right valign=top width="1%"
>nowrap>Citation:&nbsp;&nbsp;</td>
><td class="toolbar" valign=top width="99%"><b>21-340 Dorsaneo, Texas
>Litigation Guide § 340.02</b></td>
>
>
>Yes, you are correct: the HTML code is throwing off the script.
>
>Here is another snippet that looks much more promising. The TITLE of
>the html page. This is not the instance of "citation....etc" that I
>was looking for, but now that I see it, it looks like a good candidate
>for use as a filename:
>
><title>Get a Document - by Citation - 21-340 Dorsaneo, Texas
>Litigation Guide § 340.02</title>
>
>Are the angle brackets special characters in perl so that they have to
>be backslashed inside the regex?
>
>I wonder if this regex would work?
>next unless /\<title\>Get a Document - by Citation -
>[\d-]+.*([\d.]+)\<\/title\>/;
>
>
>
>
>
>
>
>>
>>>     my $newfile = $1;
>>>     rename $file, "$newfile.htm" or die "could not mv '$file' $!";
>>>     print "\n renamed a file";
>>>     sleep 1;
>>>     last;
>>>    }#end while
>>
>>If you had used proper indentation, you would be able to see that
>>comments like this are completely useless.
>
>Not sure what you mean?
>>
>>Ben



well, I changed the program quite a bit so as to be able to target a
match with the title string shown above. And I am able to find the
title string and extract the needed numbers, and I have been able to
place those numbers in a string variable.

BUT the problem is that the program crashes whenever I try to rename
the file using the string that I extracted.

Here is the program.


  
#!/bin/perl


#sleep 2;
print "here I am! \n";
sleep 2;
my $counter =1;
foreach my $file ( glob 'personalinjury/*.htm' ) { 
# print "here I am A \n";
sleep 1;

 open my $PI, '<', $file or die "could not open '$file' $!";
# print "here I am! B \n";
# sleep 1;

 print $counter;
 print "\n";
 while ( <$PI> ) {
    print "\n inside whileloop";
    sleep 1;
#<title>Get a Document - by Citation - 21-340 Dorsaneo, Texas
#Litigation Guide § 340.02</title>

    warn;
    next unless /\<title\>.+Guide\s+§\s+(\d+\.\d+).?\<\/title\>/;
    my $newfile = $+;






this rename line below is what causes it to crash, so i commented it
out:
    #rename $file, "$newfile.htm" or die "could not mv '$file' $!";

But I cannot read what the error message says because the dos window
just closes. Where can I read what was in the window before it
crashed? And how can I rename the file? What went wrong with the
renaming?

The $newfile variable DOES contain the accurate and desired
information at this point, as shown by the print statement below.
    print "\n renamed file to ";
    print  $newfile, "\n";
    sleep 1;
    last;
  }#end while

  $counter++;
  print "\n count is ";
  print $counter;
  print "\n";
  #sleep 1;   
   
   close $PI;
} #end foreach
sleep 5;


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

Date: Tue, 04 Mar 2008 18:01:21 +0100
From: Tomasz Chmielewski <tch@nospam.syneticon.net>
Subject: Re: sorting index-15, index-9, index-110 "the human way"?
Message-Id: <fqjv91$tl9$1@online.de>

Abigail schrieb:
>                                                        _
> Tomasz Chmielewski (tch@nospam.syneticon.net) wrote on VCCXCIX September
> MCMXCIII in <URL:news:fqjgls$cnj$1@online.de>:
> @@  Let's say I have an array consisting of:
> @@  
> @@  some-name-10
> @@  some-name-9
> @@  some-name-102
> @@  some-name-89
> @@  
> @@  I would like to sort it the "human way", with the result:
> @@  
> @@  some-name-9
> @@  some-name-10
> @@  some-name-89
> @@  some-name-102
> @@  
> @@  
> @@  What would be the suggested way to do it?
> @@  
> @@  I would use 'split', but "some-name" is not static, and can be 
> @@  "some-other-name" or just "name" a task later.
> @@  
> @@  For the same reason, using 'substr' won't work.
> @@  
> @@  Unless I write a subroutine to it.
> @@  
> @@  
> @@  What do you guys use to sort such things?
> 
> 
> Well, that depends. Your specification, or rather lack of specification,
> allows multiple interpretations. If you have:
> 
>     sort-name-20
>     sort-name-7
>     name-15
>     name-8
> 
> do you want:
> 
>     name-8
>     name-15
>     sort-name-7
>     sort-name-20
> 
> or
> 
>     sort-name-7
>     name-8
>     name-15
>     sort-name-20

The latter. And the "name" would always be the same (it would only 
change in the next iteration; but for a given iteration, all names would 
be the same).

So essentially, as I wrote:

some-name-10
some-name-9
some-name-102
some-name-89

with the result:

some-name-9
some-name-10
some-name-89
some-name-102


But I think "sub extract" discussed earlier is simple enough for this 
case, and I used it.



-- 
Tomasz Chmielewski
http://wpkg.org


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

Date: Tue, 4 Mar 2008 12:39:56 -0800 (PST)
From: vincent.ho@gmail.com
Subject: SSPI perl module
Message-Id: <0ed7f988-2e3c-4884-8636-93c12c464aff@e10g2000prf.googlegroups.com>

Does anyone know if there is a public Perl module for SSPI (Security
Service Provider Interface) ?


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

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 V11 Issue 1332
***************************************


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