[31563] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2822 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 17 16:09:48 2010

Date: Wed, 17 Feb 2010 13:09:05 -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           Wed, 17 Feb 2010     Volume: 11 Number: 2822

Today's topics:
        [Out Of Topic] Perl opening Buenos Aires Argentina <diegompg@gmail.com>
    Re: [Out Of Topic] Perl opening Buenos Aires Argentina <uri@StemSystems.com>
    Re: a defense of ad hoc software development <rNOSPAMon@flownet.com>
    Re: a defense of ad hoc software development <hjp-usenet2@hjp.at>
    Re: a defense of ad hoc software development <hjp-usenet2@hjp.at>
    Re: a defense of ad hoc software development <rNOSPAMon@flownet.com>
    Re: Anyone willing to modify 3rd party perl code? <hjp-usenet2@hjp.at>
    Re: Anyone willing to modify 3rd party perl code? <buck@private.mil>
    Re: Anyone willing to modify 3rd party perl code? <buck@private.mil>
    Re: Anyone willing to modify 3rd party perl code? <uri@StemSystems.com>
    Re: Anyone willing to modify 3rd party perl code? <uri@StemSystems.com>
    Re: Anyone willing to modify 3rd party perl code? <tadmc@seesig.invalid>
    Re: moving applications to Windows, database and all <email@invalid.net>
    Re: readdir: is there a way to reset cursor to beginnin (Randal L. Schwartz)
    Re: readdir: is there a way to reset cursor to beginnin <uri@StemSystems.com>
        utf8, length and syswrite are killing me <alexander.farber@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 17 Feb 2010 06:30:02 -0800 (PST)
From: dmp <diegompg@gmail.com>
Subject: [Out Of Topic] Perl opening Buenos Aires Argentina
Message-Id: <8df8a561-2292-452a-b1fc-3bd32c2a2cdb@v20g2000yqv.googlegroups.com>

Hola, esta posici=F3n es para Buenos Aires, Argentina (Capital, micro
centro)

Mi empresa esta en la busqueda de programadores Seniors de Perl que
hable ingl=E9s.
A continuaci=F3n les detallo los requisitos y aquellos que deseen
aplicar, por favor env=EDen su CV a mi cuenta personal
diegompg@gmail.com para ser presentado en RRHH.

Detalles:

PERL PROGRAMMER
WCT

Senior Software Developer

Position Description:
Travelocity is the most popular travel service on the web. Global
teams of employees work together to connect people with the worlds
greatest travel possibilities through airline reservations, hotel
rooms, cruises, vacation packages, car rentals, last-minute deals, as
well as other related products and services.

We are looking for a Software Developer responsible for designing/
developing high-transaction volume web applications. The ideal
candidate will have significant experience designing web applications
using Perl/Mod Perl in a UNIX environment.
Travelocity offers an excellent growth environment and ample
opportunity to work with organizations and software development teams
in different cities and time zones.

Accountabilities/Duties

Must be able to write software based on high-level requirements
Must be able to work independently with little or no supervision at
times and work in a managed team environment other times.
Ability to adapt to changing priorities.

Required Skills and Experience:

At least 2 years experience developing web applications in a Unix/
Linux environment.
2+ years hands-on programming using Perl, a nice-to-have includes at
least 1 year working with mod_perl + Apache .
Experience in web application security
2+ years hands-on experience in database programming, a nice-to-have
includes at least 1 year in MySQL
Experience with control version systems such as CVS, SVN or Git
Good English communication skills, written and verbal
Experience in network programming is a nice-to-have
Experience with Agile Methodologies is a nice-to-have

Education:

A Bachelor of Science in Computer Science or equivalent experience.


Desde ya muchas Gracias,

dmp
http://ar.linkedin.com/in/diegompg


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

Date: Wed, 17 Feb 2010 12:48:53 -0500
From: "Uri Guttman" <uri@StemSystems.com>
To: dmp <diegompg@gmail.com>
Subject: Re: [Out Of Topic] Perl opening Buenos Aires Argentina
Message-Id: <87eikjycqi.fsf@quad.sysarch.com>


this group is not for perl jobs. goto jobs.perl.org and post it there.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Wed, 17 Feb 2010 08:52:17 -0800
From: Ron Garret <rNOSPAMon@flownet.com>
Subject: Re: a defense of ad hoc software development
Message-Id: <rNOSPAMon-2A8579.08514717022010@news.albasani.net>

In article 
<b0ab1308-1e6f-4a16-82b4-41a96399fa23@m37g2000yqf.googlegroups.com>,
 Alessio Stalla <alessiostalla@gmail.com> wrote:

> On Feb 17, 8:21 am, Ron Garret <rNOSPA...@flownet.com> wrote:
> > In article
> > <2f580d01-8f4c-4c08-a6a6-8fc84dd46...@15g2000yqa.googlegroups.com>,
> >  Mark Tarver <dr.mtar...@ukonline.co.uk> wrote:
> >
> > > QUOTE
> > > You can't write specifications that say exactly what you want. If the
> > > specification were that precise, then they would be the program.
> > > UNQUOTE
> >
> > > That's a very clever and profound observation from Paul Graham.
> >
> > It is also demonstrably false.
> >
> > > The formal methods people might disagree though.
> >
> > The formal methods people are also wrong, but for different reasons.
> >
> > > I think the obvious counterexample comes from constructive type
> > > theory, where the specification is a type designed to determine the
> > > program.  But the specification is nevertheless not itself a program.
> > > The program emerges as a byproduct of an attempt to prove that the
> > > specification can be met (that the type is inhabited).  That's not the
> > > end of the argument; its just pawn to e4, pawn to e5 in this debate.
> >
> > You don't have to get anywhere near that esoteric.  There are many
> > precise specifications that are nonetheless very hard or impossible to
> > render into code, the classic example being F(X,Y)=TRUE if and only if X
> > is the encoding of a program that halts when run on input Y.  Imprecise
> > specifications are only one of many potential challenges to producing
> > code that does what you want.  Inverting SHA1, factoring RSA1024, and
> > decrypting AES256 are all specifications that can be rendered with
> > absolute precision.  But that will not help you at all when it comes
> > time to code them up.
> 
> Those are all *requirements* specifications, i.e. *what* the program
> should do. Like the OP, I don't think PG is talking about
> requirements, but rather about design specifications (e.g. UML
> diagrams and the like) - that is, about a high-level description of
> *how* the program should work. With that in mind, I agree 100% with
> Paul Graham.

Ah.  Yes, going back and looking at the context it seems you're right.  
The phrase "what you want" is a bit misleading out of context.

> That said, high-level descriptions of a program can still have a
> useful role for documentation purposes, that is, if they are
> synthesized from the program (and not vice-versa as software
> engineering adepts believe).

No, I don't think so.  My point was that there's an unbridgeable gulf 
between "what" and "how".  You can't go back and forth between them 
automatically in either direction (except in trivial ways like 
extracting function signatures).

rg


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

Date: Wed, 17 Feb 2010 18:17:09 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: a defense of ad hoc software development
Message-Id: <slrnhno94r.num.hjp-usenet2@hrunkner.hjp.at>

On 2010-02-16 22:00, dan@telent.net <dan@telent.net> wrote:
> Mark Tarver <dr.mtarver@ukonline.co.uk> writes:
>
>> QUOTE
>> You can't write specifications that say exactly what you want. If the
>> specification were that precise, then they would be the program.
>> UNQUOTE
>>
>> That's a very clever and profound observation from Paul Graham. The
>> formal methods people might disagree though.
>
> So would I.
>
> I would like a program that calculates the number x for which x*x=52
>
> That specification says exactly what I want,

No. Most importantly it doen't say what the output should look like.
Mathematically, the result is 2*sqrt(13). But most likely you don't want
a symbolic result, but a floating point number with some number of
(binary or decimal) digits.

> but it's of no help at all in creating an algorithm for how to get it.

It is if your programming language includes a primitive or library
function for solving quadratic equations.

I would like to change one word in PG's quip:

You can't write specifications that say exactly what you want. If the
specification were that precise, then they would be *a* program.

If the specification doesn't say how to solve a small, well-understood
subproblem, that's not very much different from calling a library
function in a program. As a different example, consider sorting: The
specification may specify the intended sort order but not the sorting
algorithm. In a similar way, many programming languages provide a sort
function. The programmer using this function typically doesn't care
whether that sort function implements a quickersort, heapsort or
mergesort, or some hybrid scheme. He just specifies an order (often in
the form of a comparison function) and leaves the details to the
implementation.

The more I think about this the more I think PG has stumbled upon a
truth here: A specification really is a program. But the "programming
language" in which it is written is almost always declarative and not 
imperative. There usually isn't any interpreter for the language except
the brains of the audience (although parts of the specification/program
may be written in a formal language).

	hp



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

Date: Wed, 17 Feb 2010 18:31:30 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: a defense of ad hoc software development
Message-Id: <slrnhno9vj.num.hjp-usenet2@hrunkner.hjp.at>

On 2010-02-17 07:21, Ron Garret <rNOSPAMon@flownet.com> wrote:
> In article 
><2f580d01-8f4c-4c08-a6a6-8fc84dd4658e@15g2000yqa.googlegroups.com>,
>  Mark Tarver <dr.mtarver@ukonline.co.uk> wrote:
>> QUOTE
>> You can't write specifications that say exactly what you want. If the
>> specification were that precise, then they would be the program.
>> UNQUOTE
>> 
>> That's a very clever and profound observation from Paul Graham.
>
> It is also demonstrably false.
[...]
> You don't have to get anywhere near that esoteric.  There are many 
> precise specifications that are nonetheless very hard or impossible to 
> render into code, the classic example being F(X,Y)=TRUE if and only if X 
> is the encoding of a program that halts when run on input Y.  Imprecise 
> specifications are only one of many potential challenges to producing 
> code that does what you want.  Inverting SHA1, factoring RSA1024, and 
> decrypting AES256 are all specifications that can be rendered with 
> absolute precision.

They can also be coded almost as easily as specified. The program just
won't complete in any reasonable time.

> But that will not help you at all when it comes time to code them up.

That's because you don't want just any code which solves the problem,
you want fast code which solves it. And while it is easy to write into
the specification "must finish within X seconds" it may be hard to find
code which satisifies this constraint.

IMHO that fits well with comment in the other posting: The specification
is *a* program, but it is not *the* program, because even if a suitable
interpreter exists (or translation into an existing programming language
is straightforward) it would often be ridiculously inefficient.

	hp



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

Date: Wed, 17 Feb 2010 11:28:09 -0800
From: Ron Garret <rNOSPAMon@flownet.com>
Subject: Re: a defense of ad hoc software development
Message-Id: <rNOSPAMon-9366A4.11273917022010@news.albasani.net>

In article <slrnhno94r.num.hjp-usenet2@hrunkner.hjp.at>,
 "Peter J. Holzer" <hjp-usenet2@hjp.at> wrote:

> On 2010-02-16 22:00, dan@telent.net <dan@telent.net> wrote:
> > Mark Tarver <dr.mtarver@ukonline.co.uk> writes:
> >
> >> QUOTE
> >> You can't write specifications that say exactly what you want. If the
> >> specification were that precise, then they would be the program.
> >> UNQUOTE
> >>
> >> That's a very clever and profound observation from Paul Graham. The
> >> formal methods people might disagree though.
> >
> > So would I.
> >
> > I would like a program that calculates the number x for which x*x=52
> >
> > That specification says exactly what I want,
> 
> No. Most importantly it doen't say what the output should look like.
> Mathematically, the result is 2*sqrt(13). But most likely you don't want
> a symbolic result, but a floating point number with some number of
> (binary or decimal) digits.
> 
> > but it's of no help at all in creating an algorithm for how to get it.
> 
> It is if your programming language includes a primitive or library
> function for solving quadratic equations.
> 
> I would like to change one word in PG's quip:
> 
> You can't write specifications that say exactly what you want. If the
> specification were that precise, then they would be *a* program.
>
> If the specification doesn't say how to solve a small, well-understood
> subproblem, that's not very much different from calling a library
> function in a program. As a different example, consider sorting: The
> specification may specify the intended sort order but not the sorting
> algorithm. In a similar way, many programming languages provide a sort
> function. The programmer using this function typically doesn't care
> whether that sort function implements a quickersort, heapsort or
> mergesort, or some hybrid scheme. He just specifies an order (often in
> the form of a comparison function) and leaves the details to the
> implementation.
> 
> The more I think about this the more I think PG has stumbled upon a
> truth here: A specification really is a program. But the "programming
> language" in which it is written is almost always declarative and not 
> imperative. There usually isn't any interpreter for the language except
> the brains of the audience (although parts of the specification/program
> may be written in a formal language).

Ironically, it's PG's own lack of precision in specifying what he meant 
that is leading to confusion here.

There are two fundamentally different kinds of specifications, those 
that specify WHAT the result should be, and those that specify HOW the 
result is to be obtained.  Both of these can be either vague or 
specific.  Notwithstanding PG's use of the phrase "what you want" it 
appears that he was actually talking about specifying how, not what.

(This distinction is not unique to software.  PG's own example of a 
piece of metal cut to a particular shape is a HOW specification.  A WHAT 
specification would be something like: a bracket with a particular 
tensile strength...)

The issue PG was addressing (and that this thread seems to be about) is 
the perennial debate about how specific a HOW spec should be before you 
make your first attempt to render it into a form that is suitable as 
input to a compiler.  The right answer has a lot to do with how 
expensive it is to run your compiler.  If compilation is expensive it 
makes sense to put more effort into making sure you've thought things 
through before you try to compile.  If compilation (and more to the 
point, recompilation) is cheap then it makes less sense.

Then there is the completely orthogonal issue of how to render WHAT 
specs into HOW specs, which is a fundamentally difficult problem.  It 
has to be.  If it weren't you could just take the following WHAT spec:

* A program that takes a WHAT spec and renders it as a HOW spec

and render *that* as a how spec and you'd never again have to write any 
code.

In fact, just *writing down* a WHAT spec (let alone finding a 
corresponding HOW spec) is a fundamentally difficult problem.  You want 
a program to compute the square root of 52?  What does that actually 
mean?  What form do you want the answer to take?  Symbolic?  Floating 
point?  BCD?  A drawing of the diagonal of a square with an area of 52?  
How long are you willing to wait for your answer?  How many digits of 
precision do you want?  How much are you willing to pay?

rg

---
Ron's second law: the hardest part of getting what you want is deciding 
what you actually want.


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

Date: Wed, 17 Feb 2010 15:13:27 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Anyone willing to modify 3rd party perl code?
Message-Id: <slrnhnnuc7.num.hjp-usenet2@hrunkner.hjp.at>

On 2010-02-16 20:20, buck <buck@private.mil> wrote:
> I have a perl script written by Christian Mock obtained from 
> http://www.tahina.priv.at/~cm/spam/ .  The purpose of this code is to 
> ask SMTP servers not already whitelisted in greylist,sqlite DB to wait a 
> while and then retry sending to my Postfix SMTP server (selective SPAM 
> control).  The script does not work as I'd like, so I'd like for it to 
> be thoroughly commented and modified so that it does what I want.  I am 
> not capable of doing that.

I would assume that Christian is willing to adapt the script to your
needs at his usual hourly rate. You can find his company at
http://www.coretec.at/.

	hp



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

Date: 17 Feb 2010 17:38:11 GMT
From: buck <buck@private.mil>
Subject: Re: Anyone willing to modify 3rd party perl code?
Message-Id: <hlh9i30c69@news6.newsguy.com>

RedGrittyBrick <RedGrittyBrick@spamweary.invalid> wrote in news:4b7bc811
$0$2525$da0feed9@news.zen.co.uk:

> You didn't say how much you are willing to pay someone to do this work 
> for you. I assume zero.

You are presuming something not true.  I don't make an offer because I 
expect someone to read the comments in the file and suggest to me the 
amount of time and a rate.  That's the kind of person I want to deal 
with.
--
buck


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

Date: 17 Feb 2010 17:46:34 GMT
From: buck <buck@private.mil>
Subject: Re: Anyone willing to modify 3rd party perl code?
Message-Id: <hlha1q1c69@news6.newsguy.com>

"Peter J. Holzer" <hjp-usenet2@hjp.at> wrote in
news:slrnhnnuc7.num.hjp-usenet2@hrunkner.hjp.at: 

> I would assume that Christian is willing to adapt the script to your
> needs at his usual hourly rate. You can find his company at
> http://www.coretec.at/.
> 
>      hp
Assuming makes you an ass.  Had you bothered to navigate to Mock's web 
site, you might have another thought - if you are capable of thought.
--
buck


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

Date: Wed, 17 Feb 2010 12:48:06 -0500
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: Anyone willing to modify 3rd party perl code?
Message-Id: <87iq9vycrt.fsf@quad.sysarch.com>

>>>>> "b" == buck  <buck@private.mil> writes:

  b> RedGrittyBrick <RedGrittyBrick@spamweary.invalid> wrote in news:4b7bc811
  b> $0$2525$da0feed9@news.zen.co.uk:

  >> You didn't say how much you are willing to pay someone to do this work 
  >> for you. I assume zero.

  b> You are presuming something not true.  I don't make an offer because I 
  b> expect someone to read the comments in the file and suggest to me the 
  b> amount of time and a rate.  That's the kind of person I want to deal 
  b> with.

then you are in the wrong place. the guidelines here say no jobs
posting. go to jobs.perl.org if you want to hire a perl hacker. your
original post didn't specify if you wanted to pay or get free work. that
was a no-no too.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Wed, 17 Feb 2010 13:12:13 -0500
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: Anyone willing to modify 3rd party perl code?
Message-Id: <87zl37wx36.fsf@quad.sysarch.com>

>>>>> "b" == buck  <buck@private.mil> writes:

  b> "Peter J. Holzer" <hjp-usenet2@hjp.at> wrote in
  b> news:slrnhnnuc7.num.hjp-usenet2@hrunkner.hjp.at: 

  >> I would assume that Christian is willing to adapt the script to your
  >> needs at his usual hourly rate. You can find his company at
  >> http://www.coretec.at/.
  >> 
  >> hp

  b> Assuming makes you an ass.  Had you bothered to navigate to Mock's web 
  b> site, you might have another thought - if you are capable of thought.

oh, calling someone an ass in public makes you an ass! how do you like
them apples? you made the first mistake by posting a job here. the
second mistake was not even claiming you would pay for it. now you
compound it with an immediate asshat move. a triple play! now please go
away and hire someone. but not here.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Wed, 17 Feb 2010 14:44:12 -0600
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Anyone willing to modify 3rd party perl code?
Message-Id: <slrnhnol20.pbh.tadmc@tadbox.sbcglobal.net>

buck <buck@private.mil> wrote:
> "Peter J. Holzer" <hjp-usenet2@hjp.at> wrote in
> news:slrnhnnuc7.num.hjp-usenet2@hrunkner.hjp.at: 
>
>> I would assume that Christian is willing to adapt the script to your
>> needs at his usual hourly rate. You can find his company at
>> http://www.coretec.at/.


> Assuming makes you an ass.


I can easily tell who is the ass here.

Off to eternal invisibility with you!


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"


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

Date: Wed, 17 Feb 2010 16:01:50 GMT
From: QoS <email@invalid.net>
Subject: Re: moving applications to Windows, database and all
Message-Id: <OpUen.74967$RS6.11891@newsfe15.iad>


ccc31807 <cartercc@gmail.com> wrote in message-id:  <51cf235a-9402-4ef2-8fca-0114f9648e3d@l19g2000yqb.googlegroups.com>

> 
> Several years ago, I wrote a web interface to a database using Linux,
> Apache, Postgres, and Perl. It has proven useful several times, and as
> a result I have moved the application to new Linux machines. It's not
> too difficult to do by hand: create a new user and tar the content of
> the old home directory to the new one, create a sym link in the
> document root pointing to the web content, configure httpd.conf and
> start Apache, import the schema into the database and start the
> database server, and it's done.
> 
> Recently I've had the experience of moving the application to a
> Windows server (using Apache and MySQL) it it was difficult enough for
> me to wish for some kind of installer file. I have to actually install
> Apache and MySQL on the server since they don't come natively with
> Windows Since I anticipate having to do this again in the near future,
> I'm wondering how I could create an automated solution to install and
> configure Apache and MySQL, copy the files, and do the configuration
> in one step.
> 
> Is this possible with Perl?
> 
> Also, this is beginning to be a commercial enterprise (i.e., I will
> charge for the application) so does this have any implications for
> MySQL?
> 
> Thanks, CC.

apachefriends.org has a installer like this; check out XAMPP.




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

Date: Wed, 17 Feb 2010 09:44:16 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: readdir: is there a way to reset cursor to beginning?
Message-Id: <863a0zhi4v.fsf@blue.stonehenge.com>

>>>>> "Uri" == Uri Guttman <uri@StemSystems.com> writes:

Uri> i hate all the duplicate pushes. try this on for size (untested :):

Uri> use File::Slurp ;
Uri> push( @{ -d "$folder/$_" ? \@folders : \@files }, $_ ) for read_dir( 'C:' );

Uri> that assumes if it ain't a dir, it is a file.

OP said he was working through "Learning Perl".  Probably hasn't
gotten to references yet, so you just blew his test score. :)

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/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


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

Date: Wed, 17 Feb 2010 13:10:28 -0500
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: readdir: is there a way to reset cursor to beginning?
Message-Id: <874olfybqj.fsf@quad.sysarch.com>

>>>>> "RLS" == Randal L Schwartz <merlyn@stonehenge.com> writes:

>>>>> "Uri" == Uri Guttman <uri@StemSystems.com> writes:
  Uri> i hate all the duplicate pushes. try this on for size (untested :):

  Uri> use File::Slurp ;
  Uri> push( @{ -d "$folder/$_" ? \@folders : \@files }, $_ ) for read_dir( 'C:' );

  Uri> that assumes if it ain't a dir, it is a file.

  RLS> OP said he was working through "Learning Perl".  Probably hasn't
  RLS> gotten to references yet, so you just blew his test score. :)

well, you may have missed my smiley before the code. that wasn't
intended as a real useful answer. but the technique of selecting what
array to push onto is useful occaisionally.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Wed, 17 Feb 2010 10:28:59 -0800 (PST)
From: "A. Farber" <alexander.farber@gmail.com>
Subject: utf8, length and syswrite are killing me
Message-Id: <378cff6e-33f1-4961-b986-807c4e5a2ae2@36g2000yqu.googlegroups.com>

Hello,

I have a russian card game at
http://apps.facebook.com/video-preferans/
which I've recently moved from using urlencoded data
to XML data in UTF-8. Since then it often hangs
for the users and I suspect, that my subroutine:

sub enqueue {
        my $child    = shift;
        my $data     = shift;
        my $fh       = $child->{FH};
        my $response = $child->{RESPONSE};

        # flash.net.Socket.readUTF() expects 16-bit prefix in network
order
        my $prefix   = pack 'n', length $data;

        # append to the end of the outgoing queue
        push @{$response}, $prefix . $data;
}

packs wrong number of bytes for cyrillic messages.

I'm using perl v5.10.0 at OpenBSD 4.5 and
"perldoc -tf length" suggests using
length(Encoding::encode_utf8(EXPR))

But when I put the line:

use Encode::Encoding;
 ...
        my $prefix   = pack 'n', length(Encoding::encode_utf8($data));

then it borks with

Undefined subroutine &Encoding::encode_utf8 called at Child.pm line
229.

Any help please?

Also I have to mention, that when users chat
in Russian, my server just passes their cyrillic
messages around (with sysread - poll - syswrite).

But for their cyrillic words in my program (I "use utf8;")
I have to call  utf8::encode($cyrillic_word) before I can
write it away with syswrite or it would die ("wide char").

I've tried moving utf8::encode($data) into the
enqueue subroutine above but it doesn' allow me
(maybe because parts of $data are not utf8??)

Regards
Alex





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

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:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 2822
***************************************


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