[30345] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1588 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 29 14:09:46 2008

Date: Thu, 29 May 2008 11:09:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 29 May 2008     Volume: 11 Number: 1588

Today's topics:
    Re: Maximize LWP https performance xhoster@gmail.com
    Re: Need help with a simple (I think) Perl script <rsutton43@comcast.net>
    Re: Need help with a simple (I think) Perl script <rsutton43@comcast.net>
    Re: Need help with a simple (I think) Perl script <1usa@llenroc.ude.invalid>
    Re: Need help with a simple (I think) Perl script <uri@stemsystems.com>
    Re: Need help with a simple (I think) Perl script <1usa@llenroc.ude.invalid>
    Re: Need help with a simple (I think) Perl script <ben@morrow.me.uk>
    Re: Need help with a simple (I think) Perl script <szrRE@szromanMO.comVE>
    Re: Need help with a simple (I think) Perl script <rsutton43@comcast.net>
    Re: Need help with a simple (I think) Perl script <yankeeinexile@gmail.com>
    Re: Need help with a simple (I think) Perl script <simon.chao@fmr.com>
    Re: Perl vs. Php xhoster@gmail.com
    Re: Remove a tab with backspace? <szrRE@szromanMO.comVE>
    Re: Remove a tab with backspace? <simon.chao@fmr.com>
    Re: Remove a tab with backspace? <RedGrittyBrick@SpamWeary.foo>
    Re: Remove a tab with backspace? <achimpeters@gmx.de>
    Re: The telnet login fails if the user has no password <glex_no-spam@qwest-spam-no.invalid>
    Re: Turning a dir output into a webpage ?? <glex_no-spam@qwest-spam-no.invalid>
    Re: Variable remaining undef in one place but not anoth <justin.0805@purestblue.com>
    Re: Variable remaining undef in one place but not anoth <1usa@llenroc.ude.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 29 May 2008 17:44:37 GMT
From: xhoster@gmail.com
Subject: Re: Maximize LWP https performance
Message-Id: <20080529134439.063$5B@newsreader.com>

Daniel Parry <ddp23@cam.ac.uk> wrote:
> Hello,
>
> I am attempting to load test an https web application using a
> custom perl application. The order of requests made to the web
> application is important so I can't just fire off all the requests
> in parallel a la LWP::Parallel. So, my latest approach has been to
> fork multiple times to achieve parallelism, with each fork
> simulating a web application user. Via this technique I achieve a
> sustained rate of about 12 requests / second which I feel, perhaps
> incorrectly(?), that I should be able to improve upon.
>
> I notice that some of the requests take an unusually long time to
> complete. Seemingly unrelated to the web application server
> responsiveness.

What is the "seemingly unrelated" conclusion based on?

> Thus, I have two theories:
>
> 1) Contention over use of network. Requests are getting stacked up
> at the mercy of the network scheduler.
>
> I'm not entirely sure of a good way of confirming or disproving
> this?

Make a dummy web application that does nothing but serve static files.
For example, go through the web app, saving the response for each request.
Then copy these responses to web server and make your client requests these
static files rather than doing actual dynamic requests.  If your network is
the problem (unlikely, I suspect), you will not see much improvement.  If
it isn't the problem, you should see a big improvement.

> It may be that splitting the execution across multiple hosts
> is a way forward but I'd like to maximize performance on a single
> host first before duplicating it across additional hosts...
>
> 2) SSL connection is biting.

Change your app to allow non-SSL connections, then run the benchmark again
that way and see if it speeds up.

>
> Profiling a single process (no forking) suggests to me that a fair
> bit of time is spent dealing with SSL connections.

You seem to be profiling the client program, not the web-app server
programs, right?

>
> %Time ExclSec CumulS #Calls sec/call Csec/c  Name
>  78.0   1.970  1.970    180   0.0109 0.0109  Crypt::SSLeay::Conn::connect
>  8.16   0.206  0.206 114428   0.0000 0.0000  HTTP::Headers::_header
>  6.81   0.172  0.358  15674   0.0000 0.0000  Net::SSL::read
>  5.31   0.134  0.134  15674   0.0000 0.0000  Crypt::SSLeay::Conn::read
>  4.32   0.109  0.143   1854   0.0001 0.0001  HTML::Parser::parse

Was this generated with dprofpp, dprofpp -r, or dprofpp -u, or something
else?

What was the header from the profile?, e.g.
               Total Elapsed Time =    1.67 Seconds
                        User Time =    0.61 Seconds



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: Thu, 29 May 2008 10:16:22 -0400
From: "Dick Sutton" <rsutton43@comcast.net>
Subject: Re: Need help with a simple (I think) Perl script
Message-Id: <VJGdnfQNL-nbJ6PVnZ2dnUVZ_jidnZ2d@comcast.com>


"Dick Sutton" <rsutton43@comcast.net> wrote in message 
news:m4OdnZttx5K6gaPVnZ2dnUVZ_qfinZ2d@comcast.com...
> First of all, I am a rank amateur at Perl.  Here is my problem: I have a
> hundred or more files in a directory on a web server (let's call it
> 'Library').  Each file is a pdf file and is named 'yyyymmm.pdf'  where 
> yyyy
> is the year (i.e. 2007) and mmm is the first 3 letters of the month (i.e.
> Jan). So a typical file name looks like '2007Jan.pdf'.
>
> I wrote a simple html page using FORM that allows the user to select the
> year and the month and then press the SUBMIT button and I want the
> respective pdf file returned into the users browser.  The problem is, I
> don't know how to return a pdf file to the browser.
>
> Here's what I have so far:
>
> #!/usr/local/bin/perl -wT
> use strict;
> use CGI ':standard';
>
> # declare variables...
> my $year;
> my $month;
> my $pdffile;
>
> # get the parameters...
> $year = param('Year');
> $month = param('Month');
>
> # construct the relative pathname to the actual PDF file
> $pdffile = '../Library/'.$Year.$Month.'.pdf';
>
> print 'Content-type: application/pdf\n\n';
>
> This is where I'm stuck.  Can someone push me in the right direction.  I
> would think it should be trivial.  I just don't know how to procede.
>
> Thanks in advance...
>
> Dick
>

Awsome feedback!  Thanks to everyone who responded.  I'm going to try each 
suggestion and then I'll try to figure out what
each line does. ha-ha.  I told you I was a novice Perl scripter.  Many 
thanks, again...

Dick



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

Date: Thu, 29 May 2008 10:22:21 -0400
From: "Dick Sutton" <rsutton43@comcast.net>
Subject: Re: Need help with a simple (I think) Perl script
Message-Id: <x_2dncA2RMgwJqPVnZ2dnUVZ_tPinZ2d@comcast.com>

>Also you should check
>that the  $year and $month are valid entries on the off chance that
>someone tries to feed the script bogus or empty values.
>
>Bill H

Thanks for the reply, Bill H.

I have taken care of the validation aspect by using the drop-down list 
approach in html (i.e. <select> & <option> stuff).  I am going to look into 
your suggestion that I 'hide' the servor directory as much as possible. 
Good advice.

Thanks again...

Dick



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

Date: Thu, 29 May 2008 14:45:23 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Need help with a simple (I think) Perl script
Message-Id: <Xns9AAD6D6A18FB0asu1cornelledu@127.0.0.1>

"Dick Sutton" <rsutton43@comcast.net> wrote in
news:x_2dncA2RMgwJqPVnZ2dnUVZ_tPinZ2d@comcast.com: 

>>Also you should check
>>that the  $year and $month are valid entries on the off chance that
>>someone tries to feed the script bogus or empty values.
>>
>>Bill H
> 
> Thanks for the reply, Bill H.
> 
> I have taken care of the validation aspect by using the drop-down list
> approach in html (i.e. <select> & <option> stuff).

In that case, you have a lot to learn about security. That does not 
restict in any way shape or form the values that can be submitted.

What you need to do is simple: Figure out the validity requirements for 
every parameter that will be passed to the server side script and check 
for those requirements on the server side.

> I am going to look
> into your suggestion that I 'hide' the servor directory as much as
> possible. Good advice.

Whatever that means.

perldoc perlsec

http://www.w3.org/Security/Faq/wwwsf4.html

You should not type another character of code until you know what you 
are dealing with.

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://www.rehabitation.com/clpmisc/


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

Date: Thu, 29 May 2008 14:45:27 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Need help with a simple (I think) Perl script
Message-Id: <x71w3lmanr.fsf@mail.sysarch.com>

>>>>> "FS" == Frank Seitz <devnull4711@web.de> writes:

  FS> Uri Guttman wrote:
  >>>>>>> "FS" == Frank Seitz <devnull4711@web.de> writes:

  FS> open my $fh,'<',$pdffile or die $!;
  FS> print <$fh>;
  >> 
  >> use File::Slurp ;
  >> print read_file( $pdffile ) ;

  FS> There is one disadvantage: File::Slurp is not in the core.

but many use it anyway. the not in core module excuse is weak as is the
"i can't install/use cpan" excuse.

uri

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


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

Date: Thu, 29 May 2008 15:06:16 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Need help with a simple (I think) Perl script
Message-Id: <Xns9AAD70F472FDCasu1cornelledu@127.0.0.1>

"Dick Sutton" <rsutton43@comcast.net> wrote in
news:m4OdnZttx5K6gaPVnZ2dnUVZ_qfinZ2d@comcast.com: 

> First of all, I am a rank amateur at Perl.  Here is my problem: I have
> a hundred or more files in a directory on a web server (let's call it
> 'Library').  Each file is a pdf file and is named 'yyyymmm.pdf'  where
> yyyy is the year (i.e. 2007) and mmm is the first 3 letters of the
> month (i.e. Jan). So a typical file name looks like '2007Jan.pdf'.
> 
> I wrote a simple html page using FORM that allows the user to select
> the year and the month and then press the SUBMIT button and I want the
> respective pdf file returned into the users browser.  The problem is,
> I don't know how to return a pdf file to the browser.
> 
> Here's what I have so far:
> 
> #!/usr/local/bin/perl -wT
> use strict;
> use CGI ':standard';
> 
> # declare variables...

There is no need to declare variables in a separate visual area. Declare 
them in the smallest possible scope and as close to first use as 
possible.


> my $year;
> my $month;
> my $pdffile;
> 
> # get the parameters...
> $year = param('Year');

#!/usr/bin/perl

use strict;
use warnings;

use CGI qw( :standard );

use constant FIRST_YEAR => 1978;
use constant THIS_YEAR  => 1900 + (localtime)[5];

my $year;

if ( param('Year') =~ /^(\d{4})$/
        and $1 >= FIRST_YEAR 
        and $1 <= THIS_YEAR 
) {
    $year = $1;
}

die 'Invalid year' unless defined $year;

# validate some more ...

> $month = param('Month');

my $month;
if ( param('Month') =~ /^(\d{2})$/
        and $1 >= 1
        and $1 <= 12
) {
    $month = $1;
}

die 'Invalid month' unless defined $month;


> # construct the relative pathname to the actual PDF file
> $pdffile = '../Library/'.$Year.$Month.'.pdf';

You should use File::Spec->catfile.

In your original script, you did not validate $Year and $Month. ... Wait 
a second!!! There is no $Year or $Month variable in your original 
script. It turns out not only are you incompetent but you are also a 
liar. You did not have use strict originally, right? You just added that 
as a cosmetic touch.

> print 'Content-type: application/pdf\n\n';

First of all, you are using single-quotes above, so the \n sequence does 
not really do what you think it does.

Second, you are already using CGI.pm. Why not use it already?

print header('application/pdf');

> This is where I'm stuck.  Can someone push me in the right direction. 

First requirement is a change of attitude. Take programming seriously. 
Don't lie. Make sure you read the posting guidelines and you have a 
minimal but complete script before you post.

> I would think it should be trivial.

Well, it ain't trivial if you can't do it, right? Or, are you saying you 
are just too dim?

> I just don't know how to procede.

Therefore, it ain't trivial.
 
> Thanks in advance...

Just confirming my bias against people who thank in advance.
 
> Dick

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://www.rehabitation.com/clpmisc/


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

Date: Thu, 29 May 2008 16:44:51 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Need help with a simple (I think) Perl script
Message-Id: <jkv2h5-ui4.ln1@osiris.mauzo.dyndns.org>


Quoth "A. Sinan Unur" <1usa@llenroc.ude.invalid>:
> 
> #!/usr/bin/perl

You forgot -T.

> my $year;
> 
> if ( param('Year') =~ /^(\d{4})$/
>         and $1 >= FIRST_YEAR 
>         and $1 <= THIS_YEAR 
> ) {
>     $year = $1;
> }
> 
> die 'Invalid year' unless defined $year;

my ($year) = param('Year') =~ /^(\d{4})$/
    and $1 >= FIRST_YEAR
    and $1 <= THIS_YEAR
    or die 'Invalid year';

etc.

> > # construct the relative pathname to the actual PDF file
> > $pdffile = '../Library/'.$Year.$Month.'.pdf';
> 
> You should use File::Spec->catfile.

And ->updir, if you're going to do that. IMHO when the paths are that
system-specific there's no harm in creating them directly, especially
given how hard it is to *actually* produce portable paths with
File::Spec (most people completely fail to handle volumes correctly).

Ben

-- 
               We do not stop playing because we grow old; 
                  we grow old because we stop playing.
                            ben@morrow.me.uk


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

Date: Thu, 29 May 2008 08:59:14 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: Need help with a simple (I think) Perl script
Message-Id: <g1mjsj0111s@news4.newsguy.com>

Uri Guttman wrote:
>>>>>> "FS" == Frank Seitz <devnull4711@web.de> writes:
>
>> Uri Guttman wrote:
>  >>>>>>> "FS" == Frank Seitz <devnull4711@web.de> writes:
>
>> open my $fh,'<',$pdffile or die $!;
>> print <$fh>;
>  >>
>  >> use File::Slurp ;
>  >> print read_file( $pdffile ) ;
>
>> There is one disadvantage: File::Slurp is not in the core.
>
> but many use it anyway. the not in core module excuse is weak as is
> the "i can't install/use cpan" excuse.

It's not necessarily weak, but just a disadvantage. I think one should 
know how things like $/ and $\ work first (a basic working knowledge set 
of base things in Perl that is) and then find a module to make life 
easier, but you should still know how to do it without a module, and 
that's what Frank was doing.

-- 
szr 




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

Date: Thu, 29 May 2008 12:53:36 -0400
From: "Dick Sutton" <rsutton43@comcast.net>
Subject: Re: Need help with a simple (I think) Perl script
Message-Id: <Eeydnf5kyZO9QqPVnZ2dnUVZ_g6dnZ2d@comcast.com>


> In your original script, you did not validate $Year and $Month. ... Wait
> a second!!! There is no $Year or $Month variable in your original
> script. It turns out not only are you incompetent but you are also a
> liar. You did not have use strict originally, right? You just added that
> as a cosmetic touch.

Mr. A. Sinan Unur,

First of all, I did declare $Year and $Month in my original post.

# get the parameters...
$year = param('Year');
$month = param('Month');

Second of all, I do not appreciate being called a liar.  It is you who 
cannot read!  Lastly, it is YOU who has the 'attitude'.  And you say I'm 
'incompetent'.  I never said the script worked; I said I needed help.  You 
gave abuse.

I do not need help from such as you.

Dick 



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

Date: 29 May 2008 12:08:32 -0500
From: Lawrence Statton <yankeeinexile@gmail.com>
Subject: Re: Need help with a simple (I think) Perl script
Message-Id: <874p8hdomn.fsf@hummer.cluon.com>

"Dick Sutton" <rsutton43@comcast.net> writes:
> 
> First of all, I did declare $Year and $Month in my original post.
> 
No, you did not.

> # get the parameters...
> $year = param('Year');

Here you define $year.  Not $Year.


> $month = param('Month');

Ditto.

> I do not need help from such as you.

Welcome to the world of killfiles.

-- 
	Lawrence Statton - lawrenabae@abaluon.abaom s/aba/c/g
Computer  software  consists of  only  two  components: ones  and
zeros, in roughly equal proportions.   All that is required is to
place them into the correct order.


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

Date: Thu, 29 May 2008 10:12:36 -0700 (PDT)
From: nolo contendere <simon.chao@fmr.com>
Subject: Re: Need help with a simple (I think) Perl script
Message-Id: <334366ca-8e98-4214-a2c2-69da8c6196cc@m3g2000hsc.googlegroups.com>

On May 29, 12:53=A0pm, "Dick Sutton" <rsutto...@comcast.net> wrote:
> > In your original script, you did not validate $Year and $Month. ... Wait=

> > a second!!! There is no $Year or $Month variable in your original
> > script. It turns out not only are you incompetent but you are also a
> > liar. You did not have use strict originally, right? You just added that=

> > as a cosmetic touch.
>
> Mr. A. Sinan Unur,
>
> First of all, I did declare $Year and $Month in my original post.
>
> # get the parameters...
> $year =3D param('Year');
> $month =3D param('Month');

Sinan was pointing out (not the most diplomatically) that you never
declared $Year and $Month, which you did not. You did declare $year
and $month.
They are two completely different variables which happen to look
similar.


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

Date: 29 May 2008 17:58:45 GMT
From: xhoster@gmail.com
Subject: Re: Perl vs. Php
Message-Id: <20080529135846.882$Pq@newsreader.com>

Bill H <bill@ts1000.us> wrote:
> Preface: This is not a flame war, please don't turn it into one.
>
> I am involved in a very large project that  will be doing a lot of
> talking to Postgres databases (possibly using a a RST middleware).

I don't know what RST middleware is.  A quick google hasn't enlightened me.
If it is some kind of object-relational mapping, then it might be a pain to
use two different languages to access it.

> The
> database guys want to use php for all of their stuff, I want to use
> perl for mine.

What stuff is "your" stuff?  What do "database guys" do?  I mean, if they
just do back-up and tuning, who cares what language they use?  Is this one
of those pathological cases where the DBAs claim all the interesting things
to be in their domain and all the tedious things to be yours, while you are
claiming the opposite?

> The reasons I want to use perl are:
>
> 1) I have been working in it for 10+ years

Presumably they have been working in their favorite language for a while,
too.

> 2) I have 10's of thousands lines of code written (some very complex
> creating pdf's on the fly etc)

Are these very complex things going to part of the system you are now
working on?  Are they going to be the *main* part of it?


> Is there a valid reason I should switch to php versus perl (or vice
> versa they switch to perl)? Portability, ease of maintaining, speed of
> execution, security etc?

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: Thu, 29 May 2008 09:08:12 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: Remove a tab with backspace?
Message-Id: <g1mkdf011n1@news4.newsguy.com>

RedGrittyBrick wrote:
> bugbear wrote:
>> valerie.seigneur@googlemail.com wrote:
>>> Hi,
>>>
>>> I'd like to use "\b" to delete a tab character, but it doesn't seem
>>> to work. I've found several posts about the backspace character,
>>> but none about this particular problem.
>>>
>>> perl -e 'print "AB\bC\n";'
>>> works fine and prints "AC"
>>
>> No it doesn't. Try piping it to a hex dump program, or to a file,
>> and examine what you get.
>>
>
> Or try this
> $ perl -e 'print "12\b\n"'
> 12
>
> --
> RGB

Actually his example does print AC in my term, though yours does print 
12. I'm not sure I understand why yours doesn't print just 1 as one 
night think it would ?

-- 
szr 




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

Date: Thu, 29 May 2008 09:24:20 -0700 (PDT)
From: nolo contendere <simon.chao@fmr.com>
Subject: Re: Remove a tab with backspace?
Message-Id: <b6e297c3-22e9-4c98-8ae2-993f10b51e6e@k13g2000hse.googlegroups.com>

On May 29, 12:08=A0pm, "szr" <sz...@szromanMO.comVE> wrote:
> RedGrittyBrick wrote:
> > bugbear wrote:
> >> valerie.seign...@googlemail.com wrote:
> >>> Hi,
>
> >>> I'd like to use "\b" to delete a tab character, but it doesn't seem
> >>> to work. I've found several posts about the backspace character,
> >>> but none about this particular problem.
>
> >>> perl -e 'print "AB\bC\n";'
> >>> works fine and prints "AC"
>
> >> No it doesn't. Try piping it to a hex dump program, or to a file,
> >> and examine what you get.
>
> > Or try this
> > $ perl -e 'print "12\b\n"'
> > 12
>
> > --
> > RGB
>
> Actually his example does print AC in my term, though yours does print
> 12. I'm not sure I understand why yours doesn't print just 1 as one
> night think it would ?


$ perl -e 'print "12\b"'
1$



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

Date: Thu, 29 May 2008 17:45:58 +0100
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: Remove a tab with backspace?
Message-Id: <483eddca$0$10640$fa0fcedb@news.zen.co.uk>

nolo contendere wrote:
> On May 29, 12:08 pm, "szr" <sz...@szromanMO.comVE> wrote:
>> RedGrittyBrick wrote:
>>> bugbear wrote:
>>>> valerie.seign...@googlemail.com wrote:
>>>>> Hi,
>>>>> I'd like to use "\b" to delete a tab character, but it doesn't seem
>>>>> to work. I've found several posts about the backspace character,
>>>>> but none about this particular problem.
>>>>> perl -e 'print "AB\bC\n";'
>>>>> works fine and prints "AC"
>>>>
>>>> No it doesn't. Try piping it to a hex dump program, or to a file,
>>>> and examine what you get.
>>>
>>> Or try this
>>> $ perl -e 'print "12\b\n"'
>>> 12
>>> 
>> Actually his example does print AC in my term, though yours does print
>> 12. I'm not sure I understand why yours doesn't print just 1 as one
>> night think it would ?
> 
> $ perl -e 'print "12\b"'
> 1$
> 

C> perl -e "print qq(12\b)"
12

Basically it's a mistake to think that a backspace is guaranteed to be 
anything other than a cursor positioning command. Processing by the OS 
of characters sent to a console should differ from processing by OS of 
keyboard input. BS might be a "delete char left" in one case and "move 
cursor left one place" in the other. Apparently Windows and Unix/Linux 
differ in their handling of this slightly.

Embedding \b in a string is not a good way of "deleting" a prior char.

-- 
RGB


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

Date: Thu, 29 May 2008 19:08:20 +0200
From: Achim Peters <achimpeters@gmx.de>
Subject: Re: Remove a tab with backspace?
Message-Id: <483EE304.5090808@gmx.de>

RedGrittyBrick schrieb:
> nolo contendere wrote:
>> On May 29, 12:08 pm, "szr" <sz...@szromanMO.comVE> wrote:
>>> RedGrittyBrick wrote:
>>>> bugbear wrote:
>>>>> valerie.seign...@googlemail.com wrote:
>>>>>> Hi,
>>>>>> I'd like to use "\b" to delete a tab character, but it doesn't seem
>>>>>> to work. I've found several posts about the backspace character,
>>>>>> but none about this particular problem.
>>>>>> perl -e 'print "AB\bC\n";'
>>>>>> works fine and prints "AC"
>>>>>
>>>>> No it doesn't. Try piping it to a hex dump program, or to a file,
>>>>> and examine what you get.
>>>>
>>>> Or try this
>>>> $ perl -e 'print "12\b\n"'
>>>> 12
>>>>
>>> Actually his example does print AC in my term, though yours does print
>>> 12. I'm not sure I understand why yours doesn't print just 1 as one
>>> night think it would ?
>>
>> $ perl -e 'print "12\b"'
>> 1$
>>
> Basically it's a mistake to think that a backspace is guaranteed to be 
> anything other than a cursor positioning command. Processing by the OS 
> of characters sent to a console should differ from processing by OS of 
> keyboard input. BS might be a "delete char left" in one case and "move 
> cursor left one place" in the other. 

ACK.

> Apparently Windows and Unix/Linux 
> differ in their handling of this slightly.

The difference is visible already under Unix alone.

$ perl -e 'print "12\b\n"'
12
$ perl -e 'print "12\b"'
1$

$ uname -a
AIX lpar1 3 5 00C533BE4C00 powerpc unknown AIX

$ perl -version

This is perl, v5.8.2 built for aix-thread-multi
(with 2 registered patches, see perl -V for more detail)

Bye
  Achim


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

Date: Thu, 29 May 2008 11:12:18 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: The telnet login fails if the user has no password
Message-Id: <483ed5e2$0$89875$815e3792@news.qwest.net>

lovecreatesbea...@gmail.com wrote:
> On May 29, 11:00 am, Ben Morrow <b...@morrow.me.uk> wrote:
>> Quoth "lovecreatesbea...@gmail.com" <lovecreatesbea...@gmail.com>:
>>
>>> The telnet login fails if the user has no password.
>> I sincerely hope you have good firewalls, if you are allowing telnet
>> logins without a password.
>>
>>> I mean the user is not prompted with the ``Password:'' string and log
>>> in, as shown in below case 2.
>>>       $cnn->login($user, $pass);
>>> It works in case 1. How can I make a script work with both cases?
>> As it says in the docs, if ->login doesn't do what you want, use ->print
>> and ->waitfor instead.
>>
> 
> Thanks, I just read it. Does ->print display password on terminal and
> anybody sees it? Does the ->login work this way also?

Why ask? Both of those are questions you can answer yourself by
trying the methods.


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

Date: Thu, 29 May 2008 11:18:29 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Turning a dir output into a webpage ??
Message-Id: <483ed755$0$48227$815e3792@news.qwest.net>

mdcarlile wrote:
[...]
> Maybe I did not make myself clear - I realise that I can do the HTML
> manually -but whats the un in that.
> I want a script that will run once a day and generate the new content
> - which will be additions to the directory (captured by the dir
> command [or likewise]).

Get the filenames: perldoc -f readdir
Open a file: perldoc -f open  and perldoc perlopentut
Loop through the filenames and write the HTML.  Possibly the CGI module
might help.


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

Date: Thu, 29 May 2008 12:33:13 -0000
From: Justin C <justin.0805@purestblue.com>
Subject: Re: Variable remaining undef in one place but not another.
Message-Id: <3d75.483ea289.9642b@zem>

On 2008-05-28, Eric Pozharski <whynot@pozharski.name> wrote:
> Justin C <justin.0805@purestblue.com> wrote:
>> my $path = (cwd() =~ /^\/+.*\/(.*)$/);# get just the last part of the path
>
> I believe you don't know what you are doing.

Yes, you are right, I don't know what I'm doing! But I've been getting
by for years. When I learn something new I refine what's gone before.
Maybe, by the time I retire, I'll be profficient!

Thanks for the comments, I'll look into what you say and try to improve
what I do.

WRT my original problem, I'll get back to you when I've looked again.
Thanks.

	Justin.

-- 
Justin C, by the sea.


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

Date: Thu, 29 May 2008 14:13:56 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Variable remaining undef in one place but not another.
Message-Id: <Xns9AAD6814AF045asu1cornelledu@127.0.0.1>

Justin C <justin.0805@purestblue.com> wrote in
news:3d75.483ea289.9642b@zem: 

> On 2008-05-28, Eric Pozharski <whynot@pozharski.name> wrote:
>> Justin C <justin.0805@purestblue.com> wrote:
>>> my $path = (cwd() =~ /^\/+.*\/(.*)$/);# get just the last part of
>>> the path 
>>
>> I believe you don't know what you are doing.
> 
> Yes, you are right, I don't know what I'm doing! But I've been getting
> by for years.

Dunno what I can tell you if that standard is good enough.

You might have something to learn from those whose work make it to 
http://thedailywtf.com/

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://www.rehabitation.com/clpmisc/


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

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


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