[28377] in Perl-Users-Digest
Perl-Users Digest, Issue: 9741 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 19 14:05:58 2006
Date: Tue, 19 Sep 2006 11:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 19 Sep 2006 Volume: 10 Number: 9741
Today's topics:
Re: database connect: protect with exceptions? <glex_no-spam@qwest-spam-no.invalid>
Re: exec command issue <bik.mido@tiscalinet.it>
Re: Learning perl - for experienced programmers <john@castleamber.com>
Re: Learning perl - for experienced programmers <robb@acm.org>
Re: Learning perl - for experienced programmers <john@castleamber.com>
Re: Learning perl - for experienced programmers <john@castleamber.com>
Re: Learning perl - for experienced programmers <addinall@addinall.org>
Re: Learning perl - for experienced programmers cartercc@gmail.com
Re: Learning perl - for experienced programmers <john@castleamber.com>
Re: Learning perl - for experienced programmers <john@castleamber.com>
Re: Modification of a read-only value attempted - why? <bik.mido@tiscalinet.it>
Net::Telnet, script exits after connection failure <Janin.Netosoite@gmail.com>
Re: Preventing changes to a module's variables in mod_p anno4000@radom.zrz.tu-berlin.de
Problem using more than 1 module in Windows (XS) - plea jatshergill@gmail.com
Re: Question on download by LWP <sapience@gmail.com>
Re: Question on download by LWP <john@castleamber.com>
Server/client over a network <deadpickle@gmail.com>
Re: String buffer instead of file handle? <spamhole@ntp.isc.org>
Re: where to put dclone <graham.removethis.t.wood@andthis.oracle.com>
Re: where to put dclone xhoster@gmail.com
Re: where to put dclone <nobull67@gmail.com>
Re: where to put dclone <glex_no-spam@qwest-spam-no.invalid>
Re: where to put dclone anno4000@radom.zrz.tu-berlin.de
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 19 Sep 2006 10:14:44 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: database connect: protect with exceptions?
Message-Id: <4510089f$0$34071$815e3792@news.qwest.net>
Filippo wrote:
> Tad McClellan ha scritto:
>
>> my $DATABASE_SERVER = shift @ARGV;
>> unless ( defined $DATABASE_SERVER ) {
>> print STDOUT 'enter the database server name: ';
>> $DATABASE_SERVER = <STDIN>;
>> chomp $DATABASE_SERVER;
>> }
>
> thanks Tad but this isn't what I want: the unless clause accept any
> value for DATABASE_SERVER. I want to try to connect and get the value
> unless the connection is succeeded fine.
Wrap it in another loop. Also see:
perldoc -f eval
use DBI;
my $dbh;
my $DATABASE_SERVER = shift @ARGV;
unless ( $dbh )
{
#... insert unless loop, from above, to set DATABASE_SERVER
eval {
$dbh = DBI->connect( ... $DATABASE_SERVER,...,
{ RaiseError => 1 } );
};
if ( $@ )
{
print "Couldn't connect using $DATABASE_SERVER.\n";
undef $DATABASE_SERVER;
}
}
------------------------------
Date: 19 Sep 2006 16:45:58 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: exec command issue
Message-Id: <38lvg2t4ocnlsq8ndqj4afrh1j2eqjhfmg@4ax.com>
On Fri, 15 Sep 2006 19:22:43 +0100, "Don Corleone" <don@mastah.com>
wrote:
>Thanks a million!!
You welcome a billion!!
>I just wish i understood the program flow, if you dont mind explaining what
>this does:
>
>$path=shift
In the context of my example script, i.e. out of a sub definition, it
means
$path=shift @ARGV;
>what does the shift mean ?
You will find all you need to know in the excellent documentation that
comes with perl:
perldoc -f shift
perldoc perlvar
(the latter, for @ARGV.)
>"Michele Dondi" <bik.mido@tiscalinet.it> wrote in message
>news:5ebag29vnr01bhlajnlviodap1s0usa274@4ax.com...
[snip full quote of post]
*PLEASE* Do not top-post!
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 19 Sep 2006 14:48:38 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Learning perl - for experienced programmers
Message-Id: <Xns984363CC0D6E3castleamber@130.133.1.4>
"robb@acm.org" <robb@acm.org> wrote:
>
> John Bokma wrote:
>>
>> Instead of trying to "remember" to what I replied and making things
>> up to look good, look it actually up.
>>
>
> You're right. I'm sorry -
Thanks.
> you did say that POD would produce
> "something" from obfuscated perl code, and I'm sure it would.
Can't recall I said that :-).
> My only beef is that this "something" wouldn't be useful, and I
> wouldn't present POD as being the same as Javadoc when talking to a
> newbie.
>
>> Furthermore, you somehow seem to be impressed by the ability of
>> javadoc to use the method signature (amongst other) to generate some
>> bare "documentation".
>
> You betcha! An interlinked set of docs showing all inheritance
> relationships, class names, methods and their parameters, exceptions
> thrown, interfaces implemented, class and object variables.... all
> from the raw self-documenting source code without any human-written
> comments.
The question is: how useful is this.
Due to how Perl works, some of this information can not be obtained at the
moment, and probably for a part this is not going to change with Perl 6.
> It's a great embodiment of lazyness as a virtue. In my
> experience, most people would find that pretty impressive.
Then they don't know very much about programming. Due to how Java works,
generating such documentation is a piece of cake: the programmer has
already written out all required information, or it can be implied from
this information.
Perl makes this impossible due to eval amongst others.
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 19 Sep 2006 07:55:29 -0700
From: "robb@acm.org" <robb@acm.org>
Subject: Re: Learning perl - for experienced programmers
Message-Id: <1158677729.526272.93800@m7g2000cwm.googlegroups.com>
John Bokma wrote:
> > You betcha! An interlinked set of docs showing all inheritance
> > relationships, class names, methods and their parameters, exceptions
> > thrown, interfaces implemented, class and object variables.... all
> > from the raw self-documenting source code without any human-written
> > comments.
>
> The question is: how useful is this.
>
How useful is the API of a code library?
------------------------------
Date: 19 Sep 2006 14:59:19 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Learning perl - for experienced programmers
Message-Id: <Xns9843659BF889Fcastleamber@130.133.1.4>
cartercc@gmail.com wrote:
> etc., enforce a strictness that Perl doesn't.
A good programmer has enough discipline to "enforce" this
himself/herself. It has been often said, by me and by others, that
crappy code comes from a crappy programmer, not because of the language
allows for crappy code.
Moreover, I have seen often enough people doing their very best to work
around the strictness of a language.
I prefer to stick to the following rule: use the *best* solution where
possible. The lack of protection in Perl IMNSHO helps me here.
> Additionally, Java
> compiles to bytecode, and I've not had a problem running class files
> on different systems. With Perl, I've found that I need to code for
> the target system. Programs written for Windows will run on Linux, but
> some programs written on Linux will not, repeat, not, run on Windows.
This says a lot about your Perl skills, and (surprise) about your Java
skills. I have used both languages side by side for some time, and I
*had to* keep in mind while using both that it wasn't running on a
single platform. Also, I had to test my code on every platform for both
languages. Mostly just to be sure.
> I made an analogy earilier, Java is like a deuce and a half, while
> Perl is like a sports car.
I see often software compared to cars, and never seen a comparision that
made sense.
[ Perl OO rant ]
> he set some class variables. Blame the programmer (you would be
> justified in doing so), but share a small part of the blame with the
> language.
Instead of making yourself sound the whole time like someone with
skills, show "us" your skills by giving a good argument or a clear
example how Perl is bad at OO. I can make a list of what I would like to
see changed, and what's "wrong" IMO.
Can you?
>> In fact, the number of companies looking for good Perl programmers
>> who *do* have a clue about maintenance has been steadily increasing
>> over the past few years... I'm even hearing reports that there AREN'T
>> ENOUGH PERL PROGRAMMERS. Go figure.
>
> I keep an eye on dice.com. If you search for Perl, you see admin and
> web jobs, but few for Perl developers in general. Search for Java, and
> you get plenty of general programming results. Java jobs: 14217; Perl
> jobs: 4780 - a 3 to 1 ratio.
does this prove that there are enough perl programmers?
does this prove that there is no increase?
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 19 Sep 2006 15:20:37 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Learning perl - for experienced programmers
Message-Id: <Xns98436937E2396castleamber@130.133.1.4>
"robb@acm.org" <robb@acm.org> wrote:
>
> John Bokma wrote:
>> > You betcha! An interlinked set of docs showing all inheritance
>> > relationships, class names, methods and their parameters, exceptions
>> > thrown, interfaces implemented, class and object variables.... all
>> > from the raw self-documenting source code without any human-written
>> > comments.
>>
>> The question is: how useful is this.
>
> How useful is the API of a code library?
Without clear documentation? As useful as grepping *.pl and *.pm
for use, sub, @ISA IMNSHO.
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 19 Sep 2006 08:24:39 -0700
From: "addinall" <addinall@addinall.org>
Subject: Re: Learning perl - for experienced programmers
Message-Id: <1158679479.709478.255520@i3g2000cwc.googlegroups.com>
John Bokma wrote:
> "addinall" <addinall@addinall.org> wrote:
>
> > Nothing wrong with PHP!
>
> There is a lot wrong with PHP :-)
OT: Apologies.
What for instance? I program in Perl, PHP, C
and PL/SQL on a daily basis and see the
use for all of these tools.
Mark Addinall.
> It's getting better though. But it also
> suffers from the same problem I saw with Perl when it was "hot": most
> hosting providers offer version 4, not 5.
>
> --
> John Experienced Perl programmer: http://castleamber.com/
>
> Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 19 Sep 2006 08:46:58 -0700
From: cartercc@gmail.com
Subject: Re: Learning perl - for experienced programmers
Message-Id: <1158680817.967467.255490@m73g2000cwd.googlegroups.com>
John Bokma wrote:
> A good programmer has enough discipline to "enforce" this
> himself/herself. It has been often said, by me and by others, that
> crappy code comes from a crappy programmer, not because of the language
> allows for crappy code.
Did you read what I wrote? Apparently not.
> > Additionally, Java
> > compiles to bytecode, and I've not had a problem running class files
> > on different systems. With Perl, I've found that I need to code for
> > the target system. Programs written for Windows will run on Linux, but
> > some programs written on Linux will not, repeat, not, run on Windows.
>
> This says a lot about your Perl skills, and (surprise) about your Java
> skills. I have used both languages side by side for some time, and I
> *had to* keep in mind while using both that it wasn't running on a
> single platform. Also, I had to test my code on every platform for both
> languages. Mostly just to be sure.
No. It says a lot about my local network and the network engineers. I
don't control my machines or what runs on them, and I don't have
administrative privileges. In fact, I have to scream like hell just to
get a user account on the systems I'm supposed to be supporting.
Politics is hell, and right now, I'm in it.
I'll tell you a little story -- a true story. We (me and the 'other'
developer) were demonstrating a Java app to my boss, the IT Director.
This is an app that connects over a network to a remote database
server, runs queries, downloads the data, and puts it into a local
database. This runs several times a day, and downloads around 20K or
30K records at a time. I was demonstrating the unit tests by saying
something like this: "Here is the VPN class test. Here is the
configuration class test. Here is the query class test. Here is the FTP
class test." He said to me, and I quote, "When do you plan on taking
these classes?"
This guy is a smart guy, with a degree from an engineering school with
an international reputation, who has had a successful career in
industry managing large engineering projects, but he's a hardware guy
and as far as I know has never studied a programming language. In fact,
his attitude toward coding is, "You build it once, and you're finished.
If you have to revise it, it means you built it wrong." This is almost
word-for-word what he tells me. He thinks iterative development is the
most screwed up idea in the world. (He doesn't build bridges and roads
iteratively.)
> Instead of making yourself sound the whole time like someone with
> skills, show "us" your skills by giving a good argument or a clear
> example how Perl is bad at OO. I can make a list of what I would like to
> see changed, and what's "wrong" IMO.
>
> Can you?
You've got to be kidding! I'm not a programmer, but I have three
advanced degrees, one a doctorate, and two of them in SW and CS. I have
made my living as a database, web, and system admin. I'm pretty good at
what I do, which (mostly) isn't writing code. Even though I've taught
programming (Java, C, JavaScript, and believe it or not, Perl), I've
never been employed as a programmer per se. I'm good enough to do my
job, but that's all. As to how Perl is bad at OO, I do not write OO
Perl. Except for the DBIs and DBDs I use. I wouldn't be qualified to
critique Perl as to OO.
> does this prove that there are enough perl programmers?
> does this prove that there is no increase?
The only thing this proves is that there are 14K Java jobs and 4K Perl
jobs on dice. This speaks for itself.
Doing a cursory search turns this up:
.NET 7241
c 6016
c++ 5913
c# 4881
vb 2442
cobol 1385
ada 191
I'll let you draw your own conclusions, since you seem to be an expert
conclusion drawer.
CC
------------------------------
Date: 19 Sep 2006 15:48:00 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Learning perl - for experienced programmers
Message-Id: <Xns98436DDC6A01Bcastleamber@130.133.1.4>
"addinall" <addinall@addinall.org> wrote:
>
> John Bokma wrote:
>> "addinall" <addinall@addinall.org> wrote:
>>
>> > Nothing wrong with PHP!
>>
>> There is a lot wrong with PHP :-)
>
> OT: Apologies.
>
> What for instance?
- inconsistent function naming
- huge number of functions in the default name space.
The latter is something Perl suffers from as well IMO, but not as bad as
with PHP. At least the names are not a mess like with PHP.
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 19 Sep 2006 17:55:56 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Learning perl - for experienced programmers
Message-Id: <Xns9843838CCFB63castleamber@130.133.1.4>
cartercc@gmail.com wrote:
> John Bokma wrote:
>> A good programmer has enough discipline to "enforce" this
>> himself/herself. It has been often said, by me and by others, that
>> crappy code comes from a crappy programmer, not because of the
>> language allows for crappy code.
>
> Did you read what I wrote? Apparently not.
Because you disagree? You say Java is better for large projects because
it enforces a strictness [1]. I call this bull shit.
[1] which according to you Perl programmers don't like, a generalization
that IMO is false
>> This says a lot about your Perl skills, and (surprise) about your
>> Java skills. I have used both languages side by side for some time,
>> and I *had to* keep in mind while using both that it wasn't running
>> on a single platform. Also, I had to test my code on every platform
>> for both languages. Mostly just to be sure.
>
> No. It says a lot about my local network and the network engineers. I
> don't control my machines or what runs on them, and I don't have
> administrative privileges. In fact, I have to scream like hell just to
> get a user account on the systems I'm supposed to be supporting.
> Politics is hell, and right now, I'm in it.
[ snip story ]
Your point is?
>> Instead of making yourself sound the whole time like someone with
>> skills, show "us" your skills by giving a good argument or a clear
>> example how Perl is bad at OO. I can make a list of what I would like
>> to see changed, and what's "wrong" IMO.
>>
>> Can you?
>
> You've got to be kidding! I'm not a programmer, but I have three
> advanced degrees, one a doctorate, and two of them in SW and CS. I
> have made my living as a database, web, and system admin. I'm pretty
> good at what I do, which (mostly) isn't writing code. Even though I've
> taught programming (Java, C, JavaScript, and believe it or not, Perl),
> I've never been employed as a programmer per se. I'm good enough to do
> my job, but that's all. As to how Perl is bad at OO, I do not write OO
> Perl. Except for the DBIs and DBDs I use. I wouldn't be qualified to
> critique Perl as to OO.
Ok, IRMC, since
"Perl's object model, by contrast, is a mess"
<1158670835.562143.172650@m73g2000cwd.googlegroups.com>
I guess your random statement had a lot to do with
"Tom was beginning to use OO Perl for the last two or three years"
He probably never got beyond the first 3 pages because of the mess he
programmed.
>> does this prove that there are enough perl programmers?
>> does this prove that there is no increase?
>
> The only thing this proves is that there are 14K Java jobs and 4K Perl
> jobs on dice. This speaks for itself.
How does 14k appels compared to 4k pears speak about:
if there are enough pears?
there is no increase of the number of pears compared to previous years?
> Doing a cursory search turns this up:
> .NET 7241
> c 6016
> c++ 5913
> c# 4881
> vb 2442
> cobol 1385
> ada 191
>
> I'll let you draw your own conclusions, since you seem to be an expert
> conclusion drawer.
At least I don't pull them out of my ass :-D.
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 19 Sep 2006 16:45:59 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Modification of a read-only value attempted - why?
Message-Id: <pulvg25vnjrecc8l4piiot9fde1pt2jo3j@4ax.com>
On 16 Sep 2006 10:26:32 GMT, anno4000@radom.zrz.tu-berlin.de wrote:
>$_ is a package variable. It is the same whenever you access it.
>
>> So.. this isn't considered a bug or flaw in Perl? This is intended
>> behavior?
>
>It's expected behavior.
It may be interesting to mention that bleadperl provides both a
lexical $_ and means to use it in constructs that resort on $_. I only
gave a quick peek into those features quite a lot of time ago and I
can't remember the details offhand, though...
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 19 Sep 2006 11:02:44 -0700
From: "--Jani--" <Janin.Netosoite@gmail.com>
Subject: Net::Telnet, script exits after connection failure
Message-Id: <1158688964.205697.318390@k70g2000cwa.googlegroups.com>
Hi all!
I'm trying to make connections (and run several commands) to several
machines with telnet.pm. Here's the example what my script does:
1. It reads all connection parameters ($ip, $username, $pwd) from
config-file into an @rray.
2. Foreach row (cell) it makes connection to $ip and logs in with
$username and $pwd.
3. It executes several commands, brings output into an @rray or file
and then exits the connection.
The problem is that if it fails to open connection (peer not respondin,
bad user etc) it exits the whole program. If I run the program without
using any telnet.pm funtions everything works fine, for example
printing variables on each cell of the @rray. So, could someone tell me
what do I have to change in telnet.pm (or in the way using it) to make
it work?
Thank you very much,
--Jani--
------------------------------
Date: 19 Sep 2006 13:40:23 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Preventing changes to a module's variables in mod_perl
Message-Id: <4naaa7F9g7pbU1@news.dfncis.de>
Brian McCauley <nobull67@gmail.com> wrote in comp.lang.perl.misc:
>
> anno4000@radom.zrz.tu-berlin.de wrote:
> > Brian McCauley <nobull67@gmail.com> wrote in comp.lang.perl.misc:
> > >
> > > You'd probably get more informative errors with
> > >
> > > sub Readonly::croak {
> > > require Carp;
> > > goto &Carp::carp;
> > > }
> > >
> > > The problem with this approach is it breaks any other uses of Readonly
> > > that are going on in other modules that anyone who happens to use your
> > > module is also using.
> >
> > The substitution can be localized to a block or file:
> >
> > local *Readonly::croak = sub {
> > require Carp;
> > goto &Carp::carp;
> > };
>
> No! local() is dynamically scoped not lexical. Changes made with
> local() are _not_ localized to a block or file but to a stack frame
> (and subframes thereof).
Yes, of course. That means, once control has left the block the change
is reverted. In simple cases that may be good enough.
> Anyhow, even if it where lexical it would help the OP since he wants to
> control the behaviour of complex data structures returned by his
> modules when code outwith his control tries to modify them.
Hmm... tie() comes to mind then.
I admit I've lost context of the thread, so I'm not sure if that big
gun is warranted. Maybe a certain module named Tie::OneOff could be
useful... :)
Anno
------------------------------
Date: 19 Sep 2006 07:48:54 -0700
From: jatshergill@gmail.com
Subject: Problem using more than 1 module in Windows (XS) - please help
Message-Id: <1158677334.861952.309260@d34g2000cwd.googlegroups.com>
Hi all
I have a problem that I am running into while using Perl XS to build
an interface to my C++ library. This is on a windows machine with perl
5.6.1. I was able to use PerlXS to expose out different 'c++
classes' that my API supports. I wrote the .XS files for each of
these objects and now I am able to make a simple test.pl file and use
these objects from Perl. The problem comes when I try to use more than
1 object (module) in a single .pl file. Here would an example
========== working example perl script ================
use lib "C:/Documents and Settings/myusername/Desktop/perl
experiment/api";
use MyDataReader;
my $dr = new MyDataReader("hsd_demo_pre");
$dr->execQuery("select * from bug");
print "fields: " . $dr->getFieldCount() . "\n";
================== perl script giving problem =============
use lib "C:/Documents and Settings/myusername/Desktop/perl
experiment/api";
use MyDataReader;
use MyAdmin; # Adding this line gives problems
my $dr = new MyDataReader("hsd_demo_pre");
$dr->execQuery("select * from bug");
print "fields: " . $dr->getFieldCount() . "\n";
========= Error Message ==================
C:\Documents and Settings\myusername\Desktop\perl experiment\api>perl
test.pl
Can't load 'C:\Documents and Settings\ myusername \Desktop\perl
experiment\api/5.6.1
/MyAdmin.dll' for module MyAdmin: load_file:Attempt to access invalid
address at C
:/Perl/lib/DynaLoader.pm line 206.
Compilation failed in require at test.pl line 11.
BEGIN failed--compilation aborted at test.pl line 11.
So the problem shows up when I use more than one 'use' statements
in a perl script. Its important to note here that I can use the
'MyAdmin' module by itself just fine. So its not aproblem with that
module. The problem is only when I try to use more than 1 module in a
single perl script.
==================== Makefile.PL ===================
use ExtUtils::MakeMaker;
$CC = 'cl';
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile( 'NAME' => 'MyDataReader',
'VERSION' => '0.10',
'DEFINE' => '-TP -EHsc', # e.g., '-DHAVE_SOMETHING'
'CC' => $CC,
'LDDLFLAGS' => '-nologo -libpath:"C:\Perl\lib\CORE"
-machine:x86',
'LIBC' => 'msvcrtd.lib',
'LDLOADLIBS' => 'oldnames.lib kernel32.lib user32.lib gdi32.lib
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib
version.lib odbc32.lib odbccp32.lib msvcrtd.lib',
'CCFLAGS' => '-nologo -O1 -MDd -DNDEBUG -DWIN32 -D_CONSOLE
-DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX',
'LD' => '$(CC)',
'XSOPT' => '-C++',
'OPTIMIZE' => '-O1 -MDd -DNDEBUG',
'PERM_RW' => '664',
'PERM_RWX' => '775',
'TYPEMAPS' => ['perlobject.map'] ,
'INC' => "-Iinclude",
'MYEXTLIB' => 'lib\myexternalapi.lib'
);
========== end =========
------------------------------
Date: 19 Sep 2006 08:29:50 -0700
From: "Wonder" <sapience@gmail.com>
Subject: Re: Question on download by LWP
Message-Id: <1158679790.543779.44670@i42g2000cwa.googlegroups.com>
"John Bokma" <john@castleamber.com> wrote in message
>
> You might want to try:
>
> my $ua = LWP::UserAgent->new(
> agent => 'Mozilla/5.0'
> );
>
> If that gives the same problem, try to use a longer agent, e.g.
>
> my $ua = LWP::UserAgent->new(
> agent => 'Mozilla/5.0'
> . ' (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6)'
> . ' Gecko/20060728 Firefox/1.5.0.6'
> );
>
> (yes, I am going to update after this post :-) ).
Thanks, John. It seems both methods don't work. I got the same "404 not
found" error.
Here is the web page I'd like to access:
http://0daycheck.eastgame.net/0day/archives/20060901.html
>
> Quite some sites block well known "grabbers".
>
>> $CurrentURL = "http://DomainName.com/RemoteFileName.html";
>
> don't use camelcase with Perl (yes, that sounds like a contradiction).
> Also, RemoteFileName.html is not really a filename Also, use example.com
> for examples, don't invent domain names.
>
Sorry, I'm new in this group, and get the habit of camelcase from C++
programming. It's the first time I heard of the perl_style (shouldn't
it be like this?). Thank you for letting me know. I'll be very glad to
conform to it here.
DS: Thank you too for your understanding.
Wonder
------------------------------
Date: 19 Sep 2006 17:43:56 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Question on download by LWP
Message-Id: <Xns9843818488EE1castleamber@130.133.1.4>
"Wonder" <sapience@gmail.com> wrote:
> Thanks, John. It seems both methods don't work. I got the same "404 not
> found" error.
> Here is the web page I'd like to access:
> http://0daycheck.eastgame.net/0day/archives/20060901.html
http://0daycheck.eastgame.net/0day/archives/20060901.html
GET /0day/archives/20060901.html HTTP/1.1
Host: 0daycheck.eastgame.net
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7)
Gecko/20060909 Firefox/1.5.0.7
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=
0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
HTTP/1.x 404 Not Found
Server: Zeus/4.3
Date: Tue, 19 Sep 2006 17:39:10 GMT
Content-Type: text/html
X-Cache: MISS from cache.xal.megared.net.mx
Connection: close
So, yeah, they return a 404 :-) (output via Firefox + live headers
extension).
use strict;
use warnings;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new();
my $url = 'http://0daycheck.eastgame.net/0day/archives/20060901.html';
my $response = $ua->get( $url );
$response->is_success
or $response->code == 404 # ignore 404
or die "Can't get '$url': ", $response->status_line;
print $response->content;
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 19 Sep 2006 10:54:32 -0700
From: "deadpickle" <deadpickle@gmail.com>
Subject: Server/client over a network
Message-Id: <1158688472.701642.271190@k70g2000cwa.googlegroups.com>
what I want to do is have a server on one machine and a client on the
other. I want the client to connect to the server through a tcp network
(over the internet). I have tried this and I constantly get the no
socket error. The program works on the local machine just fine. Also I
am going trough a router but I did forward the ports. Is there
something I need to do to the code? Am I entering the correct values?
Client Side:
for (;;) {
use strict;
use IO::Socket;
my $file =
my $host = shift || 'localhost'; #Enter server IP Address
my $port = shift || 7890; #Enter server port
my $sock = new IO::Socket::INET(
PeerAddr => $host,
PeerPort => $port,
Proto => 'tcp');
$sock or die "no socket :$!";
#--------------/ Socket opened \----------------
$filename=......; # the file to be sent by the server side
$fileout=.....; # the file in which we should place received datas
unless (open (FH_RECEPTION, ">", $fileout)){
die "Unable to create $fileout $!";
}
print $sock "FILE|$filename\n";
my @elem=();
my $all_received;
while (my $line=<$sock>){
chomp($line);
@elem = split /\|/, $line;
if ($elem[0]=~/^FIL\|/){
print FH_RECEPTION $elem[1]."\n";
$all_received=0;
}
elsif ($elem[0]=~/^EOT\|/){
print "Normal End of Transmission received\n";
$all_received=1;
last;
}
elsif ($elem[0]=~/^NACK\|/){
print "ERROR: $elem[1]\n";
last;
}
else {
print "Do not understand|$line\n";
last;
}
}
close($sock);
close(FH_RECEPTION);
if ((defined $all_received) and ($all_received==1)){
print "Everything has been received in $fileout\n";
}
elsif (defined $all_received) {
print "some part of the file has been received in $fileout\n";
}
sleep 5
};
Server Side:
use strict;
use IO::Socket;
my $sock = new IO::Socket::INET(
LocalHost => 'localhost', #server's IP id
LocalPort => 7890, #port to bind socket to
Proto => 'tcp',
Listen => SOMAXCONN,
Reuse => 1);
$sock or die "no socket :$!";
my($new_sock, $c_addr, $buf);
while (($new_sock, $c_addr) = $sock->accept()) {
my ($client_port, $c_ip) =
sockaddr_in($c_addr);
my $client_ipnum = inet_ntoa($c_ip);
my $client_host =
gethostbyaddr($c_ip, AF_INET);
print "got a connection from: $client_host",
" [$client_ipnum]\n";
while (defined ($buf = <$new_sock>)) {
print $buf;
}
}
------------------------------
Date: Tue, 19 Sep 2006 10:11:29 -0700
From: "Steve K." <spamhole@ntp.isc.org>
Subject: Re: String buffer instead of file handle?
Message-Id: <4namm4F9hghkU1@individual.net>
Uri Guttman wrote:
>>>>>> "dc" == danparker276@yahoo com <danparker276@yahoo.com> writes:
>
> dc> Uri Guttman wrote:
> >> >>>>> "dc" == danparker276@yahoo com <danparker276@yahoo.com>
> writes: >>
> dc> actually, I just like to cause trouble. It's pretty funny
> sometimes. dc> A read the docs post is useless post though, why even
> post that at all. >>
> >> cause smart people (unlike you) actually will go read the
> referenced >> doc. it is useful but you wouldn't know that. now
> please go learn python >> and try to be funny there. they appreciate
> people like you. >>
> >> and stop top posting. but better yet, stop posting here. we are
> tired of >> you and you were never entertaining.
> >>
> dc> See there you go again. IT IS NOT IN MY DOCS, because I have an
> older dc> version of perl. My solution is to change my module to
> use a string dc> instead of a file handle. It's easier to change
> the module than go dc> through all that other hassle.
>
> then you can still figure that out from the newer docs on the web. but
> the idea of pointing to the docs is still valid.
True, one could use the online docs, but that doesn't fully apply to
cases like this, as he is using an older version (maybe he has no
choice, as is possible if this is in a work place) so the online docs,
which are for the newest version (though I do believe there are older
versions of docs online as well.) Also, one has to know they exist there
too.
So far, I've seen many regulars tell him to use newer docs, and the OP
repeatedly stated that he's using an older version and what was
recommended wasn't in his docs, so I think one could argue this is a
failure of of the regulars to full read what was being written. Granted,
the OP hasn't behaved exactly angelic either, but I do think we can
agree he at least started out civil enough.
I do NOT, however, condone his conduct in his replies, though he is
clearly of a younger crowd who made his way into computers. Not everyone
has grown up with computers and learned all the ways of doing things as
many here have. And many forget this far too easily.
I think the overall problem that's been plaguing this newsgroup is the
constant rush to judgment about what someone is trying to say (and
perhaps not fully reading and/or comprehending what is being said, and
acting on that. Perhaps this is an inherent flaw in many newsgroups.
------------------------------
Date: Tue, 19 Sep 2006 15:49:47 +0100
From: Graham Wood <graham.removethis.t.wood@andthis.oracle.com>
Subject: Re: where to put dclone
Message-Id: <NLTPg.42$ql6.495@news.oracle.com>
anno4000@radom.zrz.tu-berlin.de wrote:
> Graham Wood <graham.removethis.t.wood@andthis.oracle.com> wrote in comp.lang.perl.misc:
>
>>I have a function that accepts an array reference as an argument and
>>returns 2 array references. I'm "dclone"ing the references so that when
>>I call the function again I'm not using the same references again. As in ...
>
>
> I don't think that's necessary. If it is, there's probably something
> wrong with the sub return_2_refs(). Unfortunately you aren't showing
> the code.
>
Here is the code for the function. Should I dclone something inside here?
Graham
sub construct_filepaths{
my @keys=qw(prod path filename version flag);
my @listing=@{$_[0]};
my %details;
my @paths, @missing;
foreach(@listing){
@details{@keys}=split();
my $filepath=dirname($bom)."/$details{prod}/".
"$details{path}/$details{filename}";
if(-f $filepath){
push(@paths,$filepath);
}
else{
push(@missing,$filepath);
}
}
return(\@paths,\@missing);
}
------------------------------
Date: 19 Sep 2006 16:28:49 GMT
From: xhoster@gmail.com
Subject: Re: where to put dclone
Message-Id: <20060919123011.034$bG@newsreader.com>
Graham Wood <graham.removethis.t.wood@andthis.oracle.com> wrote:
> anno4000@radom.zrz.tu-berlin.de wrote:
> > Graham Wood <graham.removethis.t.wood@andthis.oracle.com> wrote in
> > comp.lang.perl.misc:
> >
> >>I have a function that accepts an array reference as an argument and
> >>returns 2 array references. I'm "dclone"ing the references so that
> >>when I call the function again I'm not using the same references again.
> >>As in ...
> >
> >
> > I don't think that's necessary. If it is, there's probably something
> > wrong with the sub return_2_refs(). Unfortunately you aren't showing
> > the code.
> >
>
> Here is the code for the function. Should I dclone something inside
> here?
>
> sub construct_filepaths{
>
> my @keys=qw(prod path filename version flag);
> my @listing=@{$_[0]};
> my %details;
> my @paths, @missing;
...
> return(\@paths,\@missing);
> }
There is no reason to use dclone either inside or outside that code.
It returns references to fresh arrays each time.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 19 Sep 2006 09:37:16 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: where to put dclone
Message-Id: <1158683836.673442.79930@b28g2000cwb.googlegroups.com>
Graham Wood wrote:
> anno4000@radom.zrz.tu-berlin.de wrote:
> > Graham Wood <graham.removethis.t.wood@andthis.oracle.com> wrote in comp.lang.perl.misc:
> >
> >>I have a function that [...] returns 2 array references.
> >>I'm "dclone"ing the references so that when
> >>I call the function again I'm not using the same references again. As in ...
> >
> > I don't think that's necessary. If it is, there's probably something
> > wrong with the sub return_2_refs(). Unfortunately you aren't showing
> > the code.
>
> Here is the code for the function. Should I dclone something inside here?
> sub construct_filepaths {
> my @paths, @missing;
> return(\@paths,\@missing);
> }
No, there's nothing wrong there so no need for dclone.
Each time &construct_filepaths is called you get a new @paths and
@missing.
See FAQ: "Is it safe to return a reference to local or lexical data?"
------------------------------
Date: Tue, 19 Sep 2006 12:40:11 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: where to put dclone
Message-Id: <45102ab7$0$10297$815e3792@news.qwest.net>
Brian McCauley wrote:
> Graham Wood wrote:
>> anno4000@radom.zrz.tu-berlin.de wrote:
>>> Graham Wood <graham.removethis.t.wood@andthis.oracle.com> wrote in comp.lang.perl.misc:
>>>
>>>> I have a function that [...] returns 2 array references.
>
>>>> I'm "dclone"ing the references so that when
>>>> I call the function again I'm not using the same references again. As in ...
>>> I don't think that's necessary. If it is, there's probably something
>>> wrong with the sub return_2_refs(). Unfortunately you aren't showing
>>> the code.
>> Here is the code for the function. Should I dclone something inside here?
>
>> sub construct_filepaths {
>> my @paths, @missing;
>
>> return(\@paths,\@missing);
>> }
>
> No, there's nothing wrong there so no need for dclone.
Except for:
>> my @paths, @missing;
Graham, add the following to your code, to point out the issue with that
line.
use strict;
use warnings;
------------------------------
Date: 19 Sep 2006 17:41:30 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: where to put dclone
Message-Id: <4naoeaF9ilc4U1@news.dfncis.de>
<xhoster@gmail.com> wrote in comp.lang.perl.misc:
> Graham Wood <graham.removethis.t.wood@andthis.oracle.com> wrote:
> > Here is the code for the function. Should I dclone something inside
> > here?
> >
> > sub construct_filepaths{
> >
> > my @keys=qw(prod path filename version flag);
> > my @listing=@{$_[0]};
> > my %details;
> > my @paths, @missing;
> ...
> > return(\@paths,\@missing);
> > }
>
> There is no reason to use dclone either inside or outside that code.
> It returns references to fresh arrays each time.
Another XY problem solved.
Anno
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 9741
***************************************