[29715] in Perl-Users-Digest
Perl-Users Digest, Issue: 959 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 21 03:09:35 2007
Date: Sun, 21 Oct 2007 00:09:05 -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 Sun, 21 Oct 2007 Volume: 11 Number: 959
Today's topics:
Re: a nice little perl utility <zaxfuuq@invalid.net>
new CPAN modules on Sun Oct 21 2007 (Randal Schwartz)
Re: perl standard (aka ? the Platypus)
Re: perl standard <zaxfuuq@invalid.net>
Re: perl standard <zaxfuuq@invalid.net>
Re: perl standard <zaxfuuq@invalid.net>
Re: perl standard <zaxfuuq@invalid.net>
Re: perl standard <zaxfuuq@invalid.net>
Re: perl standard <jurgenex@hotmail.com>
Re: polymorphic regex -- encoding issue <dale.gerdemann@googlemail.com>
splitting a line <zaxfuuq@invalid.net>
Re: splitting a line <jurgenex@hotmail.com>
Re: splitting a line <zaxfuuq@invalid.net>
Re: splitting a line <jurgenex@hotmail.com>
Re: Trying to start a perl script as Windows Service <zaxfuuq@invalid.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 20 Oct 2007 23:23:36 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: a nice little perl utility
Message-Id: <wcSdnZKwFd_Of4fanZ2dnUVZ_h-vnZ2d@comcast.com>
"Ron Bergin" <rkb@i.frys.com> wrote in message
news:1192936149.250861.44970@e9g2000prf.googlegroups.com...
> On Oct 20, 6:48 pm, "Wade Ward" <zaxf...@invalid.net> wrote:
>> I've been working with the hints that have been given on how to make
>> ActivePerl, and I've got a long way to go.
>>
>> I now put s cript at the end of a sript that becomes what I feed my dos
>> window. As in this:
>
> You do a very good job of making yourself incomprehensible.
It's Officially Okay to make large mistakes with a new syntax.
>> I can't shake these warnings, and I don't know what they're coming from:
>> Use of uninitialized value in concatenation (.) or string at jabba5.pl
>> line
>> 65.
>> Use of uninitialized value in concatenation (.) or string at jabba5.pl
>> line
>> 67.
>> Use of uninitialized value in concatenation (.) or string at jabba5.pl
>> line
>> 75.
> You need to clearly point out to us those lines of code so we can help
> you.
How did this have to do with the print statement?
> Due to your addition of the comments after the fact that don't fully
> correspond with the line numbers stated at the beginning, I can't be
> sure, but I'd say that the printing of $words[3] is the cause of the
> "Use of uninitialized value in concatenation". Your print statement
> that outputs the $s4 var clearly shows that it holds 3 "words".
> $words[3] would be the 4th word, if there was one.
You got it.
final version of this script for today:
#!/usr/bin/perl
#!/usr/bin/perl she still bangs
## jabba6.pl, 2007-10-20
##minimal nntp client
##manipulates strings in the subject lines
## contributors: Michele, Tad, Ron
use strict;
use warnings;
use Net::NNTP ();
use constant NUMBER_OF_ARTICLES => 1;
use constant GROUP_NAME => 'comp.lang.perl.misc';
use constant SERVER_NAME => 'newsgroups.comcast.net';
use constant NNTP_DEBUG => 0;
my $nntp = Net::NNTP->new(SERVER_NAME, 'Debug' => NNTP_DEBUG) or die;
my $USER = '';
my $PASS = '';
$nntp->authinfo($USER,$PASS) or die $!;
my($article_count, $first_article, $last_article) =
$nntp->group(GROUP_NAME) or die;
# Which XOVER fields contain Subject: and From:?
my $count = 0;
my %xover_fmt = map( ($_, $count++), @{ $nntp->overview_fmt or die} );
die unless exists $xover_fmt{'Subject:'};
my $subject_offset = $xover_fmt{'Subject:'};
my $from_offset = $xover_fmt{'From:'};
my(@xover, $start_article);
RETRIEVE: while ($#xover+1 < NUMBER_OF_ARTICLES and $last_article >=
$first_article) {
# How many articles do we need? Stop retrieving if we have enough
my $articles_required = NUMBER_OF_ARTICLES - ($#xover+1) or last
RETRIEVE;
# Fetch overview information for the articles
$start_article = $last_article - ($articles_required-1);
$start_article = $start_article > $first_article ? $start_article :
$first_article;
my $xover_query = $start_article == $last_article ?
$start_article :
[$start_article, $last_article];
my $xover_ref = $nntp->xover($xover_query) or die;
# Store headers for the articles we've retrieved
foreach (sort {$b <=> $a} keys %$xover_ref) {
push @xover, $xover_ref->{$_};
}
} continue {
# Move the pointer forward to fetch previous articles
$last_article = $start_article - 1;
}
# Disconnect from the NNTP server
$nntp->quit;
# this isUseless use of a constant in void context at jabba5.pl line
#57.
#Use of uninitialized value in concatenation (.) or string at jabba5.pl
#line 64.
my $s4 = join("\n", map ($_->[$subject_offset],@xover));
# fucksyntax error at jabba4.pl line 59, near "fuck
# this is line 60 pardon my french ^^^^^^^^^^^^^^
print STDOUT " s4 is $s4\n";
my @words = split " ", $s4;
$words[0] = reverse $words[0];
#big finish
print STDOUT " $words[1] $words[2] ";
print STDOUT " $words[0] \n";
__END__
# perl jabba6.pl 2>text28.txt >text29.txt
Cheers,
--
wade ward
"Nicht verzagen, Bruder Grinde fragen."
------------------------------
Date: Sun, 21 Oct 2007 04:42:15 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sun Oct 21 2007
Message-Id: <Jq8vqF.xyK@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Acme-Nooo-0.02
http://search.cpan.org/~seano/Acme-Nooo-0.02/
But I don't care if "It Has Objects"!
----
Apache2-ASP-1.16
http://search.cpan.org/~johnd/Apache2-ASP-1.16/
Perl extension for ASP on mod_perl2.
----
Apache2-ASP-1.17
http://search.cpan.org/~johnd/Apache2-ASP-1.17/
Perl extension for ASP on mod_perl2.
----
Apache2-ASP-1.18
http://search.cpan.org/~johnd/Apache2-ASP-1.18/
Perl extension for ASP on mod_perl2.
----
Apache2-ASP-1.19
http://search.cpan.org/~johnd/Apache2-ASP-1.19/
Perl extension for ASP on mod_perl2.
----
CFPlus-0.995
http://search.cpan.org/~mlehmann/CFPlus-0.995/
undocumented utility garbage for our crossfire client
----
CPANPLUS-Dist-Mdv-0.1.2
http://search.cpan.org/~jquelin/CPANPLUS-Dist-Mdv-0.1.2/
a cpanplus backend to build mandriva rpms
----
CatalystX-CRUD-Controller-RHTMLO-0.02
http://search.cpan.org/~karman/CatalystX-CRUD-Controller-RHTMLO-0.02/
Rose::HTML::Objects CRUD controller
----
Chart-Clicker-1.4.0
http://search.cpan.org/~gphat/Chart-Clicker-1.4.0/
Powerful, extensible charting.
----
Class-Accessor-Complex-0.06
http://search.cpan.org/~marcel/Class-Accessor-Complex-0.06/
arrays, hashes, booleans, integers, sets and more
----
Class-Accessor-Complex-0.07
http://search.cpan.org/~marcel/Class-Accessor-Complex-0.07/
arrays, hashes, booleans, integers, sets and more
----
Class-Accessor-Constructor-0.02
http://search.cpan.org/~marcel/Class-Accessor-Constructor-0.02/
constructor generator
----
Class-Null-1.08
http://search.cpan.org/~marcel/Class-Null-1.08/
Implements the Null Class design pattern
----
Crossfire-1.1
http://search.cpan.org/~mlehmann/Crossfire-1.1/
Crossfire maphandling
----
Data-Container-0.04
http://search.cpan.org/~marcel/Data-Container-0.04/
base class for objects containing a list of items
----
Data-FormValidator-4.53
http://search.cpan.org/~markstos/Data-FormValidator-4.53/
Validates user input (usually from an HTML form) based on input profile.
----
DateTime-Format-Natural-0.56
http://search.cpan.org/~schubiger/DateTime-Format-Natural-0.56/
Create machine readable date/time with natural parsing logic
----
Device-SerialPins-v0.0.1
http://search.cpan.org/~ewilhelm/Device-SerialPins-v0.0.1/
per-pin low-level serial port access
----
Error-Hierarchy-0.03
http://search.cpan.org/~marcel/Error-Hierarchy-0.03/
support for hierarchical exception classes
----
Games-Go-Coordinate-0.01
http://search.cpan.org/~marcel/Games-Go-Coordinate-0.01/
represents a board coordinate in the game of Go
----
Games-Go-Coordinate-0.02
http://search.cpan.org/~marcel/Games-Go-Coordinate-0.02/
represents a board coordinate in the game of Go
----
Games-Go-Rank-0.01
http://search.cpan.org/~marcel/Games-Go-Rank-0.01/
----
Games-Go-Rank-0.02
http://search.cpan.org/~marcel/Games-Go-Rank-0.02/
represents a player's rank in the game of Go
----
Games-Go-Rank-0.03
http://search.cpan.org/~marcel/Games-Go-Rank-0.03/
represents a player's rank in the game of Go
----
HTML-Display-0.39
http://search.cpan.org/~corion/HTML-Display-0.39/
display HTML locally in a browser
----
LaTeX-Table-0.3.0
http://search.cpan.org/~limaone/LaTeX-Table-0.3.0/
Perl extension for the automatic generation of LaTeX tables.
----
Lingua-EN-Conjugate-0.302
http://search.cpan.org/~rwg/Lingua-EN-Conjugate-0.302/
Conjugation of English verbs
----
Lingua-EN-Contraction-0.102
http://search.cpan.org/~rwg/Lingua-EN-Contraction-0.102/
Add apostrophes all over the place...
----
Module-Cloud-0.07
http://search.cpan.org/~marcel/Module-Cloud-0.07/
Generates a tag cloud for modules used in given code
----
Muldis-DB-0.5.0
http://search.cpan.org/~duncand/Muldis-DB-0.5.0/
Full-featured truly relational DBMS in Perl
----
Net-Address-Ethernet-1.095
http://search.cpan.org/~mthurn/Net-Address-Ethernet-1.095/
find hardware ethernet address
----
Net-UKDomain-Nominet-Automaton-1.08
http://search.cpan.org/~cliffordj/Net-UKDomain-Nominet-Automaton-1.08/
Module to build, encrypt and send requests to the Nominet automation system via email.
----
Parse-Marpa-0.001_019
http://search.cpan.org/~jkegl/Parse-Marpa-0.001_019/
Earley's Algorithm, with improvements
----
Parse-Marpa-0.001_020
http://search.cpan.org/~jkegl/Parse-Marpa-0.001_020/
Earley's Algorithm, with improvements
----
RT-Extension-EasyRelatedTickets-0.1
http://search.cpan.org/~sunnavy/RT-Extension-EasyRelatedTickets-0.1/
----
SMS-Send-TW-PChome-0.02
http://search.cpan.org/~snowfly/SMS-Send-TW-PChome-0.02/
SMS::Send driver for sms.pchome.com.tw
----
String-FlexMatch-0.10
http://search.cpan.org/~marcel/String-FlexMatch-0.10/
flexible ways to match a string
----
Term-Shell-Enhanced-0.03
http://search.cpan.org/~marcel/Term-Shell-Enhanced-0.03/
more functionality for Term::Shell
----
Test-NoWarnings-0.084
http://search.cpan.org/~fdaly/Test-NoWarnings-0.084/
Make sure you didn't emit any warnings while testing
----
Test-NoWarnings-0.084_a1
http://search.cpan.org/~fdaly/Test-NoWarnings-0.084_a1/
Make sure you didn't emit any warnings while testing
----
Test-Without-Module-0.13
http://search.cpan.org/~corion/Test-Without-Module-0.13/
Test fallback behaviour in absence of modules
----
Test-Without-Module-0.14
http://search.cpan.org/~corion/Test-Without-Module-0.14/
Test fallback behaviour in absence of modules
----
Tk-Wizard-2.119
http://search.cpan.org/~mthurn/Tk-Wizard-2.119/
GUI for step-by-step interactive logical process
----
Tree-1.01
http://search.cpan.org/~rkinyon/Tree-1.01/
an N-ary tree
----
WWW-Velib-0.03
http://search.cpan.org/~dland/WWW-Velib-0.03/
Download account information from the Velib website
----
WWW-WorldLingo-0.03
http://search.cpan.org/~ashley/WWW-WorldLingo-0.03/
Tie into WorldLingo's subscription based translation service.
----
YAML-Active-1.05
http://search.cpan.org/~marcel/YAML-Active-1.05/
Combine data and logic in YAML
----
YAML-Active-1.06
http://search.cpan.org/~marcel/YAML-Active-1.06/
Combine data and logic in YAML
----
parent-0.219
http://search.cpan.org/~corion/parent-0.219/
Establish an ISA relationship with base classes at compile time
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
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: Sun, 21 Oct 2007 05:06:59 GMT
From: "David Formosa (aka ? the Platypus)" <dformosa@usyd.edu.au>
Subject: Re: perl standard
Message-Id: <slrnfhlogu.gpj.dformosa@localhost.localdomain>
On 19 Oct 2007 10:30:11 GMT, Abigail <abigail@abigail.be> wrote:
> Well, there's more to be said about the merits of a standard than
> just dismissing it with "there's just one implementation".
>
> Read the O'Reilly interview [1] with Larry Rosler (a former clpm poster)
> for instance. I don't necessarely agree with his conclusion, but he
> makes some interesting arguments.
A standard doesn't make ensure conformance. While SOAP for example
has a standard no one quite implements SOAP the same way, so we have a
set of mutually incompatable programs each implementing there own
subset of the protocol.
Part of me would like a nice certificate to say "Perl's all mature and
'Enterpize ready'" but I fear the loss of @larry's guidence that this
might entail.
------------------------------
Date: Sun, 21 Oct 2007 00:26:58 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: perl standard
Message-Id: <Z7ydnXMIxMiwbIfanZ2dnUVZ_gmdnZ2d@comcast.com>
<sln@netherlands.co> wrote in message
news:8avkh3hhfci9okkg9qn8su9f5tl8112i8c@4ax.com...
> On Sat, 20 Oct 2007 15:39:58 +0200, Michele Dondi <bik.mido@tiscalinet.it>
> wrote:
>
>>On Fri, 19 Oct 2007 23:03:26 -0700, "Wade Ward" <zaxfuuq@invalid.net>
>>wrote:
>>
>>>I'm embarrassed now, because I thought for sure that Perl had been
>>>admitted
>>>to computer languages for grown-ups. Apparently not.
>>
>>Don't be embarassed: if you feel like abandoning it altogether, then
>>please don't shy away from your inspiration or you may regret it
>>later!
>>
>>
>>Michele
>
> Thats some excellent advice, you['re] an inspiration for me!
>
Right on, dude.
--
wade ward
wade@zaxfuuq.net
"Der Katze tritt die Treppe hoch; Der Kater tritt sie krumm.%
% De Teufel geit um; er bringt de menschen allet dumm."
schau, schau
------------------------------
Date: Sun, 21 Oct 2007 00:30:22 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: perl standard
Message-Id: <EuOdne3O2LRkbIfanZ2dnUVZ_gednZ2d@comcast.com>
"Jürgen Exner" <jurgenex@hotmail.com> wrote in message
news:GOqSi.64$qo2.60@trndny06...
> Wade Ward wrote:
>> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
>>> Wade Ward wrote:
>>>> [...]Does the PPL have a similar list?
>>>
>>> Well, today the ICAO is responsible for standardizing PPL
>>> requirements worldwide [...]
>>> But what does this have to do with the subject of this NG?
>
>> everything.
>
> I appologize for my limited imagination, but I don't see any possible
> relation between the computer programming language Perl and/or its
> implemention on the one side and PPL and the ICAO on the other side. Would
> you mind to elaborate, please?
>
> Are you e.g. suggesting that programmers who want to use Perl must have 40
> hours of mandatory training by a licensed instructor and pass a written,
> oral, and practical test administered by a government official before they
> are allowed to use Perl, just like it is required for a PPL?
> Or are you e.g. suggesting that Perl programmers must pass a biyearly
> medical exam as required for a PPL?
> Or are you e.g. suggesting that Perl programmers must pass a biyearly
> proficiency test as required for a PPL to be allowed to continue to
> program in Perl?
No. I'm trying to add Perl to my bag of tircks. I wouldn't want to do any
of the above to have bona fides.
How can C and Fortran operate with perl, when they seem to have successfully
gotten out of standardization, with dates and times?
--
wade ward
wade@zaxfuuq.net
"Der Katze tritt die Treppe hoch; Der Kater tritt sie krumm.%
% De Teufel geit um; er bringt de menschen allet dumm."
schau, schau
------------------------------
Date: Sun, 21 Oct 2007 00:31:19 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: perl standard
Message-Id: <nsadnTFLroevb4fanZ2dnUVZ_jidnZ2d@comcast.com>
"RedGrittyBrick" <RedGrittyBrick@SpamWeary.foo> wrote in message
news:4--dnVF-ArbtNYfanZ2dneKdnZydnZ2d@bt.com...
> sln@netherlands.co wrote:
>
>> Its a pity you can't define English
>
> Does he need to?
>
> http://www.oed.com/
> "News
> English Defined"
nice link=>fav's.
--
wade ward
wade@zaxfuuq.net
"Der Katze tritt die Treppe hoch; Der Kater tritt sie krumm.%
% De Teufel geit um; er bringt de menschen allet dumm."
schau, schau
------------------------------
Date: Sun, 21 Oct 2007 00:33:09 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: perl standard
Message-Id: <gaadnUF-Yok9b4fanZ2dnUVZ_r6rnZ2d@comcast.com>
"Uri Guttman" <uri@stemsystems.com> wrote in message
news:x7bqatlqd2.fsf@mail.sysarch.com...
>>>>>> "MD" == Michele Dondi <bik.mido@tiscalinet.it> writes:
>
> MD> On Sat, 20 Oct 2007 04:18:04 -0700, "Wade Ward" <zaxfuuq@invalid.net>
> MD> wrote:
>
> >>>> perldoc perlhack is a %100 wrong answer.
> >>>
> >>> Huh?!? What's wrong with it?
> >> It's only good enough for the girls I go with. You cats have C as a
> >> back-end, but what's on the front?
> >>
> >> Does Fortran, the common C extension, exist for perlers?
>
> MD> :|
>
> MD> Please somebody wake me up, this must be a Monty Python sketch, ain't
> MD> it?!?
>
> i think wade is reenacting the attack on perl harbor with the ladies
> auxillary. (otherwise known as mud wrestling :).
>
> as for wanted a formal ISO/ANSI spec, that is hilarious. has he ever
> actually seen one? i worked on compilers with the ANSI PL/I spec and i
> still haven't recovered from the loss of brain cells.
So there exists an ISO doc that has some relevance to perl?
How many battleships are in the harbor? By the time I get to AZ.
--
wade ward
wade@zaxfuuq.net
"Der Katze tritt die Treppe hoch; Der Kater tritt sie krumm.%
% De Teufel geit um; er bringt de menschen allet dumm."
schau, schau
------------------------------
Date: Sun, 21 Oct 2007 00:37:48 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: perl standard
Message-Id: <mJmdnXD5quQqbofanZ2dnUVZ_uCinZ2d@comcast.com>
"Dr.Ruud" <rvtol+news@isolution.nl> wrote in message
news:ffd5r6.1io.1@news.isolution.nl...
> Ben Bullock schreef:
>
>> In other words you're admitting that the language isn't actually
>> defined anywhere.
>
> I still don't understand how you define 'language' here. There is
> nothing to "admit". The Perl language is just never meant to be defined
> in the sense that you seem to be looking for, if I interpret the
> background of your question to your liking. :)
>
> Perl is defined by its implementation, and that has proven to work very
> well in many ways, and not so well in many other ways.
>
> Remaining backwards compatible (which is another definition in itself),
> is both loved and hated by many p5-ers. Back-porting is still actively
> done, for early Perl 5 versions, and for many platforms.
>
> See also the Kurila-fork:
> http://dev.tty.nl/static/kurila/kurila-1.3_0/pod/kurilaintro.html
=> fav;s
Last of my readinbg for tonight. Now I get to go out and put on a
two-minute offense 30 times. Let's hope I crap out.
"A tiger simply is."
drah dee nit um.
> Just my EUR 0.02.
I'd pay 2.1 cents for yours, maybe even 2.5.
Maybe 10^9.
--
wade ward
wade@zaxfuuq.net
"Der Katze tritt die Treppe hoch; Der Kater tritt sie krumm.%
% De Teufel geit um; er bringt de menschen allet dumm."
schau, schau
------------------------------
Date: Sun, 21 Oct 2007 06:51:28 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: perl standard
Message-Id: <QFCSi.528$Qj3.86@trndny01>
Wade Ward wrote:
> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
> news:GOqSi.64$qo2.60@trndny06...
>> Wade Ward wrote:
>>> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
>>>> Wade Ward wrote:
>>>>> [...]Does the PPL have a similar list?
>>>>
>>>> Well, today the ICAO is responsible for standardizing PPL
>>>> requirements worldwide [...]
>>>> But what does this have to do with the subject of this NG?
>>
>>> everything.
>>
>> I appologize for my limited imagination, but I don't see any possible
>> relation between the computer programming language Perl and/or its
>> implemention on the one side and PPL and the ICAO on the other side.
>> Would you mind to elaborate, please?
[...]
> How can C and Fortran operate with perl, when they seem to have
> successfully gotten out of standardization, with dates and times?
Obviously you not able to write a comprehensible question or provide a
coherent answer when asked for clarification. I am giving up. So long then.
jue
------------------------------
Date: Sat, 20 Oct 2007 22:54:30 -0700
From: Dale Gerdemann <dale.gerdemann@googlemail.com>
Subject: Re: polymorphic regex -- encoding issue
Message-Id: <1192946070.082466.54940@t8g2000prg.googlegroups.com>
Thanks Ilya and Affijn for your "improvements" but I still like my own
code better, because at least I break it down into commented steps. I
know my comments are minimal, but at least I tried. The reader of my
code is bound to find several things confusing:
> my @cp1251_charset =3D
> split(//, decode("CP1251", join("", map { chr } 0x00..0xFF)));
Here are some questions that are bound to arise:
Why "decode CP1251"? How can you see that the input was ever encoded
as CP1251 to begin with? We must be assuming that 'chr' returns
something that can at least be thought of as as CP1251 encoded. But
consider the small test program:
print chr(0xFF);
This may print out =FF (LATIN SMALL LETTER Y WITH DIAERESIS), a
character that doesn't even exist in CP1251. Of course, it only prints
out this character if you're using "binmode(STDOUT, ":utf8");" or "use
encoding 'utf8';", but you can see that there is plenty of room for
confusion.
Then there is the issue of what is stored in "@cp1251_charset". Since
it's the output of 'decode', then it must be decoded, right? Whatever
"decoded" means. You see my point. A comment would be helpful, and
this won't be possible if you pack everything into one line.
But what the "improvers" of my code also missed is that I had a second
reason for the itermediate step. I wanted the complete CP1251 charset
stored in a variable so that I could make several passes through it.
As you see in the small example I made two passes. Once for '\w' and
once for '\s'.
I'm sure there are legitimate improvements that could be made to my
code, but it baffles me that people should see packing into a oneliner
as something virtuous.
Dale Gerdemann
------------------------------
Date: Sat, 20 Oct 2007 23:33:03 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: splitting a line
Message-Id: <Y_CdneYBO5YXeYfanZ2dnUVZ_sKqnZ2d@comcast.com>
One of my goals for last night's reading was to figure out how to split up a
line of a script. I have syntax confusion on this point, not helped by
being unable to find anything on it in the camel book.
In fortran you put ampersand at the end of line .3 and at the beginning of
line .7:
statement .2 &
& statement .8
Since perl has semicolons at the end of statements, this would be:
statement .2 &;
& statement .8;
Is there a zeroeth order substittution to make the above
syntactically-correct perl?
--
wade ward
"Nicht verzagen, Bruder Grinde fragen."
------------------------------
Date: Sun, 21 Oct 2007 05:47:12 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: splitting a line
Message-Id: <AJBSi.750$6P3.428@trndny02>
Wade Ward wrote:
> One of my goals for last night's reading was to figure out how to
> split up a line of a script.
What exactly do you mean by "splitting up a line of a script". The basic
unit of a Perl program is not a line but a statement. Actually perl doesn't
even know or care about lines (well, except for the running line counter, of
course).
> I have syntax confusion on this point,
> not helped by being unable to find anything on it in the camel book.
That is not surprising because lines are irrelevant to Perl's syntax and
therefore of course are not mentioned anywhere in the syntax definition.
Perl does not care if a program is written in 50 short lines or in 5 very
long lines.
> In fortran you put ampersand at the end of line .3 and at the
> beginning of line .7:
> statement .2 &
> & statement .8
I have no idea what a .7 line, a .2 statement or a .8 statement is supposed
to be.
> Since perl has semicolons at the end of statements, this would be:
>
> statement .2 &;
> & statement .8;
>
> Is there a zeroeth order substittution to make the above
> syntactically-correct perl?
I have no idea what a "zeroeth order substittution" is.
jue
------------------------------
Date: Sun, 21 Oct 2007 00:25:21 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: splitting a line
Message-Id: <4I-dnQ_mv7FRbYfanZ2dnUVZ_hGdnZ2d@comcast.com>
"Jürgen Exner" <jurgenex@hotmail.com> wrote in message
news:AJBSi.750$6P3.428@trndny02...
> Wade Ward wrote:
>> I have syntax confusion on this point,
>> not helped by being unable to find anything on it in the camel book.
>
> That is not surprising because lines are irrelevant to Perl's syntax and
> therefore of course are not mentioned anywhere in the syntax definition.
> Perl does not care if a program is written in 50 short lines or in 5 very
> long lines.
Perl is sooo different from fortran.
>> In fortran you put ampersand at the end of line .3 and at the
>> beginning of line .7:
>> statement .2
usenet is about 80 chars wide.
I don't like exceeding 65.
If there were--and it sounds like there really is only one line in a
perlscript--
one line in a perlscript
, how would I put it on usenet without making huge errors?
&
>> & statement .8
>
> I have no idea what a .7 line, a .2 statement or a .8 statement is
> supposed to be.
>
>> Since perl has semicolons at the end of statements, this would be:
>>
>> statement .2 &;
>> & statement .8;
>>
>> Is there a zeroeth order substittution to make the above
>> syntactically-correct perl?
>
> I have no idea what a "zeroeth order substittution" is.
You get out of your depth pretty quickly in logic. Not everybody's thang.
Cheers,
--
wade ward
wade@zaxfuuq.net
"Der Katze tritt die Treppe hoch; Der Kater tritt sie krumm.%
% De Teufel geit um; er bringt de menschen allet dumm."
schau, schau
------------------------------
Date: Sun, 21 Oct 2007 06:45:28 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: splitting a line
Message-Id: <cACSi.851$Y23.18@trndny04>
Wade Ward wrote:
> "Jürgen Exner" <jurgenex@hotmail.com> wrote in message
> news:AJBSi.750$6P3.428@trndny02...
>> Wade Ward wrote:
>>> In fortran you put ampersand at the end of line .3 and at the
>>> beginning of line .7:
>>> statement .2
> usenet is about 80 chars wide.
> I don't like exceeding 65.
That's great and very considerate of you.
Unfortunately it still doesn't explain what a .3 line, a .7 line, and a .2
statement are supposed to be.
> If there were--and it sounds like there really is only one line in a
> perlscript--
> one line in a perlscript
> , how would I put it on usenet without making huge errors?
As far as Perl and perl are concerned there are no lines in a Perl script(*)
at all. It's like asking how many inches are in a cup of sugar. Yeah, there
are ways to measure the hight of the sugar, but the baking recipie doesn't
care because it measures in cups.
Lines are useful organizational aides for human readability and nobody
should dismiss their importance.
So just use them to structure the optical layout of your program text such
that it is the easiest to read. "perldoc perlstyle" has some good
recommendations.
(*) Please note, I'm assuming you are talking about the programming language
Perl and scripts written in this language. Perlscript does exist, too, and
it is quite a different animal.
>>> Is there a zeroeth order substittution to make the above
>>> syntactically-correct perl?
>>
>> I have no idea what a "zeroeth order substittution" is.
> You get out of your depth pretty quickly in logic.
Yeah, I am known to have poor mindreading capabilities.
> Not everybody's thang.
What on earth are you talking about??? http://en.wikipedia.org/wiki/Thang
jue
------------------------------
Date: Sun, 21 Oct 2007 00:20:13 -0700
From: "Wade Ward" <zaxfuuq@invalid.net>
Subject: Re: Trying to start a perl script as Windows Service
Message-Id: <l7mdnTGU2okFcofanZ2dnUVZ_hmtnZ2d@comcast.com>
<dn.perl@gmail.com> wrote in message
news:1192764774.350441.320950@q3g2000prf.googlegroups.com...
> On Oct 3, 8:59 pm, Ron Bergin <r...@i.frys.com> wrote:
>>
>> I've never used it myself, but you could try
>> Win32::Daemonhttp://search.cpan.org/~daveroth/Win32-Scheduler_v20000702/lib/Win32/...http://www.roth.net/perl/Daemon/
>>
>> Win32::Daemon::Simplehttp://search.cpan.org/~jenda/Win32-Daemon-Simple-0.2.6/Simple.pm
>
> I tried :
> http://search.cpan.org/~daveroth/Win32-Scheduler_v20000702/lib/Win32/Scheduler.PM
> and ran into roughly the same problem (permissions related) which I
> had faced when using SRVANY.exe file. I still haven't tried out the
> steps detailed in Win32::Daemon::Simple.
>
> I installed a service "n_print_tstamp" with the script
> "my_install_service.pl" :
> use Win32::Daemon;
> %Hash = (
> name => 'n_print_tstamp',
> display => 'print_tstamp',
> path => 'c:\perl\bin\perl.exe',
> user => '',
> pwd => '',
> parameters =>'C:\mydir\print_tstamp.pl',
> );
> if( Win32::Daemon::CreateService( \%Hash ) )
> {
> print "Successfully added.\n";
> }
> else
> {
> print "Failed to add service: " .
> Win32::FormatMessage( Win32::Daemon::GetLastError() ) . "\n";
> }
>
>
> The service was successfully added. I have verified that C:\mydir
> \print_tstamp.pl runs correctly from the command prompt.
> Listing of print_tstamp.pl (which is an infinite loop) :
> #! sample perl str -w
>
> use strict ;
> use POSIX qw(strftime);
>
> $0 =~ m/(.*)\\.*/ ;
> my $exec_dir = $1 ;
>
> my $aa ;
> my $str ;
> my $filename = "$exec_dir\\tstamp_log.wri" ;
>
> my $sleep_time = 5 ;
>
> for ($aa = 1; $aa < 3; $aa++) {
> sleep $sleep_time if $aa != 1 ;
> open (FH, ">>", $filename) or die "cannot open the file\n" ;
> $str = strftime "%Y-%m-%d %H:%M:%S ", localtime;
> # print "Time is $str \n" ;
> print FH "Time is $str \n" ;
> close FH ;
> $aa = 1 ;
> }
>
> When I try to start the above script as service, I get some error or
> other.
>
> Error message for blank user and blank pwd in %hash in
> my_install_service.pl.
> --------------
> Could not start the print_stamp service on local computer.
> Error 1053 : The service did not respond to the start or control
> request in a timely fashion
> --------------
>
>
>
> Error message for my_install_service.pl file with invalid username-
> password :
> -----------------
> Failed to add service: The account name is invalid or does not exist,
> or the password is invalid for the account name specified.
> ==> This error message shows that the service is being started only
> after verifying username-password.
> --------------
>
>
> Error message for my_install_service.pl file with proper username-
> password
> in the hash declaration in my_install_service.pl :
> -----------------
> Could not start the print_stamp service on local computer.
> Error 1069 : the service did not start due to a logon failure.
> --------------
>
> What might be the issue?
I'll put you in tomorrow's inbox and try to replicate the trouble.
There's *so much* to know about ActiveState.
--
wade ward
wade@zaxfuuq.net
"Der Katze tritt die Treppe hoch; Der Kater tritt sie krumm.%
% De Teufel geit um; er bringt de menschen allet dumm."
schau, schau
------------------------------
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 959
**************************************