[29040] in Perl-Users-Digest
Perl-Users Digest, Issue: 284 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 30 14:10:02 2007
Date: Fri, 30 Mar 2007 11:09:07 -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 Fri, 30 Mar 2007 Volume: 11 Number: 284
Today's topics:
About DBI and DBD <samluiff@hotmail.com>
Re: About DBI and DBD usenet@DavidFilmer.com
Re: Any "consumer review generators" available? <zburnham@gmail.com>
Re: Any "consumer review generators" available? <null@null.null>
Comprehensive Reference Books On Perl or CGI. virtualadepts@gmail.com
Re: Comprehensive Reference Books On Perl or CGI. <jurgenex@hotmail.com>
Re: Comprehensive Reference Books On Perl or CGI. virtualadepts@gmail.com
Re: Comprehensive Reference Books On Perl or CGI. <uri@stemsystems.com>
Re: How best to "fix" a bug in a standard module? anno4000@radom.zrz.tu-berlin.de
Re: How best to "fix" a bug in a standard module? xhoster@gmail.com
Re: LWP::UserAgent and HTTP::Request with basic authent <Peter@PSDT.com>
Module to detect keyboard presses <ignoramus3938@NOSPAM.3938.invalid>
Re: Module to detect keyboard presses anno4000@radom.zrz.tu-berlin.de
Re: Module to detect keyboard presses <ignoramus31975@NOSPAM.31975.invalid>
Re: Module to detect keyboard presses anno4000@radom.zrz.tu-berlin.de
Re: Module to detect keyboard presses <ignoramus31975@NOSPAM.31975.invalid>
Re: multiple inheritance and instance data? anno4000@radom.zrz.tu-berlin.de
readline - possible security hole <krivenok.dmitry@gmail.com>
Re: readline - possible security hole <mritty@gmail.com>
Weird character issue <terry_tn@yahoo.com>
Re: What are OOP's Jargons and Complexities <lew@nospam.lewscanon.com>
Re: What are OOP's Jargons and Complexities <lew@nospam.lewscanon.com>
Re: What are OOP's Jargons and Complexities <mscottschilling@hotmail.com>
Re: What are OOP's Jargons and Complexities <mscottschilling@hotmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 31 Mar 2007 00:27:25 +0800
From: "Samuel" <samluiff@hotmail.com>
Subject: About DBI and DBD
Message-Id: <eujaoj$ktm$1@mawar.singnet.com.sg>
Books telling that we can use Perl to access MySQL, I understand that MySQL
should be installed in the server, while Perl should be installed in the
Client host. How about DBI and DBD, where to install? Client host or the
Server?
------------------------------
Date: 30 Mar 2007 09:46:22 -0700
From: usenet@DavidFilmer.com
Subject: Re: About DBI and DBD
Message-Id: <1175273182.269361.150570@y66g2000hsf.googlegroups.com>
On Mar 30, 9:27 am, "Samuel" <samlu...@hotmail.com> wrote:
> Books telling that we can use Perl to access MySQL, I understand that MySQL
> should be installed in the server
You need MySQL server on the server and MySQL client on the client
(which could be the same machine). You need MySQL software on BOTH
the client and the server.
> How about DBI and DBD, where to install? Client host or the Server?
Client. The MySQL server does not need Perl or any Perl modules to
service a client accessing it via a Perl program.
--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)
------------------------------
Date: 30 Mar 2007 07:01:16 -0700
From: "Evil Otto" <zburnham@gmail.com>
Subject: Re: Any "consumer review generators" available?
Message-Id: <1175263276.576403.10930@l77g2000hsb.googlegroups.com>
On Mar 30, 3:46 am, nullified <n...@null.null> wrote:
> On 29 Mar 2007 20:34:26 -0700, "Evil Otto" <zburn...@gmail.com> wrote:
>
> >On Mar 29, 2:19 pm, aral...@aol.com wrote:
> >> I am looking for a fake consumer review generator that could generate realistic looking reviews for any products, kind of like on amazon.com but generated by Artificial Intelligence. Is there a package available in your favorite programing language... thx alan
>
> >I really, really hope that you're looking to generate test data or
> >filler text.
>
> >If you're not, then DIAF.
>
> Die In A Fire? Drop In A Fryer? Doug Is A Fucker? Drown In A Fart?
Any of those would accurately describe the underlying sentiment, but I
had "Die In A Fire" in mind specifically.
------------------------------
Date: Fri, 30 Mar 2007 14:07:11 GMT
From: nullified <null@null.null>
Subject: Re: Any "consumer review generators" available?
Message-Id: <qb6q03t7uq9j33jdvrrg6h90cpr648u56v@4ax.com>
On 30 Mar 2007 07:01:16 -0700, "Evil Otto" <zburnham@gmail.com> wrote:
>On Mar 30, 3:46 am, nullified <n...@null.null> wrote:
>> On 29 Mar 2007 20:34:26 -0700, "Evil Otto" <zburn...@gmail.com> wrote:
>>
>> >On Mar 29, 2:19 pm, aral...@aol.com wrote:
>> >> I am looking for a fake consumer review generator that could generate realistic looking reviews for any products, kind of like on amazon.com but generated by Artificial Intelligence. Is there a package available in your favorite programing language... thx alan
>>
>> >I really, really hope that you're looking to generate test data or
>> >filler text.
>>
>> >If you're not, then DIAF.
>>
>> Die In A Fire? Drop In A Fryer? Doug Is A Fucker? Drown In A Fart?
>
>Any of those would accurately describe the underlying sentiment, but I
>had "Die In A Fire" in mind specifically.
FM!, IWRFT!
------------------------------
Date: 30 Mar 2007 08:28:40 -0700
From: virtualadepts@gmail.com
Subject: Comprehensive Reference Books On Perl or CGI.
Message-Id: <1175268520.405342.326940@r56g2000hsd.googlegroups.com>
I'm busy ordering books on CGI & Perl, but It is hard to find the good
books. I'm looking for something comprehensive and written at a level
for experts using the language to use the books as a reference. Can
anyone link me up to some?
------------------------------
Date: Fri, 30 Mar 2007 15:34:26 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Comprehensive Reference Books On Perl or CGI.
Message-Id: <66aPh.5$yL1.0@trndny04>
virtualadepts@gmail.com wrote:
> I'm busy ordering books on CGI & Perl, but It is hard to find the good
> books. I'm looking for something comprehensive and written at a level
> for experts using the language to use the books as a reference. Can
> anyone link me up to some?
Do you mean beyond 'perldoc -q book'?
jue
------------------------------
Date: 30 Mar 2007 09:05:41 -0700
From: virtualadepts@gmail.com
Subject: Re: Comprehensive Reference Books On Perl or CGI.
Message-Id: <1175270741.673500.59630@p77g2000hsh.googlegroups.com>
On Mar 30, 11:34 am, "J=FCrgen Exner" <jurge...@hotmail.com> wrote:
> virtualade...@gmail.com wrote:
> > I'm busy ordering books on CGI & Perl, but It is hard to find the good
> > books. I'm looking for something comprehensive and written at a level
> > for experts using the language to use the books as a reference. Can
> > anyone link me up to some?
>
> Do you mean beyond 'perldoc -q book'?
>
> jue
I'm learning Pearl now. It is the hottest damn language out there,
for some clearly good reasons. The language was released for free in
1988 on Usenet to begin with, so you know it is good already. And
people have been developing source with it within the unix community
since then. The other good thing about the language, and unix in
general, is there are so many manuals written for it that explain
everything so clearly that you may as well have a teacher in the room
with you. Perl is the main language people use to code CGI programs,
although you could use C, but C doesn't have as much power. CGI is a
way to run executables as web sites, and that has created the new
dot.com revolution now that we have hardware and bandwith that can
process everything like google, youtube, and myspace. People are
writing simple php, html, css scripts. They are coding backends in
Perl and C++. Sometimes even coding their own webservers. And if you
get an iMac you are running unix to begin with, and it is easy to see
that unix programming CGI, & Perl are the future of computers. They
already are here. If you want a career in computers 5 years from now
you will have to forget all about windows GUI programming and C#.
Knowing how to configure Apache to run php scripts on a windows box
won't be good enough either. You will have to learn UNIX!!!! UNIX!!!
And all the manuals are out there by a great publisher Oreilly:
http://www.oreilly.com/
This company published all of the really good perl, and cgi books, as
well as some great manuals for unix. The phrase RTFM is my best
friend now that I have an iMac. Because the manuals are just so damn
enjoyable to read! Google book search kicks ass too, but I can't find
many manuals better than the ones on Oreilly for unix.
------------------------------
Date: Fri, 30 Mar 2007 11:19:46 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Comprehensive Reference Books On Perl or CGI.
Message-Id: <x7abxu900t.fsf@mail.sysarch.com>
>>>>> "v" == virtualadepts <virtualadepts@gmail.com> writes:
v> I'm learning Pearl now. It is the hottest damn language out there,
v> for some clearly good reasons. The language was released for free
v> in 1988 on Usenet to begin with, so you know it is good already.
v> And people have been developing source with it within the unix
v> community since then. The other good thing about the language, and
v> unix in general, is there are so many manuals written for it that
v> explain everything so clearly that you may as well have a teacher
v> in the room with you. Perl is the main language people use to code
v> CGI programs, although you could use C, but C doesn't have as much
v> power. CGI is a way to run executables as web sites, and that has
v> created the new dot.com revolution now that we have hardware and
v> bandwith that can process everything like google, youtube, and
v> myspace. People are writing simple php, html, css scripts. They
v> are coding backends in Perl and C++. Sometimes even coding their
v> own webservers. And if you get an iMac you are running unix to
v> begin with, and it is easy to see that unix programming CGI, & Perl
v> are the future of computers. They already are here. If you want a
v> career in computers 5 years from now you will have to forget all
v> about windows GUI programming and C#. Knowing how to configure
v> Apache to run php scripts on a windows box won't be good enough
v> either. You will have to learn UNIX!!!! UNIX!!! And all the
v> manuals are out there by a great publisher Oreilly:
v> http://www.oreilly.com/ This company published all of the really
v> good perl, and cgi books, as well as some great manuals for unix.
v> The phrase RTFM is my best friend now that I have an iMac. Because
v> the manuals are just so damn enjoyable to read! Google book search
v> kicks ass too, but I can't find many manuals better than the ones
v> on Oreilly for unix.
***boggle*** x 1000
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 30 Mar 2007 15:22:22 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: How best to "fix" a bug in a standard module?
Message-Id: <574o9eF2bql82U1@mid.dfncis.de>
kj <socyl@987jk.com.invalid> wrote in comp.lang.perl.misc:
>
>
>
> I frequently run into minor bugs in modules downloaded from CPAN.
> Aside from the issue of reporting the bug to the modules' maintainers,
> there's still the immediate problem of fixing the bug for our own
> use.
>
> AFAIC, it is out of the question to replace the installed module
> with one I have fixed.
Why?
> Therefore I have settled on just redefining
> the buggy sub(s) in the calling code. For example, CGI::Carp::die
> does not behave like CORE::die with respect to $@. To correct
> this, I have this snippet at the beginning of my CGI script:
>
> BEGIN {
> no warnings 'redefine';
> my $ccdie = \&CGI::Carp::die;
> sub CGI::Carp::die {
> @_ = $@ if !@_ and $@;
> goto &$ccdie;
> }
> }
>
> This seems to work fine, but somehow I'm not entirely comfortable
> with doing something like this. What pitfalls am I overlooking?
I don't see any pitfalls. Under normal circumstances your approach
should work.
> Is there a better approach?
I think there is. Use your own Perl library (~/lib/perl5/, for
instance), and make it known via $ENV{ PERL5LIB} or "use lib ...".
Then copy the broken module(s) to (an appropriate subdir of) your
lib and fix it there. Then send the author the diff. As they
say, "Patches speak louder than words".
If you want to be an even better member of the open source community,
add tests to the distributions .../t directory that discover the
behavior you have corrected, and also make sure that your fix
doesn't break any of the existing tests.
Anno
------------------------------
Date: 30 Mar 2007 16:09:10 GMT
From: xhoster@gmail.com
Subject: Re: How best to "fix" a bug in a standard module?
Message-Id: <20070330120912.506$Gm@newsreader.com>
kj <socyl@987jk.com.invalid> wrote:
> I frequently run into minor bugs in modules downloaded from CPAN.
I occasionally find bugs, but more frequently I just have differences of
opinion about things, like when to use carp vs die. Or I want to make
optimizations for either speed or memory that are specific to the way I use
it and not of much general interest.
> Aside from the issue of reporting the bug to the modules' maintainers,
> there's still the immediate problem of fixing the bug for our own
> use.
>
> AFAIC, it is out of the question to replace the installed module
> with one I have fixed.
What I frequently do for OO modules is just copy the module to somewhere
else, change the source copy, and then change the "use" statement. (But
not change the class method invocations).
So
use Foo::Bar;
my $b=new Foo::Bar;
becomes:
use FooBar;
my $b=new Foo::Bar;
(After I copy $somelib/Foo/Bar.pm to $mylib/FooBar.pm and modify the
latter, of course.) This can cause problems if other modules you are using
will load the original Foo::Bar themselves.
> Therefore I have settled on just redefining
> the buggy sub(s) in the calling code. For example, CGI::Carp::die
> does not behave like CORE::die with respect to $@. To correct
> this, I have this snippet at the beginning of my CGI script:
>
> BEGIN {
> no warnings 'redefine';
> my $ccdie = \&CGI::Carp::die;
> sub CGI::Carp::die {
> @_ = $@ if !@_ and $@;
> goto &$ccdie;
> }
> }
>
> This seems to work fine, but somehow I'm not entirely comfortable
> with doing something like this. What pitfalls am I overlooking?
If the underlying module gets upgraded, your fix to it may no longer be
compatible. You can confuse people who overlook your redefinition.
Neither pitfall is particularly devastating.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Fri, 30 Mar 2007 13:55:50 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: LWP::UserAgent and HTTP::Request with basic authentication...
Message-Id: <pan.2007.03.30.13.55.48.363557@PSDT.com>
On Thu, 29 Mar 2007 14:08:45 -0700, scottny07 wrote:
> I am by no means a perl pro but I am trying to take a url sent from a
> form along with a integer and load the given number of URL's to
> recache them in our cms system... here is what I have...
[snip]
> $ua->agent("MyAgent/1.0");
> my $req = HTTP::Request->new(GET => $URL);
> $req->authorization_basic('user', 'pass');
> my $res = $ua->request($req);
> my $content = $res;
> if ($content) {
[snip]
> Not working... any ideas?
You will need to be less of a Perl pro if you use the simpler
WWW::Mechanize. And if you supply more detail than "not working".
Shot in the dark: you probably want to be checking for an HTTP error
rather than empty content.
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
------------------------------
Date: Fri, 30 Mar 2007 07:09:19 -0500
From: Ignoramus3938 <ignoramus3938@NOSPAM.3938.invalid>
Subject: Module to detect keyboard presses
Message-Id: <cYGdnReVqa1yYJHbnZ2dnUVZ_r2onZ2d@giganews.com>
I have a script that runs in a loop and I would like it to accept
OPTIONAL keypresses.
e.g.
while( 1 ) {
do_my_stuff();
my $key = get_optional_key();
if( defined $key ) { # key was pressed
if( $key eq 'b' ) { skip_backwards(); }
elsif( $key eq 'f' ) { skip_forward(); }
elsif( $key eq ' ' ) { pause(); }
} else {
print "No key was pressed.\n";
}
}
The key point here is that I do NOT want to wait for mandatory keys at
every iteration, I just want a nonblocking call to get a [possible]
key press event[s];
MS-DOS used to have this facility a long time ago.
I would like to know if there is already a module for this.
I am using Linux.
thanks
i
------------------------------
Date: 30 Mar 2007 12:21:17 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Module to detect keyboard presses
Message-Id: <574dltF2be25eU1@mid.dfncis.de>
Ignoramus3938 <ignoramus3938@NOSPAM.3938.invalid> wrote in comp.lang.perl.misc:
> I have a script that runs in a loop and I would like it to accept
> OPTIONAL keypresses.
See "perldoc -q 'just one key'".
Anno
------------------------------
Date: Fri, 30 Mar 2007 09:05:09 -0500
From: Ignoramus31975 <ignoramus31975@NOSPAM.31975.invalid>
Subject: Re: Module to detect keyboard presses
Message-Id: <5Zudnbt2KvOIhJDbnZ2dnUVZ_oavnZ2d@giganews.com>
On 30 Mar 2007 12:21:17 GMT, anno4000@radom.zrz.tu-berlin.de <anno4000@radom.zrz.tu-berlin.de> wrote:
> Ignoramus3938 <ignoramus3938@NOSPAM.3938.invalid> wrote in comp.lang.perl.misc:
>> I have a script that runs in a loop and I would like it to accept
>> OPTIONAL keypresses.
>
> See "perldoc -q 'just one key'".
>
> Anno
Thanks, I just read this page
LANG="" man Term::ReadKey
and it looks like it will do just what I want.
i
------------------------------
Date: 30 Mar 2007 15:06:06 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Module to detect keyboard presses
Message-Id: <574nauF2ak7l8U1@mid.dfncis.de>
Ignoramus31975 <ignoramus31975@NOSPAM.31975.invalid> wrote in comp.lang.perl.misc:
> On 30 Mar 2007 12:21:17 GMT, anno4000@radom.zrz.tu-berlin.de
> <anno4000@radom.zrz.tu-berlin.de> wrote:
> > Ignoramus3938 <ignoramus3938@NOSPAM.3938.invalid> wrote in
> comp.lang.perl.misc:
> >> I have a script that runs in a loop and I would like it to accept
> >> OPTIONAL keypresses.
> >
> > See "perldoc -q 'just one key'".
> >
> > Anno
> Thanks, I just read this page
>
> LANG="" man Term::ReadKey
>
> and it looks like it will do just what I want.
Right. That's what the FAQ answer also points to.
Anno
------------------------------
Date: Fri, 30 Mar 2007 10:29:34 -0500
From: Ignoramus31975 <ignoramus31975@NOSPAM.31975.invalid>
Subject: Re: Module to detect keyboard presses
Message-Id: <Uo-dna2lb_pDsZDbnZ2dnUVZ_vShnZ2d@giganews.com>
On 30 Mar 2007 15:06:06 GMT, anno4000@radom.zrz.tu-berlin.de <anno4000@radom.zrz.tu-berlin.de> wrote:
> Ignoramus31975 <ignoramus31975@NOSPAM.31975.invalid> wrote in comp.lang.perl.misc:
>> On 30 Mar 2007 12:21:17 GMT, anno4000@radom.zrz.tu-berlin.de
>> <anno4000@radom.zrz.tu-berlin.de> wrote:
>> > Ignoramus3938 <ignoramus3938@NOSPAM.3938.invalid> wrote in
>> comp.lang.perl.misc:
>> >> I have a script that runs in a loop and I would like it to accept
>> >> OPTIONAL keypresses.
>> >
>> > See "perldoc -q 'just one key'".
>> >
>> > Anno
>> Thanks, I just read this page
>>
>> LANG="" man Term::ReadKey
>>
>> and it looks like it will do just what I want.
>
> Right. That's what the FAQ answer also points to.
>
Yes, I got this idea from the FAQ answer. That's why I thanked you --
your suggestion was great.
I wrote this script to test stuff.
#!/usr/bin/perl
use Term::ReadKey;
sub CleanUp { ReadMode 0; }
$SIG{INT} = sub { CleanUp; die 'SIGINT CALLED'; };
$| = 1;
ReadMode 3;
while( 1 ) {
#print "Type key: ";
#usleep 10;
my $c = ReadKey(-1);
if( $c ) {
print "C='$c'. ";
if( $c eq 'q' || $c eq 'Q' ) {
print "\n'q' pressed. Exiting.\n";
last;
} else {
print "Press 'q' to exit.\n";
}
} else {
#print "\n";
}
}
CleanUp;
------------------------------
Date: 30 Mar 2007 16:06:14 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: multiple inheritance and instance data?
Message-Id: <574qrmF2c2vgbU1@mid.dfncis.de>
Abigail <abigail@abigail.be> wrote in comp.lang.perl.misc:
> bugbear (bugbear@trim_papermule.co.uk_trim) wrote on MMMMCMLVIII
> September MCMXCIII in
> <URL:news:460bbb56$0$8741$ed2619ec@ptn-nntp-reader02.plus.net>:
> == I would like to have a class which has the behviour
> == of 2 more primitive classes.
[...]
> == But I can't see, if BOTH parent classes
> == have constructors that return a blessed
> == object (e.g. a the typical hash reference),
> == what I'm meant to do in my child
> == class.
> ==
> == I think I'm just in trouble,
> == and that I'm up against a reasonable
> == limitation of Perl's object modelling,
> == but I would welcome any help
> == or insight.
>
>
> You are spot on.
>
> And if you cannot control the implementation of the two classes you
> want to inherit from, than chances are, you cannot do it.
>
> Because most Perl programmers will *CONFIGURE* objects inside *CONSTRUCTORS*.
Slight modification here: A constructor can configure all it wants to
as long as configuration doesn't also construct.
A class *must* have configuration method (an object method, often
called ->init) to be useful. It may have a creator, but not every
class needs one. It may make sense for the creator to call ->init
automatically, as long as that isn't the only way to call ->init.
> Which is bad.
I couldn't agree more with that sentiment. It's really a simple
piece of arithmetic. If you have a base class, you (generally)
have to initialize an object for use with that class. If you
have more than one base class, you have more than one initialization
to do for a new object, but you can create it only once. So not
having initialization without creation is bad.
Anno
------------------------------
Date: 30 Mar 2007 05:50:21 -0700
From: "Krivenok Dmitry" <krivenok.dmitry@gmail.com>
Subject: readline - possible security hole
Message-Id: <1175259021.215383.142220@r56g2000hsd.googlegroups.com>
Hello All!
Suppose I use readline subroutine in my server application to read
one
line from a socket.
Obviously, there may be a client, that may write something like this:
my $request = "12345";
while(1)
{
$sock->send($request);
}
In this case readline() never returns, but its internal buffer will
continuously
grow.
Eventually, the internal buffer becomes overfull.
I can't find a way to specify maximum buffer size.
readline's prototype is "readline EXPR".
Thus, it seems to me that there is no way to specify max buffer size
except globally. But how?
And what value should return readline() in this case?
Is it really security hole?
Any comments?
------------------------------
Date: 30 Mar 2007 08:03:20 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: readline - possible security hole
Message-Id: <1175267000.432183.255320@e65g2000hsc.googlegroups.com>
On Mar 30, 8:50 am, "Krivenok Dmitry" <krivenok.dmi...@gmail.com>
wrote:
> Hello All!
>
> Suppose I use readline subroutine in my server application to read
> one line from a socket.
> Obviously, there may be a client, that may write something like this:
>
> my $request = "12345";
> while(1)
> {
> $sock->send($request);
> }
>
> In this case readline() never returns, but its internal buffer will
> continuously
> grow.
> Eventually, the internal buffer becomes overfull.
"Hello, Doctor, suppose it hurts when I raise my right arm over my
head...."
See also:
perldoc -f read
> I can't find a way to specify maximum buffer size.
> readline's prototype is "readline EXPR".
> Thus, it seems to me that there is no way to specify max buffer size
> except globally. But how?
Please read the documentation for the function you're using.
perldoc -f readline
readline EXPR
[...]
Note that the
notion of "line" used here is however you may have
defined it with $/ or $INPUT_RECORD_SEPARATOR). See
"$/" in perlvar.
perldoc perlop
IO::Handle->input_record_separator(EXPR)
$INPUT_RECORD_SEPARATOR
$RS
$/ The input record separator, newline by default.
[...]
Setting $/ to a reference to an integer, scalar
containing an integer, or scalar that's convertible
to an integer will attempt to read records instead
of lines, with the maximum record size being the
referenced integer. So this:
local $/ = \32768; # or \"32768", or \
$var_containing_32768
open my $fh, $myfile or die $!;
local $_ = <$fh>;
will read a record of no more than 32768 bytes from
FILE.
> And what value should return readline() in this case?
>
> Is it really security hole?
> Any comments?
I don't consider poor programming practices to be security holes in
the language.
Paul Lalli
------------------------------
Date: 30 Mar 2007 10:14:43 -0700
From: "Hoi-Polloi" <terry_tn@yahoo.com>
Subject: Weird character issue
Message-Id: <1175274883.200281.220260@p77g2000hsh.googlegroups.com>
Hi all
I'm using Perl 5.6, and I am seeing a very strange behavior with
creating files with utf8 chars in the name. Here's a little program:
use utf8;
use charnames ':full';
my $A =3D "\x{C1}"; # latin capital letter a with acute
my $AAA =3D "_" . "$A" . "$A" . "$A";
my $AAA1 =3D "$A" . "$A" . "$A";
system("echo 'AAA' > $AAA");
system("echo 'AAA1' > $AAA1");
If I run it, then do 'ls' I get the following:
# ls
_=C1=C1=C1 =C3?=C1=C1
# ls | od -a
qa-tterry-1# ls | od -a
0000000 _ ? 81 ? 81 ? 81 nl ? 83 ? 81 ? 81 ?
81
0000020 nl
0000021
In other words, the first character of the AAA1 file is not latin
capital a acute. I am surprised that putting "_" at the beginning of
the string makes a difference. What is going on here?
Thanks,
TT
------------------------------
Date: Fri, 30 Mar 2007 09:05:48 -0400
From: Lew <lew@nospam.lewscanon.com>
Subject: Re: What are OOP's Jargons and Complexities
Message-Id: <kKCdnbCHbYqwlpDbnZ2dnUVZ_oDinZ2d@comcast.com>
Timofei Shatrov wrote:
> On Fri, 30 Mar 2007 06:48:05 GMT, "Mike Schilling" <mscottschilling@hotmail.com>
> tried to confuse everyone with this message:
>
>> Xah Lee wrote:
>>
>>> So, a simple code like this in normal languages:
>
>>> becomes in Java:
>>>
>>>
>> Only when written by someone almost entirely ignorant of Java.
>>
>
> Which is the state most people want to be in...
As a particular case of the general proposition that most people want to be
ignorant of computer programming.
-- Lew
------------------------------
Date: Fri, 30 Mar 2007 09:07:05 -0400
From: Lew <lew@nospam.lewscanon.com>
Subject: Re: What are OOP's Jargons and Complexities
Message-Id: <kKCdnbOHbYrklpDbnZ2dnUVZ_oDinZ2d@comcast.com>
Xah Lee wrote:
>> public class test {
>> public static void main(String[] args) {
>> String a = new String("a string");
>> String b = new String("another one");
>> StringBuffer c = new StringBuffer(40);
>> c.append(a); c.append(b);
>> System.out.println(c.toString());
>> }
>> }
>
> Er. How about
>
> public class test {
> public static void main(String[] args) {
> String a = "a string";
> String b = "another one";
> StringBuffer c = a + b;
> System.out.println(c);
> }
> }
bugbear wrote:
> Alternatively I could recode your Lisp example
> as badly as you coded your Java.
From what I've seen and heard of Xah Lee, you'd probably lose the bad-coding
competition to him. He's a professional.
-- Lew
------------------------------
Date: Fri, 30 Mar 2007 17:19:14 GMT
From: "Mike Schilling" <mscottschilling@hotmail.com>
Subject: Re: What are OOP's Jargons and Complexities
Message-Id: <mEbPh.10505$JZ3.8847@newssvr13.news.prodigy.net>
Timofei Shatrov wrote:
> On Fri, 30 Mar 2007 06:48:05 GMT, "Mike Schilling"
> <mscottschilling@hotmail.com> tried to confuse everyone with this
> message:
>
>> Xah Lee wrote:
>>
>>> So, a simple code like this in normal languages:
>
>>> becomes in Java:
>>>
>>>
>>
>> Only when written by someone almost entirely ignorant of Java.
>>
>
> Which is the state most people want to be in...
Most of them have the brains not to display their ignorance so widely.
------------------------------
Date: Fri, 30 Mar 2007 17:20:50 GMT
From: "Mike Schilling" <mscottschilling@hotmail.com>
Subject: Re: What are OOP's Jargons and Complexities
Message-Id: <SFbPh.10507$JZ3.490@newssvr13.news.prodigy.net>
bugbear wrote:
> Er. How about
>
> public class test {
> public static void main(String[] args) {
> String a = "a string";
> String b = "another one";
> StringBuffer c = a + b;
String c (etc.), that is.
> System.out.println(c);
> }
> }
------------------------------
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 284
**************************************