[28299] in Perl-Users-Digest
Perl-Users Digest, Issue: 9663 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 29 18:05:45 2006
Date: Tue, 29 Aug 2006 15:05:08 -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 Tue, 29 Aug 2006 Volume: 10 Number: 9663
Today's topics:
1 string from 3, making replacements more perlish <StillAwake@2am>
Re: Beginner: read $array with line breaks line by line <mstep@t-online.de>
Re: Cache mechanism for method lookup <simon.chao@fmr.com>
Re: Cache mechanism for method lookup <uri@stemsystems.com>
Re: FAQ 6.22 How can I match strings with multibyte cha <hjp-usenet2@hjp.at>
Re: How to sort a date array? <jl_post@hotmail.com>
Re: imagemagick very slow - is there anything better? <andy@earthsong.null.free-online.co.uk>
Re: integrate() <jl_post@hotmail.com>
Re: Missing zeros in permutation. A perl bug or somethi <StillAwake@2am>
Re: Multiple interpreters and data atomicity <bik.mido@tiscalinet.it>
Re: Multiple interpreters and data atomicity <hjp-usenet2@hjp.at>
Re: Multiple interpreters and data atomicity <kkeller-usenet@wombat.san-francisco.ca.us>
sorting an array of hashrefs <user@example.net>
Re: sorting an array of hashrefs <someone@example.com>
Re: sorting an array of hashrefs <1usa@llenroc.ude.invalid>
Re: Win32::GUI and Scrolling Text <jackbarnett@gmail.com>
Re: Win32::GUI and Scrolling Text <jackbarnett@gmail.com>
Windows Service - Determine if someone is logged in at whoopes@gmail.com
Re: Working with Source Code to Insert Copyright Statem <hjp-usenet2@hjp.at>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 29 Aug 2006 16:55:14 -0500
From: StuPedaso <StillAwake@2am>
Subject: 1 string from 3, making replacements more perlish
Message-Id: <5tc9f2h5fboo6qb04aag41e82u7k6bb4nn@4ax.com>
I have 1 string made up of ones and zeros,
a 2nd and 3rd of letters and number,
and need to create a 4th where the 1's are successively pulled from 2,
and the 1's from the 3rd.
I can this do this in a QB/VB type way with
$string1="001010110";
$string2="a1bd3";
$string3="0XY0";
$l=0;$m=0;$p=0;
$string4="";
for $i (0..(length $string1)){
$x=substr($string1,$l,1);$l++;
if ($x==1){$string4.=substr($string3,$p,1);$p++;}
else {$string4.=substr($string2,$m,1);$m++;}
}
print $string4;
#a10bXdY03
Not very perlish
Also I don't want to modify srting1, as I will be using it again after
I modify 2 and 3.
------------------------------
Date: Tue, 29 Aug 2006 22:19:12 +0200
From: Marek Stepanek <mstep@t-online.de>
Subject: Re: Beginner: read $array with line breaks line by line
Message-Id: <C11A6DE0.2B8CF%mstep@t-online.de>
I am sorry, but I am still stuck with my script. If a kind soul could check,
why some regex are not producing anything (see comment in the script). Once
again the original, which has to be red in:
http://podiuminternational.org/htdocs/addresses/competitions/competitionsfun
ds.htm
thank you again for your patience and your great help
marek
#! /usr/bin/perl
use strict;
use warnings;
use HTML::Entities;
$/ = undef;
my (@competitions);
while (<>)
{
push @competitions, m"<dd>(.+?)</dd>"g;
}
foreach (@competitions)
{
s!<span\s+class="comp2">([^<]+)</span>!Competition: $1\n\n!g;
s!<br />!\n!g;
s!<p [^>]+>!\n!g;
s!<[^>]+>!!g;
}
my $out_file1 = 'letter_comp_addr_01.adr';
open OUT1, '>', $out_file1 or die "Connot create your out_file $out_file1:
$!";
my $out_file2 = 'letter_comp_addr_02.adr';
open OUT2, '>', $out_file2 or die "Connot create your out_file $out_file2:
$!";
print OUT1 join ("\n\n", @competitions);
print OUT1 "\n\n";
my ($competition, $email, $first_name, $last_name, $gender, $phone,
$comment);
foreach my $addr (@competitions)
{
foreach (split(/\n/, $addr))
{
($competition) = $1 if m/^Competition:\s+(.+)/;
if ($comment and m/^\s?((?:International|National)
Competition)\s*$/i)
{
$comment .= "$1. ";
}
else
{
$comment = "$1. " if m/^\s?((?:International|National)
Competition)\s*$/i;
}
if ($comment and
m/^(Categories.+|Age.+|Application.+|mentioned.+)/i)
{
$comment .= "$1. ";
}
else
{
$comment = "$1. " if
m/^(Categories.+|Age.+|Application.+|mentioned.+)/i;
}
($gender) = $& if m/(Mrs(?:\.|\b)|Mr(?:\.|\b))/i; # here nothing
# is red in ... why? follows a longer regex, to read in the names too, which
# was not working either. I was stuck here, so I did not attacked the
# problem with the addresses yet ...
#
# ($gender, $first_name, $last_name) = $_ =~ /^
?((?:Mr\.?|Mrs\.?)\s+)?([A-Z][a-z]+(?:\s+[A-Z][a-z]*\.?)?)\s+([A-Z][a-z]+(?:
[-A-Z][a-z]+)?)\s?$/;
if ($phone and m/^\s*(?:(Fon:? .+)|(Fon:? .+))/i)
{
$phone .= "$1 ";
}
else
{
$phone = "$1 " if m/^\s*(?:(Fon:? .+)|(Fon:? .+))/i;
}
if ($gender)
{
if ( $gender =~ m/Mrs/ )
{
$gender = "w";
}
elsif ( $gender =~ m/Mr/ )
{
$gender = "m";
}
else
{
$gender = "u";
}
}
($email) = $_ =~ m"((&#\d+;)+)";
$email = decode_entities($email) if $email;
}
if ($competition)
{
print OUT2 "\\addrentry\n";
if ($last_name)
{
print OUT2 "\t{$last_name}\n";
}
else
{
print OUT2 "\t{last_name}\n";
}
if ($first_name)
{
print OUT2 "\t{$first_name}\n";
}
else
{
print OUT2 "\t{first_name}\n";
}
if ($phone)
{
print OUT2 "\t{$phone}\n";
}
else
{
print OUT2 "\t{phone}\n";
}
print OUT2 "\t{$competition}\n";
if ($gender)
{
print OUT2 "\t{$gender}\n";
}
else
{
print OUT2 "\t{gender}\n";
}
if ($email)
{
print OUT2 "\t{$email}\n";
}
else
{
print OUT2 "\t{email}\n";
}
if ($comment)
{
print OUT2 "\t{$comment}\n";
}
else
{
print OUT2 "\t{comment}\n"
}
}
($comment, $email, $gender, $competition, $last_name, $first_name,
$phone) = '';
}
close OUT1;
close OUT2;
------------------------------
Date: 29 Aug 2006 13:03:41 -0700
From: "it_says_BALLS_on_your forehead" <simon.chao@fmr.com>
Subject: Re: Cache mechanism for method lookup
Message-Id: <1156881821.062628.84490@e3g2000cwe.googlegroups.com>
Ferry Bolhar wrote:
> Hi,
>
> I've heard that Perl uses a cache when looking up for methods,
> so when a method is called again, there is no longer need to
> look again into @ISA.
>
> Is this true? If so, how is it implemented? And what will happen
> when @ISA gets modified later?
>
> Thanks for your answers & greetings,
isn't this what Memoize is for?
------------------------------
Date: Tue, 29 Aug 2006 16:12:51 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Cache mechanism for method lookup
Message-Id: <x7u03vqp18.fsf@mail.sysarch.com>
>>>>> "isBoyf" == it says BALLS on your forehead <simon.chao@fmr.com> writes:
isBoyf> Ferry Bolhar wrote:
>> Hi,
>>
>> I've heard that Perl uses a cache when looking up for methods,
>> so when a method is called again, there is no longer need to
>> look again into @ISA.
>>
>> Is this true? If so, how is it implemented? And what will happen
>> when @ISA gets modified later?
>>
>> Thanks for your answers & greetings,
isBoyf> isn't this what Memoize is for?
no, they are very different beasts. memoize allows a user sub to cache
its answers and it is has some restrictions such as the sub not doing
any side effects and always returning the same answer for the same
arguments.
perl's guts do cache method lookups as it would be very slow to always
lookup the methods in each namespace listed in @ISA. from perlobj:
If a missing method is found in a base class, it is cached in
the current class for efficiency. Changing @ISA or defining new
subroutines invalidates the cache and causes Perl to do the
lookup again.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Tue, 29 Aug 2006 23:14:46 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: FAQ 6.22 How can I match strings with multibyte characters?
Message-Id: <slrnef9bi8.db6.hjp-usenet2@yoyo.hjp.at>
On 2006-08-29 19:03, PerlFAQ Server <brian@stonehenge.com> wrote:
> 6.22: How can I match strings with multibyte characters?
>
>
>
> Starting from Perl 5.6 Perl has had some level of multibyte character
> support. Perl 5.8 or later is recommended. Supported multibyte character
> repertoires include Unicode, and legacy encodings through the Encode
> module. See perluniintro, perlunicode, and Encode.
>
> If you are stuck with older Perls, you can do Unicode with the
> "Unicode::String" module, and character conversions using the
> "Unicode::Map8" and "Unicode::Map" modules. If you are using Japanese
> encodings, you might try using the jperl 5.005_03.
>
> Finally, the following set of approaches was offered by Jeffrey Friedl,
> whose article in issue #5 of The Perl Journal talks about this very
> matter.
>
> Let's suppose you have some weird Martian encoding where pairs of ASCII
> uppercase letters encode single Martian letters (i.e. the two bytes "CV"
> make a single Martian letter, as do the two bytes "SG", "VS", "XX",
> etc.). Other bytes represent single characters, just like ASCII.
[Problems with multibyte encodings]
I get the impression from this article that these problems are present
in perl's unicode support. However, UTF-8 has been designed to avoid
these synchronisation problems, and the internal utf8 encoding of perl
character strings is (mostly) transparent to the perl script.
If you have perl 5.8, the best way to match multibyte characters is
probably to decode() them to character strings and then match these.
hp
--
_ | Peter J. Holzer | > Wieso sollte man etwas erfinden was nicht
|_|_) | Sysadmin WSR | > ist?
| | | hjp@hjp.at | Was sonst wäre der Sinn des Erfindens?
__/ | http://www.hjp.at/ | -- P. Einstein u. V. Gringmuth in desd
------------------------------
Date: 29 Aug 2006 11:40:16 -0700
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: How to sort a date array?
Message-Id: <1156876816.461368.255220@m79g2000cwm.googlegroups.com>
SaltyBall wrote:
>
> Here we have a date array like this
> @array=(2006-01-03, 2006-03-24, 2005-01-06);
> when I use
> sort(@array)
> it did not sort correctly, the month and date was not sort, I think it
> is the "-" make the sort fail, what is the correct way to sort this array?
From a later posting, I see that you understand that sort(@array) is
not an "in-place" sort and will not modify the contents of @array.
However, I think you might have missed what other posters were trying
to tell you about the "-":
You seem to think it is part of a string, but Perl is treating it a
the subtraction operator. In other words, when you write:
2006-01-03
Perl thinks you meant:
2006 minus 1 minus 3 ==> which equals 2002.
To illustrate this, if you change the line of code:
@array=(2006-01-03, 2006-03-24, 2005-01-06);
to:
print join(' ', 2006-01-03, 2006-03-24, 2005-01-06);
you'll see that the output is not:
2006-01-03 2006-03-24 2005-01-06
as you thought, but rather:
2002 1979 1998
which is the result of performing the subtraction on the year values.
You probably meant to treat the values as strings and write:
@array=("2006-01-03", "2006-03-24", "2005-01-06");
and then later:
@array = sort(@array);
I also strongly recommend putting the following two lines near the
top of your script:
use strict;
use warnings;
You might not realize it, but those two lines can immediately catch
up to about 90% of the errors you make. And they'll tell you the exact
line number the errors are on without you needing to spend fifteen
minutes trying to hunt each bug down.
Seriously, I recommend either including those two "use" lines, or
else consider using another programming language altogether. Not using
those two lines allows for so many things to go wrong (that would have
otherwise been easily caught and reported) that it's usually not really
worth programming in Perl without them. (I feel that this is still
true whether you're a beginner or an advanced Perl programmer.)
I hope this helps!
-- Jean-Luc
perl -le "print(pack'B*','0'.unpack'B*',pack'w*',
5592691776,37562575106519616,25926642752,354130435682904)"
------------------------------
Date: Tue, 29 Aug 2006 22:05:17 +0100
From: andy baxter <andy@earthsong.null.free-online.co.uk>
Subject: Re: imagemagick very slow - is there anything better?
Message-Id: <pan.2006.08.29.21.05.17.872476@earthsong.null.free-online.co.uk>
On Tue, 29 Aug 2006 17:26:18 +0100, andy baxter wrote:
> hello,
>
> I'm writing a short perl program to split up a map image into tiles at
> various zoom levels so I can use it in a 'google maps' style javascript
> applet. I'm using PerlMagick to do the image manipulation, and it is
> running /very/ slowly. The original image is quite big (4143 x 4728
> pixels), so I would expect it to take a while, but not 20 minutes +
> before it even finishes loading the image.
I've now finished the program using imlib2, and it's working nicely.
Conclusion - unless you need its more sophisticated functions, don't
bother with imagemagick; use imlib2 instead.
--
remove 'n-u-l-l' to email me.
------------------------------
Date: 29 Aug 2006 11:52:28 -0700
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: integrate()
Message-Id: <1156877547.922237.314270@74g2000cwt.googlegroups.com>
Ilya Zakharevich wrote:
>
> perl -MMath::Pari=:all -wle "$x = PARIvar q(x); print $p = ($x**7 - 1)/($x - 1); print intformal $p"
> x^6+x^5+x^4+x^3+x^2+x+1
> 1/7*x^7+1/6*x^6+1/5*x^5+1/4*x^4+1/3*x^3+1/2*x^2+x
>
> Hope this helps,
> Ilya
Thanks, Ilya! I've been looking for something like this for a long
time.
And I'm happy to see that this module is even available on Win32
ActiveState Perl! (All that was needed to install it was the command
"ppm install Math-Pari".)
Thanks again.
-- Jean-Luc
--
perl -le "print(pack'B*','0'.unpack'B*',pack'w*',
5592691776,37562575106519616,25926642752,354130435682904)"
------------------------------
Date: Tue, 29 Aug 2006 13:35:37 -0500
From: StuPedaso <StillAwake@2am>
Subject: Re: Missing zeros in permutation. A perl bug or something else?
Message-Id: <g529f214va07j6bejvh81hi8dr085pur6n@4ax.com>
On 29 Aug 2006 13:41:11 GMT, anno4000@radom.zrz.tu-berlin.de wrote:
>David Squire <David.Squire@no.spam.from.here.au> wrote in comp.lang.perl.misc:
>> StuPedaso wrote:
>>
>> >
>> > Can anyone tell me why the permutations that should end in zero are
>> > missing that zero?
>> >
>> [snip]
>>
>> > sub process {
>> > my $item = shift;
>> > $item =~ /(.*):(.*)/;
>> >
>> > if ( $2 ) {
>>
>> I haven't done any analysis of your algorithm, but my hunch is that the
>> line above is the cuiprit. It will evaluate as false if $2 == '0'. Try
>> replacing it with
>>
>> if (defined $2) {
Nothing comes out if this line is used.
>
>It should probably look for empty matches, not undefined ones
>(untested)
>
> if ( length $2 ) {
>
>Anno
length worked. Thanks
Stu
------------------------------
Date: 29 Aug 2006 22:59:07 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Multiple interpreters and data atomicity
Message-Id: <qfa9f2d3ut0ic0r5p5iua3jif282co9ima@4ax.com>
On 29 Aug 2006 10:32:33 -0700, "Derek Basch" <dbasch@yahoo.com> wrote:
>What I don't understand is if someones slightly less than complete
>question bugs you why even bother responding in a negative fashion? Why
>not just say "You didn't expand upon xyz enough for me to answer your
>question. Could you please restate your question with more detail on
>xyz?". How does mocking me help anyone?
You were not mocked nor answered in a "negative fashion", whatever it
could be. In fact you *have* been told "You didn't expand upon xyz
enough for me to answer your question. Could you please restate your
question with more detail on xyz?" - just more concisely and with a
little bit of witty sarcasm. I, for one, do appreciate witty answers,
even if they're sarcastic, and aimed at me.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Tue, 29 Aug 2006 22:58:46 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Multiple interpreters and data atomicity
Message-Id: <slrnef9ak9.db6.hjp-usenet2@yoyo.hjp.at>
On 2006-08-29 17:32, Derek Basch <dbasch@yahoo.com> wrote:
> I apologize for being short but I guess I get easily angered by people
> who mock others who make simple mistakes.
Get used to it. This is usenet. Some people will answer the question you
asked. Some will answer the question they think you should have asked.
Some will ask counter questions. Some will discuss a completely
irrelevant detail of your posting at great length. Some will be polite.
Some won't. Some know what they are talking about and some don't. Some
can express themselves well, and some can't.
hp
--
_ | Peter J. Holzer | > Wieso sollte man etwas erfinden was nicht
|_|_) | Sysadmin WSR | > ist?
| | | hjp@hjp.at | Was sonst wäre der Sinn des Erfindens?
__/ | http://www.hjp.at/ | -- P. Einstein u. V. Gringmuth in desd
------------------------------
Date: Tue, 29 Aug 2006 14:20:43 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Multiple interpreters and data atomicity
Message-Id: <bmnes3xdo.ln2@goaway.wombat.san-francisco.ca.us>
On 2006-08-29, Derek Basch <dbasch@yahoo.com> wrote:
>
> Apparently not. I apologize. I realize now I should have given more
> detail about what the Data Store is. I thought I had explained enough
> but I am not perfect and make mistakes.
You say this, but...
> I will move my query to a socket or telnet mailing list.
then you say this, which seems to indicate that you really don't
understand the issue. The socket is not relevant; telnet is not
relevant. The *data store* is the important piece of your question:
what does it do when it gets data from multiple clients? If you can't
answer that question (or find someone who can), there's no way anyone
will be able to help you with any client issues.
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information
------------------------------
Date: Tue, 29 Aug 2006 15:29:16 -0500
From: monkeys paw <user@example.net>
Subject: sorting an array of hashrefs
Message-Id: <jqadnS4xccYPCGnZnZ2dnUVZ_v2dnZ2d@insightbb.com>
The following is intended to sort an array of hash refs based on
id_type. It is not working however. Does anyone know why?
use Data::Dumper;
our %datatype_sort = (
bill => 0,
reg => 10,
);
my @ary = (
{id_type => 'reg', id => 'KY200616813'},
{id_type => 'bill', id => 'CA2005000A5'},
{id_type => 'bill', id => 'CA2005000A250'},
);
my @x = sort _sortval_datatype @ary;
print Dumper(\@x);
sub _sortval_datatype {
my($av, $bv) = @_;
return $datatype_sort{$av->{id_type}} <=>
$datatype_sort{$bv->{id_type}};
}
------------------------------
Date: Tue, 29 Aug 2006 19:48:06 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: sorting an array of hashrefs
Message-Id: <WR0Jg.14797$Nz6.8459@edtnps82>
monkeys paw wrote:
> The following is intended to sort an array of hash refs based on
> id_type. It is not working however. Does anyone know why?
>
> use Data::Dumper;
>
> our %datatype_sort = (
> bill => 0,
> reg => 10,
> );
>
>
> my @ary = (
> {id_type => 'reg', id => 'KY200616813'},
> {id_type => 'bill', id => 'CA2005000A5'},
> {id_type => 'bill', id => 'CA2005000A250'},
> );
>
> my @x = sort _sortval_datatype @ary;
>
> print Dumper(\@x);
>
> sub _sortval_datatype {
> my($av, $bv) = @_;
> return $datatype_sort{$av->{id_type}} <=>
> $datatype_sort{$bv->{id_type}};
> }
sub _sortval_datatype {
return $datatype_sort{$a->{id_type}} <=> $datatype_sort{$b->{id_type}};
}
John
--
use Perl;
program
fulfillment
------------------------------
Date: Tue, 29 Aug 2006 19:50:41 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: sorting an array of hashrefs
Message-Id: <Xns982EA14AB6449asu1cornelledu@127.0.0.1>
monkeys paw <user@example.net> wrote in
news:jqadnS4xccYPCGnZnZ2dnUVZ_v2dnZ2d@insightbb.com:
> The following is intended to sort an array of hash refs based on
> id_type. It is not working however. Does anyone know why?
>
use strict;
use warnings;
missing.
> use Data::Dumper;
>
> our %datatype_sort = (
> bill => 0,
> reg => 10,
> );
>
>
> my @ary = (
> {id_type => 'reg', id => 'KY200616813'},
> {id_type => 'bill', id => 'CA2005000A5'},
> {id_type => 'bill', id => 'CA2005000A250'},
> );
>
> my @x = sort _sortval_datatype @ary;
>
> print Dumper(\@x);
>
> sub _sortval_datatype {
> my($av, $bv) = @_;
> return $datatype_sort{$av->{id_type}} <=>
> $datatype_sort{$bv->{id_type}};
> }
The elements to be compared are not passed to _sortval_datatype in
subroutine arguments, but rather in the package variables $a and $b.
my @x = sort { $datatype_sort{$a->{id_type}}
<=>
$datatype_sort{$b->{id_type}}
} @ary;
Do read perldoc -f sort.
Incidentally, you could just use cmp:
my @x = sort { $a->{id_type} cmp $b->{id_type} } @ary;
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: 29 Aug 2006 13:47:32 -0700
From: "jackbarnett@gmail.com" <jackbarnett@gmail.com>
Subject: Re: Win32::GUI and Scrolling Text
Message-Id: <1156884452.230295.56220@b28g2000cwb.googlegroups.com>
I need an infite loop. Basically what I'm trying to do is a tail...
reading in entire file and when I get to the end of the file; sleep
for X Seconds and then see if there is any more lines on the end of the
file is unread, else sleep again and repeat.
I don't need to update the window with the entire file, only need to
update the window with the new lines (appeneded at the end of the
buffer).
for example, in a normal text console under Win32 I can do this:
for(;;) {
while ( <FILE> ) {
my $line=$_;
chomp($line);
print ("$line\n");
}
sleep (1);
FILE->clearerr();
}
That reads in entire file, when it gets to end, it sleeps for 1 second.
It then loops back and starts reading where it left off (if there are
any new lines it prints them) then repeats.
I don't need this "event handler loop" stuff getting in my way. I
tried forking it off (so it could run in a differant thread and update
whatever it needs) but that causes the GUI to hang.
I want to control directly what I'm doing or not doing with the file.
It's not the EventHandler's bussiness what I'm doing with this file in
the privacy of my own code.
Can I just do a fork and say "Here Mr. TK GUI, you run in a differant
thread and do whatever you need to do. I'll send you data if I want
you to update something, else stop getting all up in my code like
that".
Basically I want a nice GUI interface with fancy buttons and stuff and
then imbedded in the GUI a window that acts like a "stupid console".
Does that make sense?
Basically I want to do this:
http://tailforwin32.sourceforge.net/
But in Perl.
TK/Win32, I don't care. Just some type of nice GUI interface.
------------------------------
Date: 29 Aug 2006 14:10:09 -0700
From: "jackbarnett@gmail.com" <jackbarnett@gmail.com>
Subject: Re: Win32::GUI and Scrolling Text
Message-Id: <1156885809.634357.244560@74g2000cwt.googlegroups.com>
btw, thanks for your replies. I appericate it.
I was also wondering, do you know of any online documentation for
Perl/TK? I think I should start there... some newbie guide, cause
don't think I'm getting the basic concepts here.
------------------------------
Date: 29 Aug 2006 12:48:14 -0700
From: whoopes@gmail.com
Subject: Windows Service - Determine if someone is logged in at the console
Message-Id: <1156880894.547097.313190@e3g2000cwe.googlegroups.com>
Subject pretty much spells it out. The service is running as
localsystem. Here's what I've tried and the results:
1. WMI - Win32_ComputerSystem class - The issue here is that on some
workstations this class is restricted or doesn't return data.
2. WMI - Win32_Process class - Seems to be reliable in regards to
returning data but only good to determin if someone is logged on not
who.
3. Win32::Lanman::NetWkstaUserEnum - Seems to cache logons until the
system is restarted.
Win32::LoggedonUser is not an option. Will only work with interactive
scripts such as a logon script.
Any ideas???
------------------------------
Date: Tue, 29 Aug 2006 20:06:11 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Working with Source Code to Insert Copyright Statements as a Header
Message-Id: <slrnef90gm.924.hjp-usenet2@yoyo.hjp.at>
On 2006-08-29 16:10, Dr.Ruud <rvtol+news@isolution.nl> wrote:
> Perlgirl schreef:
>> Insertion of a copyright statement needs to only search
>> through all text_files
>> (*.c, .doc, .java, .xml, .pl, .sh. assembler_source, .txt .vbs .any
>> ascii english text, etc etc etc) at the top of the file
>
> This can not be done without breaking many of those files. At the top of
> the file there is often specific information about how the file should
> be handled.
I don't think "at the top of the file" was meant so literally.
> But even if you would insert it at line 2 or below, the file
> would often no longer be useful as a .c/java/xml/pl/etc. file. Is that
> not a problem?
It just means you have to be more careful. If you have determined that
the file is a C file (and you need to identify the files to process
anyway), you have to insert
/* Copyright ... */
instead of just
Copyright ...
Similarly for the other file types.
hp
--
_ | Peter J. Holzer | > Wieso sollte man etwas erfinden was nicht
|_|_) | Sysadmin WSR | > ist?
| | | hjp@hjp.at | Was sonst wäre der Sinn des Erfindens?
__/ | http://www.hjp.at/ | -- P. Einstein u. V. Gringmuth in desd
------------------------------
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 9663
***************************************