Help - Search - Member List - Calendar
Full Version: combinations
WorkTheWeb Forums > Webmaster Resources > Perl Beginner Help
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44
Support our Sponsors!
Rob Dixon
Joseph wrote:
QUOTE

Rob Dixon wrote:

Not exactly a transparent piece of code though is it. Especially
if your base system isn't Unix!

Works jusat fine on Windows, although it helps to have a longer list,
since this gets p[rocessed really fast, too fast to see what's going
on.  Try increasing the loop count to 40.

Hi Joseph.

Yes, it may work well on Windows (and that's useful to know)
but my point still stands.

perldoc -f select

says

select RBITS,WBITS,EBITS,TIMEOUT
This calls the select(2) system call with the bit masks
specified

Now, if your platform has no such thing as a 'select(2) system call' you
shouldn't really be using the built-in without a proper wrapper and
copious comments to prove that you know what you're doing.

Rob

Jeff 'Japhy' Pinyan
On Nov 16, drieux said:

QUOTE
select FILEHANDLE
select  Returns the currently selected filehandle.  Sets the
current default filehandle for output, if FILEHANDLE
is supplied.  This has two effects: first, a "write"
or a "print" without a filehandle will default to
this FILEHANDLE.

And yes, DO remember the caveat at the end of the select
perldoc that notes:

WARNING: One should not attempt to mix buffered I/O
(like "read" or <FH>) with "select", except as
permitted by POSIX, and even then only on POSIX
systems.  You have to use "sysread" instead.

That's out of context; that warning is for the multi-arg for of select().

--
Jeff "japhy" Pinyan [Email Removed] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]

Jeff 'Japhy' Pinyan
On Nov 16, Hacksaw said:

QUOTE
The fact that select has two incompatible meanings in perl is a
mistake. If I were going to rename them, I'd call the default output
changing command defout or default_output. As for the C lib function,
I'd call it readydesc or ready_descriptors.

I think 'select' is an apropos name for selecting the default output
filehandle. I think it's less appropriate for determining which file
descriptors are ready.

QUOTE
Personally, I am curious what whoever wrote that default ouput version
was thinking of when they wrote it. What's the intended usage?

Probably for when you're using code that you haven't written that writes
to the default output filehandle.

--
Jeff "japhy" Pinyan [Email Removed] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]

Drieux
On Sunday, Nov 16, 2003, at 10:41 US/Pacific, Jeff 'japhy' Pinyan wrote:
[..]
QUOTE
And yes, DO remember the caveat at the end of the select
perldoc that notes:

WARNING: One should not attempt to mix buffered I/O
(like "read" or <FH>) with "select", except as
permitted by POSIX, and even then only on POSIX
systems.  You have to use "sysread" instead.

That's out of context; that warning is for the multi-arg for of
select().

yes and no.

yes, in the sense that it comes in the section about

select RBITS,WBITS,EBITS,TIMEOUT

and as long as the person stays safely with the 'simpler'
perl select, and does not wander off into having buffered
and unbuffered file handles, then clearly it is "out of context".

But I would also argue 'no' in that the moment that one
wanders into 'needing' to use "select", it is really not
that long a walk off a very short pier till one has to
remember the differences between buffered and unbuffered I/O.
At which point remembering the caveat is worth it,
whether or not one has actually stepped into the fullness
of the 'multi-arg' form of select.

For me, it has been years since i have used perl's 'write',
yet I have watched "RealCoders[tm]" - 'hurt themselves', myself
included - because what started out as 'just some script' -
and were running with the 'print' statements going to the
default file handle... only to step on the default with
a select statement, for a filehandle we were using with
sysread and NOT doing the polite thing and restoring the
default file handle.

So my intention was to finish off the general discussion
of 'do you really need select' with that simple reminder
that when one does need select, one also needs to do some
basic defensive coding one place or the other. Since for
'RealCoders[tm]' coming to perl it is easier to slip into
'perl coding' without thinking, because they have access
to POSIX, et al, and most of the time the DWIM is correct,
then they run into an 'ooopsie' moment. While those who arrive
at Perl from a 'scripting' background can wander off into sysread()
without any of the 'RealCoders[tm]' well defined notions of 'best
practice';
to honor in the breach...

So why not underscore the "we have good news and we have
information...."

ciao
drieux

---

Hacksaw
QUOTE
So my intention was to finish off the general discussion
of 'do you really need select' with that simple reminder
that when one does need select, one also needs to do some
basic defensive coding one place or the other.

This post goes a ways to showing why unthinking operator overloading
is a bad idea.

The fact that select has two incompatible meanings in perl is a
mistake. If I were going to rename them, I'd call the default output
changing command defout or default_output. As for the C lib function,
I'd call it readydesc or ready_descriptors.

Personally, I am curious what whoever wrote that default ouput version
was thinking of when they wrote it. What's the intended usage?

Jeff 'Japhy' Pinyan
On Nov 16, R. Joseph Newton said:

QUOTE
sometimes.  The perfect setup for the great Perl anonymous block:

{
$| = 1;
.... do  stuff that really needs to be autoflushed
}  # Get things back to normal

I think you want a 'local' in front of that $| line.

{
local $| = 1;
# ...
}

--
Jeff "japhy" Pinyan [Email Removed] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]

R. Joseph Newton
Douglas Houston wrote:

QUOTE
On Fri, 14 Nov 2003, Jeff 'japhy' Pinyan wrote:

On Nov 14, Douglas Houston said:

I am trying to initialize a dynamically-named array,

You need to explain WHY you want to do this.  There doesn't seem to me to
be a good reason.  Use a hash of array references.  Don't turn off strict.


WHY do I need to explain why I want to do this?

Because you are asking people to take valuable time to help you.

Joseph

R. Joseph Newton
Wiggins d Anconia wrote:

QUOTE
Douglas Houston [mailto:[Email Removed]]
:
: WHY do I need to explain why I want to do this?

Because no one wants to give a loaded gun to
someone who hasn't demonstrated a good grasp of
gun safety.



That is a very ironic response coming from someone who based on their
sig I assume is in the US, going to someone based on their address
appears to be in the UK... who'd a thunk it...

Yeah. Just wish the same hesitancy was true in the converse. Lots of
loaded guns, each equuipped with its own bio-bot, were recently placed in
the hands of folks who clearly lacked any grasp of gun safety, or much
else. Cheers to the UK and its top lapdog! I think a lot of Anglophones
on either side of the river have reason to feel shame.

Joseph

R. Joseph Newton
Steve Grazzini wrote:

QUOTE
use strict;
my $name = 'foo';

$::{$name} = [1,2,3];      # LHS is a glob
print "@{ $::{$name} }n";

no strict 'vars';
print "@foon";

Cool. The "Second Amendment" response ;-o)

Joseph

R. Joseph Newton
david wrote:

QUOTE
David wrote:

this normally can't be done cleanly and is generally not recommanded
given there are other ways to accomplish bascially the same thing.

Steve Grazzini wrote:


But why use the symbol table at all?  That's more dangerous

didn't i already mention that? :-)

david
--
$_='015001450154015401570040016701570162015401440'
,*,=*|=*_,split+local$";map{~$_&1&&{$,<<=1,$#.=qq~
/63968e72w28@_[$_..$||3])=>~}}0..s,.,,g-01;*_=*#,s
[[s/eval+w/.`9`/e]]n\xng.print+eval(eval"qq`$_`")

Speaking of dangerous:

Greetings! E:d_driveocfdiscussprototype>perl -w
$_='015001450154015401570040016701570162015401440'
,*,=*|=*_,split+local$";map{~$_&1&&{$,<<=1,$#.=qq~
Use of $# is deprecated at - line 2.
/63968e72w28@_[$_..$||3])=>~}}0..s,.,,g-01;*_=*#,s
[[s/eval+w/.`9`/e]]n\xng.print+eval(eval"qq`$_`")

^Z
Use of implicit split to @_ is deprecated at - line 1.
Useless use of concatenation (.) or string in void context at - line 3.
Use of uninitialized value in regexp compilation at - line 1.
Use of uninitialized value in join or string at - line 2.
Use of uninitialized value in join or string at - line 2.
.....

Greetings! E:d_driveocfdiscussprototype>perl
$_='015001450154015401570040016701570162015401440'
,*,=*|=*_,split+local$";map{~$_&1&&{$,<<=1,$#.=qq~
/63968e72w28@_[$_..$||3])=>~}}0..s,.,,g-01;*_=*#,s
[[s/eval+w/.`9`/e]]n\xng.print+eval(eval"qq`$_`")

^Z
hello world
Greetings! E:d_driveocfdiscussprototype>

R. Joseph Newton
drieux wrote:

QUOTE
yes, in the sense that it comes in the section about

select RBITS,WBITS,EBITS,TIMEOUT

and as long as the person stays safely with the 'simpler'
perl select, and does not wander off into having buffered
and unbuffered file handles, then clearly it is "out of context".

But I would also argue 'no' in that the moment that one
wanders into 'needing' to use "select", it is really not
that long a walk off a very short pier till one has to
remember the differences between buffered and unbuffered I/O.

I think it is much more rare than you would picture it that one has to
wallow in such esoterica. A little encapsulation can do wonders. For
instance, autoflush is not on by default. There are very good reasons to
have it off by default. There are also sometimes good reason to turn it on
sometimes. The perfect setup for the great Perl anonymous block:

{
$| = 1;
.... do stuff that really needs to be autoflushed
} # Get things back to normal

Joseph

R. Joseph Newton
Jeff 'japhy' Pinyan wrote:

QUOTE
On Nov 16, R. Joseph Newton said:

sometimes.  The perfect setup for the great Perl anonymous block:

{
$| = 1;
.... do  stuff that really needs to be autoflushed
}  # Get things back to normal

I think you want a 'local' in front of that $| line.

{
local $| = 1;
# ...
}

Yep. Thanks for the correction.

Joseph

Rajesh Dorairajan
Forgive me for not making myself clear in the first place. What I'm trying
to do is create a Test framework for a server-class product that validates
digital certificates using Perl. I've a driver script that reads
configuration variables from an XML file using XML::Simple and execute a
bunch of tests on the server based on pre-set configuration variables. My
effort is to build an optimal, extensible test-suite, whereby I'll develop a
reasonably generic framework to which others (developers) can contribute
tests in future. This framework will also allow me to execute some tests and
skip others based on my requirements. The need to "pass variables" mainly
arises because I build relative paths to various directories in my
configuration file and the test scripts will need these values based on the
tests executed. One approach would be initialize all these values into
environment variables in my driver script. But this did not appeal to me as
an optimal approach. Can you share your ideas on this approach?

I have written Perl modules, which export specific functions. These
functions will be called from my test scripts based on the test-case being
executed. I also use standard CPAN-modules such as LWP and OpenCA::OpenSSL
in my test-suite.

That said, the issue I'm facing is to create atomic test scripts that'll be
executed by my driver script based on some configuration file (such as
MANIFEST). These atomic scripts will import functions (and variables) from
the modules I've created and also from standard CPAN-modules as and when
necessary. I am looking for a mechanism whereby I can integrate these test
scripts with my driver program. Right now I've this huge driver program
where the tests are executed in sequence. To this extent I tried resuing the
capability already available in Test::Harness (instead of re-inventing the
wheel). But as Wiggins mentioned in an earlier mail, Test::Harness does not
allow variables to be "exported" to test scripts. So, I'm trying to find a
mechanism to overcome this problem.

Hope I gave a better picture. Till now I've been going around in circles and
getting frustrated in the process. So, I decided to seek help from Perl
experts such as you :) I am trying to find out how I can go about
architecting the whole thing.

Thanks a lot for your valuable feedback. I am going through the test scripts
of LWP too.

Best Regds

Rajesh Dorairajan

-----Original Message-----
From: drieux [mailto:[Email Removed]]
Sent: Friday, November 14, 2003 3:54 PM
To: begin begin
Subject: An Alternative to Test::Harness was Re: external sub routine



On Friday, Nov 14, 2003, at 13:59 US/Pacific, Rajesh Dorairajan wrote:
[..]
QUOTE
All I want to do is:

#Create a logger object and log a message using log4perl
#call the function and check the $retval
#if $retval == 1 $logger->info("Test succeded")
#else $logger->warn( "Test failed" )

I've a bunch of such scenarios and I wish to have them in files
like 0.t, 1.t, 2.t....
[..]
As you can gather I am building a Test suite using
Perl and would like to reuse mechanism used to test perl modules.
In short I want to do something like:

#main.pl

#loop through MANIFEST and read contents into @tests
#runtests from @tests

#0.t
sub test1 {
my ( $foo ) = shift;
#initialize logger object
#call a function from module bar::somebar
#if success log success
#if failure log failure
}

The key requirement is that the .t files must capable of acquiring
values
from main.pl. Is this possible?

This is an interesting approach, forgive me if I need
a bit more information on how you are looking at the
issues of what is being passed into your test harness.

what I gather so far is that you have a directory with
the basics in it

Makefile.PL
Somebar.pm
MANIFEST
t/
0.t...

Traditionally when I am doing static code coverage
of that Somebar.pm { one should use at least one
capital in the Module Name, since all lower case
is reserved for pragma. } with the usual

perl Makefile.PL
make test

Or when you are talking about testing a perl module
is there some other context I am not seeing here????

I am thinking in terms of having named files in
the t/ that deal with specific code cases, eg:

t/exception.t

would deal with checking the list of all of the
'exceptions' that it should be handled gracefully.
This way I actually put all of the information in there
that needs to be tested. IF I add a new function/method
and need to check that it will manage all 'n' new exception
cases I merely update that file with 'n' new specific cases.

The files in the t/ directory then become the 'configuration'
information as well as the executable.

I'm not sure that I see what 'value' is added by trying
to make those tests more 'dynamic' by reading from one
file and passing in additional information to the test
that will then test the Module in that directory.

So my problem is less with the idea of using log4perl
to provide additional logging than what exactly this
'testing harness' that is going to be in the 'main.plx'
is suppose to be all about....

Hum... have you looked into say the
libwww-perl where in the t/net section
it has the neat tricks about having a

require "net/config.pl";

that defines a set of "global" values
that are common to the set of tests.

{ cf <http://search.cpan.org/~gaas/libwww-perl-5.75/> }

This allows the basic Test::Harness
approach, and has a way that common values
are available to the several different test cases.

That might be a strategy that you will find
worth investigating.



ciao
drieux

---


--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]

Roberts Mr Richard L
anyone know anything about installing ModSurvey?

thanks in advance
Richard

-----Original Message-----
From: Jeff Kowalczyk [mailto:[Email Removed]]
Sent: Wednesday, November 19, 2003 11:14 AM
To: [Email Removed]
Subject: pydoc-like tool to generate html from uncommented perl cgi
source code


I'm trying to find a simple tool to run over a CGI perl application and
output hyperlinked index of source code at the function level, preferably
syntax-colored.

None of the files are formally commented at this point, so tools like
NaturalDocs are not going to give anything back. robodoc isn't outputting
anything but blank html files either, although I'm still working out why.

There is one directory of proper .pm perl modules (pdoc does very well
here) and a bunch of other .pl scripts representing the functions that
output the html UI.

Every search leads me back to the perldoc web site or the perldoc utility,
which AFAICT is a (POD) documentation browser, not a generator using code
parsing or introspection.

Any links to tools suitable for documenting CGI perl would be greatly
appreciated, thanks.


--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]

On Friday, Nov 14, 2003, at 02:29 US/Pacific, [Email Removed]
wrote:

QUOTE
When writing HTML in perl can you interpolate the html with perl code
or do you have to write the whole script in perl with each tag within
a prel print() function.  The importance of this is layout, nested
tables,
design view in Dreamweaver etc etc - Dreamweaver 4 cannot render the
code
in design view.

From: drieux [mailto:[Email Removed]]
Sent: 15 November 2003 17:13

I'm not sure I follow what you mean by 'interpolate the html'.

Allow me to illustrate, I have a piece of perl cgi code
that I use to simplify my bloging,

[jeeves: 59:] lwp-request http://www.wetware.com/drieux/PR/blog2/Code/
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html;
charset=iso-8859-1">
<title>Perl One, Code Two, it is knitting</title>
<base href="http://www.wetware.com/drieux/PR/blog2/Code/"
<META http-equiv=Cache-Control content=no-cache>
<META http-equiv=Pragma content=no-cache>
</head>
<frameset rows="122,*" >
<frame name="BlogHead" src="header.html">
<frameset cols="120,*"><frame name="VertNav"
src="../bin/vertNav.cgi?dir=Code">
<frame name="BlogSpace" src="200311.html">
</frameset>
</frameset>
</html>[jeeves: 60:]

everything gets set up and then a Print Statement sends
the whole scalar $page out the door. As you will note,
the above sets up 'framesets' and as such would require
the browser to make all of the additional calls, and
then based upon what the browser is doing, render that
for the human to see.

So, please help us help you.

ciao
drieux

Hi Drieux and thanks for the subject line, which I forgot in the effort to avoid legal notices/footers.

Here is an example of what I do in php:

<body>
<?
if($x=1){print("this")}else{print("that");}
?>
<font size=1>Print this anyway</font>
</body>

The code bits are executed on the server of course. Is there an equivalent of the <? ?> tags to start and stop code writing in perl?

Thanks,

John

Tim Johnson
Okay, this was such a pain in the buttocks that I decided to post the
"final" code. (I'll tweak it a bit later, but this is functional) My
apologies to someone, I found the pack(),unpack() part on the Internet,
and I'm not sure who the original author is.

####################################################

use strict;
use warnings;
no warnings qw(uninitialized);
use Win32::OLE qw(in);
use Win32::OLE::Variant;
use Tim::Date_Time;
use Tim::GetClients;

my @dc = qw(dc1 dc2 dc3 dc4);
print "nnFinding all available DCs...nn";
for(0..$#dc){
unless(GetClients::Ping($dc[$_])){
delete $dc[$_];
}
}
my %users;

foreach my $dc(@dc){
print "Checking $dc";
my $ADUser = Win32::OLE->GetObject("LDAP://$dc/OU=Groups and
Users,OU=HQ,DC=domain,DC=com") || die;
foreach(in($ADUser)){
unless($_->{objectCategory} =~ /Group/i){
my $lastlogon = $_->{lastLogon};
my $name = $_->{name};
my $lastlogontime = 1;
if($lastlogon){
my $Hval = $lastlogon->{HighPart};
my $Lval = $lastlogon->{LowPart};
my $Factor = 10000000; # convert to seconds
my $uPval = pack("II",$Lval,$Hval);
my($bVp, $aVp) = unpack("LL", $uPval);
$uPval = ($aVp * 2**32 + $bVp)/$Factor;
$lastlogontime = $uPval - (134774*86400);
#convert to Perl time
}
print ".";
$name =~ s/^CN=//;
push @{$users{$name}},$lastlogontime;
}
}
print "nn"
}

open(OUTFILE,">lastlogon.csv") || die;
print "Finding last logon...n";
foreach(sort keys %users){
my $name = $_;
my $lastlogon;
foreach my $logon(@{$users{$_}}){
if($logon > $lastlogon){
$lastlogon = $logon;
}
}
$lastlogon = (Date_Time::SimpleDT($lastlogon))[0];
print OUTFILE "$name,$lastlogonn";
}
close OUTFILE;

######################################################

Drieux
On Monday, Nov 17, 2003, at 00:27 US/Pacific, Rajesh Dorairajan wrote:

QUOTE
Forgive me for not making myself clear in the first place.

forgive me for having to defer a response,
But this is a really interesting problem and
still requires a bit of thinking.

QUOTE
What I'm trying to do is create a Test framework for a
server-class product that validates digital certificates using Perl.

Not a bad idea.

QUOTE
I've a driver script that reads
configuration variables from an XML file using XML::Simple and execute
a
bunch of tests on the server based on pre-set configuration variables.
My
effort is to build an optimal, extensible test-suite, whereby I'll
develop a
reasonably generic framework to which others (developers) can
contribute
tests in future. This framework will also allow me to execute some
tests and
skip others based on my requirements.

Oh not simple, but ultimately a reasonablish approach.
What concerns me here is whether

there needs to be more XML or less

a point I will address later on.

QUOTE
The need to "pass variables" mainly
arises because I build relative paths to various directories in my
configuration file and the test scripts will need these values based
on the
tests executed. One approach would be initialize all these values into
environment variables in my driver script. But this did not appeal to
me as
an optimal approach. Can you share your ideas on this approach?

The idea of passing them through the environment is
very UGLY.

QUOTE
That said, the issue I'm facing is to create atomic test scripts
that'll be
executed by my driver script based on some configuration file (such as
MANIFEST). These atomic scripts will import functions (and variables)
from
the modules I've created and also from standard CPAN-modules as and
when
necessary. I am looking for a mechanism whereby I can integrate these
test
scripts with my driver program. Right now I've this huge driver program
where the tests are executed in sequence. To this extent I tried
resuing the
capability already available in Test::Harness (instead of re-inventing
the
wheel). But as Wiggins mentioned in an earlier mail, Test::Harness
does not
allow variables to be "exported" to test scripts. So, I'm trying to
find a
mechanism to overcome this problem.

Hope I gave a better picture. Till now I've been going around in
circles and
getting frustrated in the process. So, I decided to seek help from Perl
experts such as you :) I am trying to find out how I can go about
architecting the whole thing.
[..]


{ note: I was actually afraid we were off on this adventure... }

I think you may actually have a couple of core 'design issues'
that you may want to think through here. You might want to
step back and review some of your assumptions. Similarly
you might want to look at the 'jam project',
cf
<http://www.perforce.com/jam/jam.html> which is written,
unfortunately in 'c' - but it may help your thinking,
the idea here is to create the 'input' that will be used by Make
without having the coder understand all of the arcanea Make, hence
it is a two step process

jam
make

You may want to think in a similar manner as to which part of the
problem your Generic Test Harness is really trying to solve.

I was involved with 'jel' which was a perl based variation of
the jam. That project turned out to have about 15 or so Perl Modules
in the "Project" namespace. { oh dear, I still have some of
that code, which is the giggler of answering this... 8-) }
our 'jel' of course was essentially a simple piece of code,
in of and by it self that basically did:

my $result = eval "use lib '.top'; require './Jelfile.pm';";

Everything Before and after that was the usual sorts of

die "$prog error: No Jelfile.pm in $pwd.n" unless (-f 'Jelfile.pm');

and what did we get for $result, and the various switches
based upon OS specific

if ($Config{'osname'} ne 'MSWin32') {...}

The Money Maker was turning non-perl coders into, perl coders
without TELLING THEM that was what was happening, since they
merely had to create a 'Jelfile.pm' that would use the appropriate
perl module call outs, and then invoke the right types of methods
with the sorts of things one needs to create a real Makefile
with all the required smack in it.

So if you thought of the problem in the form of say

corp_name_test_harness - a simpler driver script
{ note my presumption is that one would grow this out
with Getopt::Long to take alternative config information
and/or additional stuff. }

as being little more than an fancy wrapper that does an 'eval'
with some appropriate tests for

a. the xml_configfile.conf - the default xml_config file name
b. the corp_test_case.pm - the default "thing to be eval'ed"

then what you wind up getting into is a slightly more maintainable
strategy, i think, where all you have to do is worry about
the name space issues. So for you

sub test1 {....}

if that is merely a 'method' in say

Dtk::Project::Network

we wind up getting the corp_test_case.pm to
look like say

use Dtk::Project::Network;
use Dtk::Project::XmlParser;

my $xml_conf_obj = new Dtk::Project::XmlParser;
my $network_test = new Dtk::Project::Network;

my $arg_hash_ref = $xml_conf_obj->read_config();

while( my ($k,$v) = each % $arg_hash_ref )
{
$network_test->test1($v);
....
}
....
1;

or something along that line.

This way you wind up source code controlling all of the
base tests in the Perl Modules that are 'required'
and passing those Config Values in from the XML document
and the various corp_test_case.pm files passed in at the command line.

This way when suddenly you need to add in

test_2365($v);

put that in the Dtk::Project::Network module, add the
line to the corp_test_case.pm - fire it up...

This way you wind up with a test tree looking like

../network_test/
goodie_stuff/xml_configfile.conf
the corp_test_case.pm
...
wingnut/xml_configfile.conf
the corp_test_case.pm
../local_side_test/
mainstream/xml_configfile.conf
the corp_test_case.pm
....

put it all under source code control, and anyone can check it out...
And you have total replicatability...

"easy as cake"
- 2010

ciao
drieux

ps: do not try this at home boys and girls these
are paid professionals using the latest in sasckatchean
salmon skin safety equipment...

Drieux
On Saturday, Nov 22, 2003, at 16:18 US/Pacific, Randal L. Schwartz
wrote:
[..]
QUOTE
It's just that we keep seeing this over and over again.  That's the
point
of the FAQ.  What happened to the ethic of even ATTEMPTING to look
for a local FAQ before posting to a list.

{sigh}

I think a part of the problem is the willingness
of some of us to 'respond' to questions, without
always thinking about the need for some discipline
about what is IN the POD and FAQ.

a part of that problem is also the fact that
most folks just don't understand 'perldoc'
let alone 'perldoc -q mail' to query the
faq that they have for things related to mail.

The other side of this may be tied up with the
lack of awareness about the CPAN, and that some
of these problems are that OLD, and keep
coming around on the list as new folks show
up and need to be taught the standards

a. how to ask an effective question
b. what resources are available
c. how to use those resources

Then there is also the 'age' problem, since
RFC822 is, well, not a Young RFC and is from
a time before time was known, or at least
closer to the Epoch than now. While at the
same time RFC2822 was reserved for the expected
day when an extension would be needed for things
no one could think about in those dark days when
we all beat out code the old fashion way with a stick
on a flat rock... And Consensus was based upon the
last person standing and all of that...

ciao
drieux

---

Randal L. Schwartz
QUOTE
"Drieux" == Drieux  <[Email Removed]> writes:

Drieux> Then there is also the 'age' problem, since
Drieux> RFC822 is, well, not a Young RFC and is from
Drieux> a time before time was known, or at least
Drieux> closer to the Epoch than now.

That doesn't mean that it doesn't apply, just because of its age. And
by that thinking, RFC2822 which supports and clarifies RFC822 for
current practices, is a relatively "young" RFC.

No, that doesn't fly with me.

By the way, my previous reply wasn't meant to go to the list. Never
answer email while tired. :) It was more venting than instructing.
I apologize for the way it sounded.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +
<[Email Removed]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Drieux
On Sunday, Nov 23, 2003, at 08:11 US/Pacific, Randal L. Schwartz wrote:

QUOTE
"Drieux" == Drieux  <[Email Removed]> writes:

Drieux> Then there is also the 'age' problem, since
Drieux> RFC822 is, well, not a Young RFC and is from
Drieux> a time before time was known, or at least
Drieux> closer to the Epoch than now.

That doesn't mean that it doesn't apply, just because of its age.  And
by that thinking, RFC2822 which supports and clarifies RFC822 for
current practices, is a relatively "young" RFC.

No, that doesn't fly with me.

As it should not. It was a Specious Argument put
into play for two basic purposes:

1. It also points out the old way,
in which the RFC system was 'designed' to carry not
only the current debates about internet standards,
but as in the case of Email that they were expecting
that there was going to NEED to be a re-write and
re-clarification and had reserved the RFC.

2. That the accumulated 'wisdom' and 'best practices'
didn't just fall out of the sky and wind up written
on stone tablets by SpaceAliens From Planet Zorkonon.
While unfortunately there is also the minor problem
that explaining Why that Way will lead into PAIN is
far too difficult a task for most humans; if for
no other reaason than that Folly is Infinite.

The POD and FAQ systems were instituted to help with
the basic practice of trapping knowledging so that
it could be looked up and re-used. As most would
notice with

perldoc -q "mail address"

there is that line in it:

Many are tempted to try to eliminate many frequently-
invalid mail addresses with a simple regex, such as
`/^[w.-]+@([w.-].)+w+$/'. It's a very bad idea.
However, this also throws out many valid ones, and says
nothing about potential deliverability, so is not sug-
gested.

Without Pausing to 're-read' that in the sense of
how it applies to the problem of "extracting email addys"
and that at best one can use some regular expression matching
approaches to get 'close' to a list of possible email address
that will then need to be 'refined'. In much the same way that
we have watched the

So how do I do the regEx to get the 'domain portion'
of a URL...

and then having the minor 'oopsie' with things like
'nas.nasa.gov' which IS the 'domain portion' even IF
it does not look like 'what most of my common experience'
has been with the "foo.<TLDN>" ...

QUOTE
By the way, my previous reply wasn't meant to go to the list.  Never
answer email while tired. :)  It was more venting than instructing.
I apologize for the way it sounded.

My Apology for the OOOPSIE moment of returning
it to the wrong group. But a part of the problem
has always been

Improving the Quality of Newbies!

And the concomitant problem,

Improving the Quality of those trying to Help Newbies!

As an illustration, someone here was polite enough to
help me understand the jargon about 'not doing someone
elses homework' - so at times I remember that when I
am looking at questions raised here.

As for your 'venting' I think I will put that on one
of two lists

growing evidence that Randall Schwartz might
actually be a human and not a computer programme
or
deeply emotionally traumatizing thingiePoo
for which I need to schedule more Therapy...

the jury is still out.

In the future, you might wish to adopt the strategy of say

"LAME! LAME! LAME!"
formerDrieuxishUnterStumpenFumbler[1]

{ provides a REALLY good emotive venting, without the
overall angst laden questions about morality, the cosmic
alignment of Divine Omniscience, and WhatEver... }

Since, while the 'proposition' put foward would kinda
wander in the right direction offering some sort of
'solution' like behavior, it lacks both experience
and elan at solving the 'core problem', and will,
overtime, shrival for all the underlying reasons
cited in the POD and FAQ.

As for expanding on what is in the POD and FAQ that
is a totally different topic for hurranging, and
actually provides a Much better approach to raising
a question

"Why exactly does <faq_tag_here>, which asserts
<faq_assertion_here>, mean in 'real terms',
I am trying <illustration> and ...."

So If folks, both newbies and those trying to help them,
were to remember the POD and FAQ data better, then we
of course would not wandering into this class of problem
on the semi-regular basis that we do.

ciao
drieux

---

[1] I of course provide attribution by indirection,
since I am not sure that my UnterStumpenFumbler
has fully recovered from the usage of that phrase
in professional contexts...

Jason Dusek
Begin forwarded message:

QUOTE
From: Jason Dusek <[Email Removed]
Date: Sat Nov 22, 2003  10:10:27  PM US/Central
To: drieux <[Email Removed]
Subject: Re: POD, Faq and tradition - Re: extracting email addys.

Hey People,

On Saturday, Nov 22, 2003, at 16:18 US/Pacific, Randal L. Schwartz
wrote:
[..]
It's just that we keep seeing this over and over again.  That's the
point
of the FAQ.  What happened to the ethic of even ATTEMPTING to look
for a local FAQ before posting to a list.

{sigh}

Maybe there is some way to get the FAQ to respond to messages on the
list - that way we wouldn't need to understand 'perldoc' and so forth.
We newbies could just send the thing out to the list, and everyone
could ignore it in good conscience.  If the FAQ didn't help us, we
could always repost with a note about "BadFAQ" in the subject line.

Of course some newbies are lazy, but but most of us are really
motivated by practicality.  We often have no background in using the
FAQ.  You might write our heuristic as:

if ( work_to_figure_out_faq > work_to_figure_out_problem ) {
  &AskList();
} else { &AskFAQ(); }

To put it another way: if I surmise that it is easier (and faster) for
me to ship the problems out to you guys than it is for me to figure
out the FAQ, then most of the time that's what I'm going to do.  This
is somewhat despicable I suppose - but I have work to do.

And on another note, what good are gurus who refuse to help the
humblest neophytes in their stumblings?  Is it not the purpose of this
list to assist the ignorant, the lame and even the stupid as they seek
out the one true Perl?  This isn't the 'true masters' list after all.

- Jason

A Zen student asked Ummon: "You know what I like to do when I get
really depressed?"
Ummon replied: "No, what?"
"I like to turn on the TV and watch a really bad movie," answered the
student.
"Thats a funny thing to want to do," said Ummon.
The student smiled and said: "I know."
  -Mike Topp


R. Joseph Newton
Jason Dusek wrote:

QUOTE
Begin forwarded message:

[snip total mystery]

Drieux,

Why is there no Resent-By field in this message? I have no problem with
redirecting messages back to the list--it is a god custom for a variety of
reasons. The path should not be a mystery. If you peruse again the
document under discussion, you should note A.3. Resent messages:

A.3. Resent messages
Start with the message that has been used as an example several
times:

----
From: John Doe <[Email Removed]>
To: Mary Smith <[Email Removed] <mailto:[Email Removed]>>
Subject: Saying Hello
Date: Fri, 21 Nov 1997 09:55:06 -0600
Message-ID: <[Email Removed]>

This is a message just to say hello.
So, "Hello".
----

Say that Mary, upon receiving this message, wishes to send a copy of
the message to Jane such that (a) the message would appear to have
come straight from John; (b) if Jane replies to the message, the
reply should go back to John; and © all of the original
information, like the date the message was originally sent to Mary,
the message identifier, and the original addressee, is preserved. In
this case, resent fields are prepended to the message:

----
Resent-From: Mary Smith <[Email Removed] <mailto:[Email Removed]>>
Resent-To: Jane Brown <[Email Removed]>
Resent-Date: Mon, 24 Nov 1997 14:22:01 -0800
Resent-Message-ID: <[Email Removed]>
From: John Doe <[Email Removed]>
To: Mary Smith <[Email Removed] <mailto:[Email Removed]>>
Subject: Saying Hello
Date: Fri, 21 Nov 1997 09:55:06 -0600
Message-ID: <[Email Removed]>

This is a message just to say hello.
So, "Hello".
----


It is pretty clear here that transparency of the path is featured. In this
forwarded message, I had to dig through the trace fields to find who
actually put in on the line. This is something I usually have to do only
when tracking down spammers and virus-senders. Please try to make your
posts compliant with these standards. It would particularly aid
comprehesibility if your mailer and mailing ractices would reflect an
understanding of A.2

A.2. Reply messages

The following is a series of three messages that make up a
conversation thread between John and Mary. John firsts sends a
message to Mary, Mary then replies to John's message, and then John
replies to Mary's reply message.

Note especially the "Message-ID:", "References:", and "In-Reply-To:"
fields in each message.

....

Joseph

Drieux
On Sunday, Nov 23, 2003, at 11:22 US/Pacific, R. Joseph Newton wrote:
[..]
QUOTE

Why is there no Resent-By field in this message?
[..]


do you mean the email that Jason sent to the
list having first sent it to me, not noticing that
he had meant to send it to the list?

Or the fact that Jason may have dug the original
email he sent to me, and simply clicked the forward
button with the address to the list? And that while
it may have had any number of lines enroute to the
'[Email Removed]' that their software may not have
retained that information????

So which is your real issue here that has you
concerned? The fact that this can be done? Or that
there are marketting mumblers out there who think
that they can productize some sort of mail application
at both the user level and at the transfer agent level
that would be able to prevent this from happening
pursuant to the expectation that this would prevent
some of the corporate scandals that arise when email
leaks, etc, etc, etc, and hence be a viable 'bizniz plan'.

ciao
drieux

---

R. Joseph Newton
drieux wrote:

QUOTE
On Sunday, Nov 23, 2003, at 11:22 US/Pacific, R. Joseph Newton wrote:
[..]

Why is there no Resent-By field in this message?
[..]



....

QUOTE

So which is your real issue here that has you
concerned? The fact that this can be done? Or that
there are marketting mumblers out there who think
that they can productize some sort of mail application
at both the user level and at the transfer agent level
that would be able to prevent this from happening
pursuant to the expectation that this would prevent
some of the corporate scandals that arise when email
leaks, etc, etc, etc, and hence be a viable 'bizniz plan'.

ciao
drieux

Nothing that complex. My issue is comprehesibility of the flow of
discussion on this list. Threading is a specific factor in that
comprehensibility. I am somewhat fatalistic when it comes to newbies.
Obviously, people who are just getting there feet in the water cannot be
expected to be aware of the structure of mail transmission. Most mail
clients [wisely] hide about 80% of the metadata sent. I would hope
though, that those who come on the list as helpers, and assume an air of
deep experience, would recognize those standards most pertinent to clear
communication. I am convinced that the two appendices I cited are the
most critical to cogent tracking of the discussions posted here.

Any one post may touch on issues which, quite reasonably, follow
different paths of development. When the threads of reference are
properly maintained, these threads can be very rich. When they are left
to idiot thread based only on a /Re:s+/i prepended to the subject line,
they become indeed a dischordant mumble.

As for the means by which this post arrive at my mailbox. I see nothing
in the return path that would indicate Jason as the proximate sender. As
I said, I believe that source of mailings should always be transparent.
This post as it is, originated from your server:

Return-Path:

<beginners-return-55924-rjnewton=[Email Removed]>
Received:
from onion.perl.org (onion.develooper.com
[63.251.223.166]) by sapir.efn.org
(8.12.6p2/8.12.6) with SMTP id hANJcF22080894
for <[Email Removed]>; Sun,
23 Nov 2003 11:38:15 -0800 (PST)
(envelope-from

beginners-return-55924-rjnewton=[Email Removed])
Received:
(qmail 58645 invoked by uid 1005); 23 Nov
2003 19:38:14 -0000
List-Subscribe:
<mailto:[Email Removed]>
...[ internal perl.org]
Received:
(qmail 6029 invoked by uid 225); 23 Nov 2003
19:38:13 -0000
Delivered-To:
[Email Removed]
Received:
(qmail 6024 invoked by uid 507); 23 Nov 2003
19:38:12 -0000
Received:
from wetware.wetware.com (HELO wetware.com)
(199.108.16.1) by
one.develooper.com (qpsmtpd/0.27-dev) with
ESMTP; Sun, 23 Nov 2003 11:37:40
-0800
Received:
from jeeves ([199.108.16.11]
helo=wetware.com) by wetware.com with esmtp
(Exim 4.20) id 1AO038-0000CZ-5R for
[Email Removed]; Sun, 23 Nov 2003
11:37:38 -0800

In the current state of internet mail, utmost clarity ias to origin and
forwarding paths is an absolutely essential courtesy.


Please reread the standard, start using full header view to analyse the
pathways, and set a good example for newbies.

Joseph

Wiggins D'Anconia
R. Joseph Newton wrote:
QUOTE


Can we dispense with the nit-picky mail client BS and get back to
discussing issues related to Perl. I realize some of the older more
experienced gurus on the list may have lived in a utopian world where
everyone used a client that worked well for all postings on USENET but
it is time to step into the real world, and as much as I too long for
some of the days when pop-up adds, cookie blocking, and javascripted
e-mails didn't exist, and the problems with Linux were trying to get X
configured before it blew up because you touched the mouse rather than
who was going to be sued by SCO next, I have also realized those days
are long gone.

QUOTE

In the current state of internet mail, utmost clarity ias to origin and
forwarding paths is an absolutely essential courtesy.


Why don't we have everyone sign their messages with a PGP key......uh,
that might happen.

QUOTE

Please reread the standard, start using full header view to analyse the
pathways, and set a good example for newbies.


If you have the time to worry about the full headers of every message on
this list I am sure there are some documentation projects out there that
could use your assistance, and would be almost as boring...

Now does someone have a Perl problem or not? I bet Dan Muey can come up
with *something* interesting ;-)....

http://danconia.org

Drieux
On Sunday, Nov 23, 2003, at 12:06 US/Pacific, R. Joseph Newton wrote:
[..]
QUOTE
Please reread the standard, start using full header view to analyse the
pathways, and set a good example for newbies.

why?

On Sunday, Nov 23, 2003, at 12:10 US/Pacific, Wiggins d'Anconia wrote:
[..]
QUOTE
Now does someone have a Perl problem or not? I bet Dan Muey can come
up with *something* interesting ;-)....

actually I think Jason was most polite to raise
a really interesting set of challenges, and as I
promised him BackChannels. I would post the
URL for my somewhat screedy piece on some of
the issues that were embedded in the core
discussion about the problems of POD's,
FAQ's et al:

<http://www.wetware.com/drieux/PR/blog2/Code/200311.html#id3152440795>

To be honest, there is a side of me that misses
"the good old days" when the 'manual pages' sat
there in 'the rack' and only the Cool People could
get terminals NEAR them.... ah yes, RFC822 was
young and spritly - having finally Obsoleted 733,
<http://www.faqs.org/rfcs/rfc733.html> - which
had obsoleted 724,680 and 561....

Oh for the Good Old Days when RFC561 was as dashing
and vivacious, and fashionably well dressed as
we were... Things have just gone down hill since then...

I of course look forward to Jason's work on building
out a Faq Crawler that would accept both email and nntp
and http queries and return just the right answer,
but I fear he may already have too much on his plate!

ciao
drieux

---

R. Joseph Newton
"R. Joseph Newton" wrote:

QUOTE
drieux wrote:

On Sunday, Nov 23, 2003, at 11:22 US/Pacific, R. Joseph Newton wrote:


Sorry, I was reading the headers for the wrong post.

Nevertheless, the opther point remains. Thee is a difference between a flat
thread and well-referenced one in terms of cogency.

QUOTE
Please reread the standard, start using full header view to analyse the
pathways, and set a good example for newbies.


[blush] ...uh, and make sure your'e looking at the headers for the right
post. [/blush]

Joseph

Drieux
On Sunday, Nov 23, 2003, at 16:24 US/Pacific, R. Joseph Newton wrote:
[..]
QUOTE

[blush]  ...uh, and make sure your'e looking at the headers for the
right
post.  [/blush]

Joseph

dude, we all have those little decaf moments....
trust me on that.... 8-)

It is possible that you can 'deja news' the article,
from one of those grand religious holy wars about which
header whatNotStuff was required, should be required,
would be really cool if they were required. To make the
point that things Might be getting out of hand the
person posted up what would turn out to be something
like 60-120 lines of 'header' for the 'one liner'

don't you think this is getting out of hand?

which we all laugh at as we look back fondly on that,
but given that we are still running way long, there
was something like 36 lines of header for 27 lines of
message - and that was for a Flat Text Email, vice the
multi-parters where there is a flat text version, and
one version that is html-ish, and one version that is....

{ so that we can keep this in perspective, the response
I just got from Jason, rolls some 108 lines of foo so that
I can read 44 lines of text with or without fancy formatting.
and then there is the Header Section on top of that.}

As some folks run into, on a semi-regular basis, someone will
ship out an email message that came from an MS client that
is nicely 64bit encoded, but also unreadable on various
email clients that simply dish up the 'text' with all of
those headers. Hence folks see these really nice non-sensical
pretty packed blocks of 64bit encoded stuff that is not
human readable.

So while I can empathise with the desire to have nicely
threaded stuff, there may be more important issues that
really need to be addressed than merely attempting to
advance the cause of software friendly header foo for
email/nntp/http information interchange.

ciao
drieux

---

R. Joseph Newton
Jason Dusek wrote:

QUOTE
Begin forwarded message:

From: Jason Dusek <[Email Removed]
Date: Sat Nov 22, 2003  10:10:27  PM US/Central
To: drieux <[Email Removed]


Subject: Re: POD, Faq and tradition - Re: extracting email addys.
Maybe there is some way to get the FAQ to respond to messages on the
list - that way we wouldn't need to understand 'perldoc' and so forth.

The problem here is that perldoc is the standard means for getting
documentation. Most people here want to encourage new Perl programmers to
use this as a first reference. It is a necessary skill. If desired
information is available through the sqtandard POD, then using perldoc will
be much faster than posting to the list and waiting for an answer.

QUOTE
We newbies could just send the thing out to the list, and everyone
could ignore it in good conscience.  If the FAQ didn't help us, we
could always repost with a note about "BadFAQ" in the subject line.

That is actually what peldoc -q does. One thing that might be worth trying
is to do something like the following:
perldoc perlfaq > "perldoc/perlfaq.txt". That will give you a plain-text
readout of the questions in each FAQ sheet.

I'm working on a full-text search for my archive of this list from about the
beginning of the year, up to a few weeks ago. It's a bit slow, though,
taking five or ten minutes to crawl through the 16,000+ posts, 28.8 MB, on
an "All Words" search. I'm pretty sure that the reason for this is that I'm
using regexes with the g modifier and counting matches, which adds
considerably to the parsing overhead. Something like this would be very
cumbersome to run on a busy Internet server. That's just for a text
search. Some of what you seem to envision would require artificial
intelligence of a high order, which requires even more in the way of system
resources

QUOTE
Of course some newbies are lazy, but but most of us are really
motivated by practicality.  We often have no background in using the
FAQ.  You might write our heuristic as:

if ( work_to_figure_out_faq > work_to_figure_out_problem ) {
&AskList();
} else { &AskFAQ(); }

To put it another way: if I surmise that it is easier (and faster) for
me to ship the problems out to you guys than it is for me to figure
out the FAQ, then most of the time that's what I'm going to do.  This
is somewhat despicable I suppose - but I have work to do.

I would pretty much agree here. You should definitely look at the FAQ
first, or perldoc, but if they are not getting to the point, it doesn't hurt
to ask for help. I think a full text search through the pod could help:
That could be a pretty major undertaking, though.

QUOTE


And on another note, what good are gurus who refuse to help the
humblest neophytes in their stumblings?  Is it not the purpose of this
list to assist the ignorant, the lame and even the stupid as they seek
out the one true Perl?  This isn't the 'true masters' list after all.

It certainly is intended to help the beginner ease his or her first steps in
Perl. I think there is also a common feeling that those first efforts will
be most productive if the new student is learning how to find the answers
for him-or-herself. Some people need more feedback than others, of course.
I think what most of us are looking for is to see students take a few steps
on their own, ask for help when they get stuck, then apply their own efforts
inputting the sufggestions offered to use.

One case in point would be newbies who consistently blow off the use of
strict and warnings, in spite of copious advice to use them. Helpers on the
list do grow impatient with that, because the student is discarding the most
available source of help in diagnosing problems. Usually, if a question is
included in the FAQ, people will simply point this out and provide sample
wording to pose the question at the command line.

It's really a matter of give and take.

QUOTE
- Jason

Joseph

Jason Dusek
Hi There,

Is there some way to get people on this list to stop sending me two
emails at once? I am on the beginner's list - so when you send email
to me and then cc to the list, I get two. Which is annoying. I
suppose I could write some rules to kill duplicate messages, but I have
got stuff to do. If I post to the list, I think it may be safely
assumed that I will read it to find out what people have to say about
my posting.

- Jason

Sparrow called out to himself every morning: "Master."
Then he answered himself: "Yes, boss."
And after that he added: "Don't forget the zucchini."
Again he answered, "Yes, boss."
And after that, he continued, "Don't be fooled by others."
"Yes, boss. yes, boss," he answered.
-Mike Topp

Mac Intyre
Hi Guys,

Thanks for the replies. Will follow all suggestions :)

Regards,


Steven

Jason Dusek
On Sunday, November 23, 2003, at 10:39 PM, R. Joseph Newton wrote:

QUOTE
We newbies could just send the thing out to the list, and everyone
could ignore it in good conscience.  If the FAQ didn't help us, we
could always repost with a note about "BadFAQ" in the subject line.

That is actually what peldoc -q does.  One thing that might be worth
trying
is to do something like the following:
perldoc perlfaq > "perldoc/perlfaq.txt".  That will give you a
plain-text
readout of the questions in each FAQ sheet.


Joseph

See, I never knew a thing about this PerlFAQ index. I will look to it
from now on.

- Jason

Gasan was sitting at the bedside of Tekisui three days before his
teacher's passing. Tekisui had already chosen Gasan as his successor.
A temple had recently burned down and Gasan was rebuilding it. Tekisui
asked him: "What are you going to do when the temple is rebuilt?"
"When you're better we want you to speak there," said Gasan.
"Suppose I die before then?"
"Then we'll find somebody else," replied Gasan.
"Suppose you can't get anybody?" said Tekisui.
Gasan answered loudly: "Dont ask such stupid questions. Just go fuck
yourself."
-Mike Topp

Randal L. Schwartz
QUOTE
"Jason" == Jason Dusek <[Email Removed]> writes:

Jason> Is there some way to get people on this list to stop sending me two
Jason> emails at once? I am on the beginner's list - so when you send email
Jason> to me and then cc to the list, I get two. Which is annoying. I
Jason> suppose I could write some rules to kill duplicate messages, but I
Jason> have got stuff to do. If I post to the list, I think it may be safely
Jason> assumed that I will read it to find out what people have to say about
Jason> my posting.

If you have procmail delivery, this rule works nicely:

:0 Wh: msgid.lock
| formail -D 8192 msgid.cache

Right from procmailex(1).

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +
<[Email Removed]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Rob Dixon
Nyimi Jose wrote:
QUOTE

More and more my fellow Java's friends tell me about IoC.
What is IoC in Perl world ?
Examples ?

Here are some links about IoC a friend gave to me :
http://picocontainer.org/ioc.html
http://jakarta.apache-korea.org/avalon/fra...tterns-ioc.html
http://www.springframework.org/docs/lightw..._container.html
http://javangelist.snipsnap.org/space/IoC

Hi Jos.

This pairs nicely with Kevin's question about callbacks, because
that's essentially what IoC is. In the classic model the code
know all about the structure of the program as a whole and where
to find the functions it needs. You will code your Perl program
to call a particular member function from a specific package.

In IoC your code only needs to declare what it's able to do
and the lower-level software will decide when to call it.

In Joseph's 'sort' example in the 'What is a callback' thread
the compare function just sets itself up, saying 'I can tell
you which order a pair of values should be in'. It then sits
back and waits to be summoned.

Another obvious IoC situation is in Windows programming, where
the program is effectively just a fixed set of subroutines that
Windows needs to call at the appropriate time.

But don't go trying to write code using IoC just because somebody's
recently thought of a name for it. The idea's been around a long
time and it isn't often a good way to write stuff.

HTH,

Rob

James Edward Gray II
On Nov 24, 2003, at 5:08 AM, NYIMI Jose (BMB) wrote:

QUOTE
Hi Rob,

Indeed the question i had in mind while posting
was "should i care about IoC while developping in Perl ?".
Your answer seems to be *no*.

I think you're over generalizing here. First, this isn't a Perl issue,
specifically, you could ask the same question of any development tool.

The correct answer is probably just as general, "Sure, you should care
about IoC when it makes sense to and leave it at home the rest of the
time."

QUOTE
Then how can i argue to my friends that
"IoC is not often a good way to write stuff".
Have you some examples ?

Well, grab a book on Design Patterns and recommend some of the others.
They all have their uses.

James

Rob Dixon
Nyimi Jose wrote:
QUOTE

Hi Rob,

Indeed the question i had in mind while posting was "should i
care about IoC while developping in Perl ?". Your answer seems
to be *no*. Then how can i argue to my friends that "IoC is
not often a good way to write stuff". Have you some examples ?

As James says, it's not a language question: Perl can do
callbacks too! But it's never a good idea to program according
to this month's buzzword. It's an advanced decision to choose
IoC over normal threaded code. Ask your friends where they would
use it and how and, when they burble, just understand that
they've simply hit on a fad.

Rob

Daniel Staal
--As off Monday, November 24, 2003 12:54 AM -0600, Jason Dusek is
alleged to have said:

QUOTE
Is there some way to get people on this list to stop sending me two
emails at once?  I am on the beginner's list - so when you send
email to me and then cc to the list, I get two.  Which is annoying.
I suppose I could write some rules to kill duplicate messages, but
I have got stuff to do.  If I post to the list, I think it may be
safely assumed that I will read it to find out what people have to
say about my posting.

--As for the rest, it is mine.

My solution has been to change my reply-to address to the list.
(Since that is what I want people to do, reply to the list.)

It looks like there should be a way to do this in Apple's Mail app.
There is manually at least, so I bet you could AppleScript it.

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

Drieux
On Monday, Nov 24, 2003, at 09:10 US/Pacific, Daniel Staal wrote:
[..]
QUOTE
It looks like there should be a way to do this in Apple's Mail app.
There is manually at least, so I bet you could AppleScript it.

Daniel T. Staal

p0: the Apple Mail.app trick is
Edit-> add reply header
fill in with the beginner's mailing list

p1: there is also a cultural issue here as well,
since for some 'replying directly' to a person
who has asked a question, and then cc-ing the
list, makes sure that the 'response gets back'
to the original person. The idea is that this
is 'more personal' and does not require that the
asker 'search' for the response on the list with
a threaded mail application.

p2: One's mileage really varies on these things.
For some folks, it is easier to do a 'reply all'
so that both the persons in 'the thread' as well
as the list have a copy of the email. The upside
of which is that one doesn't inadvertantly misdirect
email between various mailing list when one selects
from their automated list of possible email addresses.


ciao
drieux

---

Jason Dusek
On Monday, November 24, 2003, at 02:21 AM, Randal L. Schwartz wrote:

QUOTE
If you have procmail delivery, this rule works nicely:

:0 Wh: msgid.lock
| formail -D 8192 msgid.cache

Right from procmailex(1).

I am just going to use the 'Reply-To' header in Mail.app and see if it
works.

- Jason

When Banzan was walking through the Union Square greenmarket
he overheard a conversation between a vendor and his customer.
"Do you have chocolate mousse?" asked the customer.
"We have chocolate pudding," replied the vendor.
At these words Banzan became enlightened.
-Mike Topp

Beau E. Cox
Hi -

Switched to Unix::Syslog ->

#!/usr/bin/perl

use strict;
use warnings;

use Unix::Syslog qw(:macros); # Syslog macros
use Unix::Syslog qw(:subs); # Syslog functions

openlog $0, LOG_CONS | LOG_PID, LOG_USER;
syslog LOG_ERR, 'test error msg';
closelog;

Works fine. I have no idea why Sys::Syslog doesn't, but
I'm moving on.

Thanks Wiggins and dave for your input.

Aloha => Beau;

Rajesh Dorairajan
perldoc perlboot

-----Original Message-----
From: [Email Removed] [mailto:[Email Removed]]
Sent: Tuesday, November 25, 2003 10:31 AM
To: [Email Removed]
Subject: simple module


Hi all,
i am new to OO programming in Perl. Can someone suggest a simple Object
Oriented Perl module thru which i can read thru and practice?
i had gone thru perltoot,perlobj,perlref,perlsub etc regarding OOPs concepts
in Perl.
thanks,
KM




--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]

Km
Hi all,

I have already done it.
i am looking for an object oriented module from which i can look at the code.
thanks,
KM
-------------------------------------------------------------------
On Tue, Nov 25, 2003 at 10:41:33AM -0800, Rajesh Dorairajan wrote:
QUOTE
perldoc perlboot

-----Original Message-----
From: [Email Removed] [mailto:[Email Removed]]
Sent: Tuesday, November 25, 2003 10:31 AM
To: [Email Removed]
Subject: simple module


Hi all,
i am new to OO programming in Perl.  Can someone suggest a simple Object
Oriented Perl module thru which i can read thru and practice?
i had gone thru perltoot,perlobj,perlref,perlsub etc regarding OOPs concepts
in Perl.
thanks,
KM




--
To unsubscribe, e-mail: [Email Removed]
For additional commands, e-mail: [Email Removed]


Guay jean-Sbastien
QUOTE
What rpm repositories does everyone use with ppm?

The standard stock seem to be missing a lot of cpan modules.
Thanks!

Here are a few I know of:

http://theoryx5.uwinnipeg.ca/ppms/ <-- many CGI/Apache/DBI/GD related
modules
http://www.roth.net/perl/packages <-- mostly Win32 related modules
http://Jenda.Krynicky.cz/perl <-- mostly Win32 related modules
http://dada.perl.it/PPM <-- not much, mostly Win32 related

These are all for ActiveState Perl 8xx (Perl 5.8.x). Some modules from 6xx
(5.6) will still work on 5.8, but modules with XS will have binary
incompatibilities, and of course you'll have to modify the ppd file to make
it install correctly. So my advice is try to install from a 5.8 repository,
if that doesn't work then download the ppd file and referenced zip or tar.gz
file for the 5.6 module and modify it to install, and test to see if it
works.


QUOTE
Also on a side note is there some way I can use the perl -MCPAN -e shell
with windows xp?

What compilers do I need. How can I set it up?

Of course! Just install Visual Studio 6 or greater, and when installing,
make sure you make it set your environment variables automatically at
bootup. You're set!

Of course, the normal warning that "any module that has XS in it might only
compile or do sensible things on the platform it was designed for" applies.
But in my experience, most modules work OK, depending on what the module is
supposed to do of course...

If you only want to install modules that don't have XS (therefore don't need
a C compiler) then you can just download nmake (from
http://download.microsoft.com/download/vc1...US/Nmake15..exe
) and use that to do the normal

perl Makefile.pl
nmake
nmake test
nmake install

from an uncompressed tar.gz module's directory.


QUOTE
I would like to start using the stock perl tools rather then my
activestate installation.
I want a uniform development environment when I move from my Linux sco
and windows servers to my desktop.

Then you might want to look into Cygwin. It's a bit bulky, but it makes your
Windows machine behave like a Linux/Unix machine within a controlled
environment. In that case, Perl is the same as on Linux, gcc works as well,
and you can compile everything as if you were on Linux. Of course, it isn't
for everyone, because it has some pretty wide-sweeping implications on your
machine.


Hope that helps!

J-S

_____________________________________________________
Jean-Sbastien Guay
-- Conseiller technique - Administration
-- ( #4840
-- [Email Removed]

Wiggins D Anconia
QUOTE
I just get empties values,,, I already tried the code lines bellow but
it is not working... I have too much to do in my script.. but since I
dont get to make it works I can t step forward, I m working on it since
3 weeks ago but I just fails in all my tries :-( do u have any idea what
I d=could do ?? as I told you I m using the module telnet.pm. I already
have that website u sent me the link ( and I thanks u for that but all
my tries are failing..
#
------------------------------------------------------------------------
-
my @output = $telnet->cmd("cleartool lsactivity -s -view $viewDesenv");

-or-

my @output;
my $result = $telnet->cmd('String' => "cleartool lsactivity -s -view
$viewDesenv", 'Output' => @output);


Can you post the full script that you are using? I assume you are able
to telnet to the remote machine using a standard telnet client, and you
are infact supposed to be using 'telnet' as opposed to 'ssh' or some
other remote command sending protocol type thingie? I also assume when
you are able to telnet to the remote host, that cleartool is actually
installed, in the path, executable, $viewDesenv is set on the local
side, and that that command actually does produce something on stdout
(not stderr)?

And that you have read the section on M$ telnet:

http://search.cpan.org/~jrogers/Net-Telnet...Windows_Machine

Specifically the sentence: "Connecting Net::Telnet to one of these false
TELNET servers makes your job of parsing command output very difficult."

Are you sure you aren't using one of these "false" telnet servers?

Have you tried messing with the 'input_log'/'dump_log'
attributes/methods to provide us with debugging information also?

You will need to help us, help you...

http://danconia.org

Wiggins D Anconia
Please bottom post, and remember to group reply so others can help and
be helped...


QUOTE
Well... after talking to u I can figure I m using a false telnet server,
plz do u know a good telnet server that u could tell me, so I ll be able
to download and make my job step on.

Thanxss very much

Well, glad to know that we probably know what the problem is. Sorry I
know virtually nothing about the Windows telnet scene having only ever
used *nix versions. You may have better luck looking at drieux's
suggestion, and/or switching to SSH which should be able to provide the
same types of functions but in a much better and more robust way.

Good luck,

http://danconia.org

QUOTE

-----Mensagem original-----
De: Wiggins d Anconia [mailto:[Email Removed]]
Enviada em: Tuesday, November 25, 2003 5:45 PM
Para: Rogerio Agostinho; [Email Removed]
Assunto: Re: RES: telnet.pm



I just get empties values,,, I already tried the code lines bellow but
it is not working... I have too much to do in my script.. but since I
dont get to make it works I can t step forward, I m working on it
since
3 weeks ago but I just fails in all my tries :-( do u have any idea
what
I d=could do ?? as I told you I m using the module telnet.pm. I
already
have that website u sent me the link ( and I thanks u for that but all
my tries are failing..
#

------------------------------------------------------------------------
-
my @output = $telnet->cmd("cleartool lsactivity -s -view
$viewDesenv");

-or-

my @output;
my $result = $telnet->cmd('String' => "cleartool lsactivity -s -view
$viewDesenv", 'Output' => @output);


Can you post the full script that you are using?  I assume you are able
to telnet to the remote machine using a standard telnet client, and you
are infact supposed to be using 'telnet' as opposed to 'ssh' or some
other remote command sending protocol type thingie?  I also assume when
you are able to telnet to the remote host, that cleartool is actually
installed, in the path, executable, $viewDesenv is set on the local
side, and that that command actually does produce something on stdout
(not stderr)?

And that you have read the section on M$ telnet:

http://search.cpan.org/~jrogers/Net-Telnet...elnet.pm#Connec
ting_to_a_Remote_MS-Windows_Machine

Specifically the sentence: "Connecting Net::Telnet to one of these false
TELNET servers makes your job of parsing command output very difficult."

Are you sure you aren't using one of these "false" telnet servers?

Have you tried messing with the 'input_log'/'dump_log'
attributes/methods to provide us with debugging information also?

You will need to help us, help you...

http://danconia.org


Bob Showalter
Jerry Rocteur wrote:
QUOTE
...
I see this a lot of this on this list, Reply to the list,
Reply to the
list, Reply to the list.

If it was the intention of the list manager for people to
reply to the
list then a reply would go to the list, however, a reply goes to the
poster, not the list.

So who is right ?

The list manager is right, and you should reply to the list :~). Do a
"Group" reply or a "Reply to All" from your mail program.

See http://www.unicom.com/pw/reply-to-harmful.html

Andrew Gaffney
rhlinux wrote:
QUOTE
elslam 3alikom,
i wanna run an interactive system command through my program
for example i wanna add a user with its password that is given in the program not by the user, do any one here have any idea how can i do so in perl
i tried

quote:
------------------------------------------------------------------------------
system(passwd username )
------------------------------------------------------------------------------

but this takes the password from the user, i have also tried a lot of attributes to passwd command but nothing worked

I've tried just about every method you can think of to get this to work correctly.
Unfortunately, passwd is coded to only accept from a tty. The only thing I could think of
to get it to work is to create a pseudo tty (pty) and use that to send input to the passwd
program. I have no idea how to do this, though. There may also be an easier way.

--
Andrew Gaffney

Drieux
On Monday, Dec 4, 1995, at 15:32 US/Pacific, rhlinux wrote:
[..]
QUOTE

quote:
-----------------------------------------------------------------------
-------
system(passwd username )
-----------------------------------------------------------------------
-------

but this takes the password from the user, i have also tried a lot
of attributes to passwd command but nothing worked
[..]


the obvious first part of the problem is
are you running the command as 'root'?
Since only root can do the change of
the passwd file(s).

I have not run into Andrew Gaffney's problem,
since if this is an application to be run at
the command line, then one is STILL attached
to the tty/pty. If this is not going to be
an interactive command, then we have way
deeper issues to deal with.

Depending on which system you are on,
you may want to look at useradd
cf man useradd
for creating a user.

But back to your core problem, namely that
the passwd command on many systems IS interactive
and as such you can not do 'interactions' with it
with the system command. What you will need to do
is the bi-directional pipe solution:
cf:
<http://www.wetware.com/drieux/PR/blog2/Code/200311.html#id3152776334>

ciao
drieux

---

Dan Anderson
On Mon, 2003-11-24 at 01:54, Jason Dusek wrote:
QUOTE
Hi There,

Is there some way to get people on this list to stop sending me two
emails at once?  I am on the beginner's list - so when you send email
to me and then cc to the list, I get two.  Which is annoying.  I
suppose I could write some rules to kill duplicate messages, but I have
got stuff to do.  If I post to the list, I think it may be safely
assumed that I will read it to find out what people have to say about
my posting.

Your mail client may support disabling crossposting. Gnus does,
basically all copies are only allowed into 1 directory, and forced into
the one you specify as having higher priority (using rules). This isn't
really a Perl question -- you should OT this thread.

-Dan

Drieux
On Nov 29, 2003, at 11:46 PM, Charles K. Clarkson wrote:
[..]
QUOTE
I joined this thread late, forgive me if this
has been answered. Is there a module or a programmatic
method to ensuring that there are no references left?
[..]


p0: If you want to review a thread on the beginner's
mailing list, one way is to go to:
<http://nntp.x.perl.org/group/perl.beginners>

{ which can help you, if you have, as I have done,
forgotten a specific reference from email, and need
to go back and ask 'oh which module did John Reference...' }

p1: I'm not sure that I 'get' your question about
a module or a programmatic method - but what we
were playing with was

use Devel::Peek;

one of the many interesting modules for helping
coders play around with 'so what REALLLY did that do'.
{ buy the 3rd Edition, READ EVERY PAGE, then traverse
all of the references in the perltoc! }

Like the Benchmark module - some of the ones we did
last time around that I kept are at:
<http://www.wetware.com/drieux/pbl/Other/BenchMarks/>
these are tools for the 'development' side of the game
and not really 'production tricks'.

<sideBar>{
thank you to whom ever was so silly as to teach me
'just google it drieux, that would be
FOO + site:wetware.com ....'
Memory Leaks in Primates are such, ugly things, but
at least if one has an active mechanism that can chase
what was written down, one can find it again. I think
this is another variation on 'horder syndrome'...
}</sideBar>

p2: Which brings us to the core problem

How do I prevent myself from writing code
that will leak memory by leaving tid bits that
have a reference count greater than zero but
in such a way that the perl will not be able to
find them and toss the memory onto the heap for reuse.

well that starts with chanting

I will not write bad code!

then chant

Reduce, Reuse, Recycle!

and adopting the various basic strategies about how
one goes about looking at a problem and rendering it
first as an algorithm that makes sense, and then correctly
implementing that algorithm in the coding language one chooses.

IF one does not need a complex data Structure,
Then Just Say NO!

If on the other hand the problem says that the data structure
has a requirement to be complex then chant the old school tie maxim

Malloc from the Top
Free From the Bottom

and whip out some sort of 'initializer' function that
will if the thingiePoo is non-Null start out by calling
the tree_traverser() that will decend the complex data
structure making sure that the leaf nodes can be tossed safely
till one gets to the top of the tree and it all be gone bye-bye!
At which point the initializer() will start hanging good stuff.
{ some cultists use the terms 'constructors' and 'destructors'
find the language you feel safest with }

{ note: talking to the Problem is always good! Ask the Problem
how it feels about data modelling, where has it been, where
is it going. If you are nice to the Problem, it will be nice to you.
Take the Problem out for a dinner and a movie, get in touch
with it's inner feelings and issues. Find out what it knows
about itself Makes coding so much easier. }

If that complex data structure needs to be 'accessed' at
various bits and bobs 'inside it' then resolve who will
be responsible for 'accessing' the data structure - does
this part of the design say:

Must have Accessor To Foo In Bar At Baz

eg
$bar->get_foo($baz);

and should that

a. pass out the reference - hence incrementing the ref count -
and possibly allowing some Primate to ABUSE YOUR CODE!
b. COPY OUT the data - hence reconstructing the data into new memory
and handing the reference to New Memory back to the caller.

{ note: there is NO WAY to prevent Code Abuse! Primates DO IT!
and as long as they keep hiring primates to Code there will
be code at Risk! Just Say NO! To Code Abuse!!! Yes, Yes, Yes,
I know that Carp et al can help POINT back to the Primate's
Keyboard Pounding as the Source of the Dark Evil - but trust me
PRIMATES SMELL FUNNY and can do bad things with CODE!!! }

When you think you have a coding solution, then comes the fun!
Prooving that it is a 'minimal spanning set' - see what you can
just TOSS OUT until you are sure in your soul that it is as
tight and maintainable as is humanly possible. { if you need
to learn that only God is Perfect, take up golf. Or in this
case try Perl Golf. }

If YOU have cool bits that are Cool, learn to put them in
appropriate Perl Modules, so that you can just re-use them
when ever you need some

$bar->get_foo($baz);

Never be afraid to join a Coder Therapy Group, and to share
with the Group your 'issues' - what is the worst that happens?
They say:

Your mother dresses you funny
and you code smells toooooo!!!!

They may not be able to help you with the former, but along
the way the later issue can be, well cleaned up.

p3: If all else fails, never be afraid to take a core DUMP
of your code, print it out in some lovely long stream of
Hex, whip out your colour markers and annotate your way
through it and if you can not find any danging references
then you have at least proven that in that instance of
runtime there was nothing Obviously Bad about it.
{ do not try this at home Boys and Girls! These are
Paid Professionals, and we can tell 'the beautiful minds'
from people merely making arcane markings... }

HTH.

ciao
drieux

---


PHP Help | Linux Help | Web Hosting | Reseller Hosting | SSL Hosting
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2006 Invision Power Services, Inc.