RE: The True Path to Learning Perl Re: [OT] Education Level

2003-12-08 Thread Tim Johnson

I think that we've drifted a little from the topic, which was more or
less to get a feel for the people on this list and where they are in
their education, not to get in a "university vs. self-teaching"
argument.  Personally I don't think it would be pragmatic for most
Perlers out there to learn enough number theory to write their own
hashing algorithm any more than a contractor needs to understand the
chemical composition of the concrete he pours, and if you'll allow me to
continue the analogy a bit further, it also doesn't mean that he can't
buy the same textbooks and learn that information.  I will admit that
the level of dedication and self-sacrifice required is exceedingly rare,
and I'm stretching the analogy pretty thin anyway, so I'll leave it
there.  


>-Original Message-
>From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tassilo von
Parseval
>Sent: Monday, December 08, 2003 2:51 PM
>To: drieux
>Cc: Perl Perl
>Subject: Re: The True Path to Learning Perl Re: [OT] Education Level

The current set of perl-porters that are able and willing to work on the
core are with not many exceptions people with academic degrees. There
are others as well, but those are usually not responsible for the tricky
bits that do require more than a little bit of self-teaching: you don't
usually self-teach yourself enough number theory that is necessary for
coming up with a sane hashing-algorithm or random number generator. A
self-taught programmer will most definitely not be able to understand
(let alone create) a regular expression engine. The things to be
considered when crafting a memory allocater are usually beyond the
things an autodidact has picked up. It's stuff that can be found in the
old venerable computer-science text books that are recommended in
academic circles.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: What are the dangers of leaving a cgi-bin directory CHMOD 777

2003-12-08 Thread drieux
On Dec 8, 2003, at 3:15 PM, Dan Anderson wrote:

I have a perl script that writes to its directory, and as such
the directory is CHMOD 777 in  my cgi-bin.  (Linux box) I figured this
might be dangerous,  but didn't think there was any harm  in it.  Am I
right or will the script kiddies be all over me?
remember the basic permission issues,
that final 7 is the killer, it will allow
anyone who can get to it to 'write' to it.
Which would allow them to install anything
in that directory that they would want to
install, and then call it...
general practice is maybe 755 for a
cgi bin directory since there really is
no gooder reason for group to have 'write'
access to the directory.
ciao
drieux
---

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: sorter script [was: Frustrated newbie question]

2003-12-08 Thread Bryan Harris


 My next Perl task after I get my list of one name per line, is to sort the
 list and eliminate duplicate names.
>>> 
>>> I have used the following script to sort and remove duplicate entries in
>>> flat
>>> text files.
>>> 
>>> http://www.downloaddatabase.com/databasesoftware/db-sorter-script.htm
>> 
>> Sometimes perl isn't quite the right tool for the job...
>> 
>> % man sort
>> % man uniq
> 
> If you code it correctly (unlike the program at the URL above) then a
> perl version will be more efficient and faster than using sort and uniq.

Please explain...

That's the last conclusion I thought anyone would be able to reach.

- B



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: How to process multi-line records ?

2003-12-08 Thread John W. Krahn
Stuart Clemons wrote:
> 
> Hi all:
> 
> This newbie is back looking for some hints on how to handle this problem
> in processing a file that has multiline records that look something like
> this:
> 
> Name:  Joe Blow
> DataField1:  x
> DateField1: 07/07/77
> DataField2: x
> DateField2: 12/07/03
> 
> Name:  Fi Doe
> DataField1:  x
> DateField1: 08/08/88
> DataField2: x
> DateField2: 12/12/03
> 
> etc.
> 
> There is an empty line that separates each record.   I need to extract the
> records that meet certain criteria.   I would really like to know how to
> do this in Perl.
> (For a simple task like this, in the past, I would just import these
> records into a database and write a query to extract the records that I
> wanted.)
> 
> I've actually thought a lot about the problem, but I haven't done any perl
> coding that would allow me to put my woeful perl ineptitude on public
> display in this forum.   I hope to find the time to start on this problem
> in the next couple of days.  As I'm certain to run into problems, I will
> then share my ineptitude while looking for proper guidance from the valued
> learned ones.
> 
> Until then, here's what I was thinking to do.  What I thought I would do
> is try to read each line of one record into an array or hash, then use a
> conditional to determine if that record meets the desired criteria.  If it
> meets the criteria, write out this record to another  file and then read
> in the next record.  If the record doesn't meet the criteria, read in the
> next  record.  I would keep doing this until EOF.
> 
> I think I can handle the conditional stuff, but what I don't know how to
> do is read in each line of the record and stop reading when I hit the
> empty line so that I can do the conditional stuff.
> 
> Is this a valid approach to take for this problem?  And if so, should I
> use an array or hash ?   And again, how do I stop reading the input file
> when I hit the empty line so that I can do the conditional stuff ?
> 
> Thanks in advance for any help and/or hints.  The feedback from my last
> question was extremely helpful as I struggle to get Perl to do what I want
> it to do. I think I'm making progress, although it doesn't always feel
> that way !

When you have an empty line between "records" think "paragraphs" and use
perl's built-in paragraph mode for the input record separator.  If you
are just outputing records that match a certain criteria there is no
need to use an array or hash, just print the records that match.

open IN, '<', 'original' or die "Cannot open 'original': $!";
open OUT, '>', 'newfile' or die "Cannot open 'newfile': $!";

$/ = '';  # set paragraph mode on input record separator

while (  ) {
my ($date) = /^DateField1:\s*(.+)/m;
print OUT if $date eq '08/08/88';
}

__END__


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Reading a log file, again

2003-12-08 Thread Tom Kinzer
OP said:
"From what I understand, your script looks for 'Total:' and then for
following line with numbers, reads them and prints them. That is what I
need. However, there are 3 sections with 'Total:' and I am interested only
in one of them. "



2 preceding bits of info determine which is the right one.

-Tom Kinzer


-Original Message-
From: R. Joseph Newton [mailto:[EMAIL PROTECTED]
Sent: Monday, December 08, 2003 7:02 PM
To: Tom Kinzer
Cc: Katka a Daniel Dunajsky; Beginners Perl
Subject: Re: Reading a log file, again


Tom Kinzer wrote:

> Try this:
>
> Caveat: This all assumes LOTS about the format of your data being
> consistent, and so should be treated as a "quick and dirty" as opposed to
> anything resembling a robust application...  I'm not sure what your
> intention with the script is, but is worth mentioning.
>
> -Tom Kinzer

Hi Tom,

I think this may be getting too complicated.  My understanding is that the
OP was
actually interested in a single datum, the total figure at the bottom.  I
haven't
seen any clarification indicating otherwise, so I would suggest just doing
it:

my $junk = '';
$junk =  until $junk =~/^Total/;
$pot_o_gold = ;
$pot_o_gold =~ s/^\s*//;
chomp $pot_o_gold;
print "I got my value, and it's $pot_o_gold\n";
__DATA__
...
Format  count
a   100
b51
c   130
d 5
e 6
Total:  ---
292
I got my value, and it's 292

Remember KISS.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Syntax a little funny ....

2003-12-08 Thread John W. Krahn
[EMAIL PROTECTED] wrote:
> 
> I've just started trying to pick up a little perl.
> I'm breezing through "Learning Perl" and reading the perl docs.
> 
> Here is some syntax I found a little funny, and I was hoping somebody
> could explain this too me:
> 
> opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
> @dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR);
> closedir DIR;
> 
> The first and 3rd lines I have no problem with.
> 
> Its that line with the grep in it.
> grep is obviously a built-in perl function.
> 
> This is something I've seen before ...
> the output of the function readdir is "trickling down" to become the
> input of the function grep ?
> 
> In C or Java you would write
> grep(readdir(DIR)) most likely ?
> 
> If that is so, what is all that business with the curly braces ?
> I thought curly braces are supposed to denote code sections ?

Yes, exactly, the curly braces allow the use of a code block instead of
a simple expression.  Having a code block means that you can have
multiple statements and lexical variables.


> So, it's like the output of readdir is "trickling" through the curly
> braces and then the output after this is "trickling" through grep ?

grep acts like a filter.  grep's expression determines whether an
element from the right hand list will be passed through to the left.


> If so, what is the "input" to the code section in the curly braces ?

grep aliases the variable $_ to the current element of the list on the
right hand side.


> Anyhow, all this is a bit weird to me, so I was hoping someone could
> shed some light on it.

Have you read the documentation for grep in perlfunc.pod?


> p.s. It seems some of my confusion comes from the fact that I am used to
> putting () around funtion calls.

perldoc perlfunc
[snip]
   Any function in the list below may be used either with or
   without parentheses around its arguments.  (The syntax
   descriptions omit the parentheses.)  If you use the paren­
   theses, the simple (but occasionally surprising) rule is
   this: It looks like a function, therefore it is a func­
   tion, and precedence doesn't matter.  Otherwise it's a
   list operator or unary operator, and precedence does mat­
   ter.  And whitespace between the function and left paren­
   thesis doesn't count--so you need to be careful sometimes:


> That still doesn't help with the curly braces though ... %^)

They can (IIRC) be used in four different ways: { code block }, $hash{
element }, ${'variable name'} and /match count{4,7}/.


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: pid of process opened by system

2003-12-08 Thread drieux
On Dec 8, 2003, at 5:10 PM, [EMAIL PROTECTED] wrote:

On Tue, Dec 09, 2003 at 01:04:01AM +0100, 
[EMAIL PROTECTED] wrote:
eval {
  local $SIG{ALRM} = sub { die "alarm\n" };
  alarm 10;
  system($prog, @args);
  alarm 0;
};
if($@ =~ /alarm/) {
  # have to kill $prog;
# I tried with 'use POSIX qw/sys_wait_h/;'
my $kid = waitpid -1, WNOHANG;
print "$kid\n";
kill 15, $kid;
}


But this doesn't work, because waitpid returns 0 while the child
is running.
that waitpid() has the problem that it is WAITING
for the process to exit, which is not what you will want.
let's pause for a moment, and go back to the POD,

 system PROGRAM LIST
   Does exactly the same thing as "exec LIST", except that 
a fork
   is done first, and the parent process waits for the 
child pro-
   cess to complete.

so what you are trying for is a BIT MESSY.

plan A: since you know that $$ is your pid,
all you would need to do is look for all of
the child processes of it.
plan B: go with some sort of traditional
fork solution where you collect the
the pid on the parent side.
eg:
if ( !( $pid = fork()))
{
# Traditionally this is where we would exec the command
exec(" $CMD 2>&1");
exit;
}
#
# parent side
#
where you now set up your alarm() and pid_killer,
since YOU have that PID in your hand...
a more grotesque version of this is up at:





ciao
drieux
---

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Certification processes - Re: [OT] Education Level

2003-12-08 Thread drieux
On Dec 8, 2003, at 4:22 PM, Tom Kinzer wrote:

 http://perlcert.perlocity.org/

From: J Ingersoll Sent: Monday, December 08, 2003 4:16 PM
[..]
I'm working slowly towards the Linux Professional Institute's
exams - it would be nice to put down on a resume also
"Perl Certified" rather than "well I've written some neat scripts
at home"...I'm looking for good things to happen though...
[..]

p0: My complements to Tom for the indirect reference to:

p1: the trick as Tim Maher is trying to argue is how
to construct the 'lower-to-intermediate level' certifications
that will not require that one 'know the whole language'.
p2: There is also that core problem of whether a
'certified'  is actually a
solution, either in terms of 'solving the recruiting problem'
by allowing employers to winnow resumes, or in helping
coders organize a process by which they evolve out of
'beginners' groups and into Bigger Groups...
p3: What I would recommend, as the community works out
how to go about the process of 'certifying' is to build
up a portfolio of works - things that show that you
understand various aspects of the problem. This should
include the basic material that is covered in the basic
llama books, as well as working out how, when, and why
you would adopt a CPAN/ActiveState/Sourceforge module as
a part of your work.
p4: You might also look at other socially productive ways,
like becoming a CPAN testor, become a contributor to a
project, beta testing, visiting the monestary, etc.
ciao
drieux
---

There are Alternatives you know:



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: What are the dangers of leaving a cgi-bin directory CHMOD 777

2003-12-08 Thread R. Joseph Newton
Dan Anderson wrote:

> I have a perl script that writes to its directory, and as such
> the directory is CHMOD 777 in  my cgi-bin.  (Linux box) I figured this
> might be dangerous,  but didn't think there was any harm  in it.  Am I
> right or will the script kiddies be all over me?
>
> -Dan

Don't do that!  Either one, writng to the same directory as the CGI, or
chmod'ing *anything* 777.  It would make you very unwelcome.  Besides,
their is a perfectly workable alternative, using sibling directories.

base
cgi chmod 755
myscript.pl
guessit   760
mydata

If your web-server and Perl installation are well-configured, they should
run with group permissions.  I've tried this configuration on two Linux
servers I have work on, and it works on both.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Reading a log file, again

2003-12-08 Thread R. Joseph Newton
Tom Kinzer wrote:

> Try this:
>
> Caveat: This all assumes LOTS about the format of your data being
> consistent, and so should be treated as a "quick and dirty" as opposed to
> anything resembling a robust application...  I'm not sure what your
> intention with the script is, but is worth mentioning.
>
> -Tom Kinzer

Hi Tom,

I think this may be getting too complicated.  My understanding is that the OP was
actually interested in a single datum, the total figure at the bottom.  I haven't
seen any clarification indicating otherwise, so I would suggest just doing it:

my $junk = '';
$junk =  until $junk =~/^Total/;
$pot_o_gold = ;
$pot_o_gold =~ s/^\s*//;
chomp $pot_o_gold;
print "I got my value, and it's $pot_o_gold\n";
__DATA__
...
Format  count
a   100
b51
c   130
d 5
e 6
Total:  ---
292
I got my value, and it's 292

Remember KISS.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: @INC paths on an IIS server

2003-12-08 Thread R. Joseph Newton
Ron Goral wrote:

> I am testing some scripts on an IIS server and receive the following error
> when I attempt to "use" a module:
>
> Can't locate DG_DatabaseManager.pm in @INC (@INC contains: C:/Perl/lib
> C:/Perl/site/lib .) at c:\inetpub\wwwroot\cgi-bin\develop\shp_crt\test.cgi
> line 9.
> BEGIN failed--compilation aborted at
> c:\inetpub\wwwroot\cgi-bin\develop\shp_crt\test.cgi line 9.
>
> Do I have to modify %INC for IIS to find a non-standard module?  It appears
> that the "." directory is in @INC, but the script cannot find it even though
> DG_DatabaseManager.pm is in the same directory as test.cgi.  Am I wrong in
> thinking that "." represents the
> "c:\inetpub\wwwroot\cgi-bin\develop\shp_crt" directory when that is where
> test.cgi is located?
>
> Ahead of time, I have this directory's permissions up to execute both
> scripts and executables and, for now, it is operating under the
> administrator's account so there are no issues with permissions.
>
> Thanks -
> Ron Goral

This strikes me as strange, because I have never had any problems using module
placed correctly in relative paths, and I've never had to modify @INC to do so.
This includes working with IIS.  Are you sure that the filename is an exact
case-sensitive match for the class name?  Windows doesn't care, but Perl does.

Have you telnetted into the directory to see what the view looks like from
there?  It should work.  Hmmm, what version of Windows and Perl is running on
the server?

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Can't find package AutoLoader in CGI::Application program

2003-12-08 Thread Jon Seidel
Nyimi...

Thanks for your reply; I figured it out (there already was a '1' at the end 
of my module).

I had used h2xs to create the module framework... that framework requires 
exporter and then exports the name 'AutoLoader'. Once I took that out, 
everything worked fine.

Thanks again...jon

Nyimi Jose wrote:

> Try putting
> 1;
> As the last line of your GroupRank.pm file.
> 
> Remember that a module (*.pm file) is
> supposed to return a true value.
> 
> José.
> 
> -Original Message-
> From: david [mailto:[EMAIL PROTECTED]
> Sent: Monday, December 08, 2003 7:06 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Can't find package AutoLoader in CGI::Application program
> 
> 
> Jon Seidel wrote:
> 
> [snip]
> 
>> The beginning of my GroupRank.pm file looks like this:
>> /// package GroupRank;
>> use base 'CGI::Application';
>> use AutoLoader;
>> #use DBI;
>> 
>> use strict;
>> use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
>> $|++;
> 
> your GroupRank.pm module doesn't seem to return a true value. change
> '$|++;' to '$|=1;' and see what happen.
> 
> david


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: pid of process opened by system

2003-12-08 Thread david
[EMAIL PROTECTED] wrote:

> On Tue, Dec 09, 2003 at 01:04:01AM +0100, [EMAIL PROTECTED]
> wrote:
>> eval {
>>   local $SIG{ALRM} = sub { die "alarm\n" };
>>   alarm 10;
>>   system($prog, @args);
>>   alarm 0;
>> };
>> if($@ =~ /alarm/) {
>>   # have to kill $prog;
> # I tried with 'use POSIX qw/sys_wait_h/;'
> my $kid = waitpid -1, WNOHANG;
> print "$kid\n";
> kill 15, $kid;
>> }

fork the child separately so you can kill it later:

#!/usr/bin/perl -w
use strict;

#--
#-- demo.pl 
#--

my $child = undef;

eval{

local $SIG{ALRM} = sub { die 'alarm' };

$child = fork;

die 'fork' unless(defined $child);

if($child){
#--
#-- give child 5 seconds to complete
#--
alarm(5);
wait;
alarm(0);
}else{
system("sleep $ARGV[0]");
exit;
}
};

#--
#-- check for error
#--
if(my $error = $@){

if($error =~ /alarm/){

#--
#-- reset for safety
#--
alarm(0);

#--
#-- kill it if it's still there
#--
kill 9, $child or warn "Unable to kill $child: $!\n";

die "sleep taking too long: $error";

}elsif($error =~ /fork/){

die "Unable to fork: $error";
}else{
die "Error: $error";
}
}

__END__

[panda]# demo.pl 2
[panda]# demo.pl 20
sleep taking too long: alarm at ./tmp.pl line 10.
[panda]#

david
-- 
s,.*,<<,e,y,\n,,d,y,.s,10,,s
.ss.s.s...s.sss.s.ss
s.s.s...s...s..s
...s.ss..s.sss..ss.sss.s
s.s.s...ss.sss.s
..s..sss.s.ss.sss...
..ssss.sss.sss.s

,{4},"|?{*=}_'y!'+0!$&;"
,ge,y,!#:$_(-*[./<[EMAIL PROTECTED],b-t,
.y...,$~=q~=?,;^_#+?{~,,$~=~
y.!-&*-/:[EMAIL PROTECTED] ().;s,;,
);,g,s,s,$~s,g,y,y,%,,g,eval

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Syntax a little funny ....

2003-12-08 Thread R. Joseph Newton
[EMAIL PROTECTED] wrote:

> I've just started trying to pick up a little perl.
> I'm breezing through "Learning Perl" and reading the perl docs.
>
> Here is some syntax I found a little funny, and I was hoping somebody
> could explain this too me:
>
> opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
> @dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR);

@dots = grep ({ /^\./ && -f "$some_dir/$_" } readdir(DIR));

Same thing. What it does is to examine the lements of the list returned by
readdir, the second parameter of grep is the list being examined.  It uses
the boolean exprsession in the block--that the element being examined both
starts with a dot *and* is a directory.  The $somedir/ part of the
expression is necessary because the -x file tests use full paths.  Those
elements that pass both tests are passed into the list that is being
assigned to the array @dots.

Heres a sort of step by step:
foreach elemt of readdir dir
   next unless element beginns with '.'
   push into temp_list if element evaluates as a file
next
assign temp_list to @dots.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: How to process multi-line records ?

2003-12-08 Thread R. Joseph Newton
[EMAIL PROTECTED] wrote:

> Hi all:
>
> This newbie is back looking for some hints on how to handle this problem
> in processing a file that has multiline records that look something like
> this:
>
> Name:  Joe Blow
> DataField1:  x
> DateField1: 07/07/77
> DataField2: x
> DateField2: 12/07/03
>
> Name:  Fi Doe
> DataField1:  x
> DateField1: 08/08/88
> DataField2: x
> DateField2: 12/12/03
>
> etc.
>
> There is an empty line that separates each record.   I need to extract the
> records that meet certain criteria.   I would really like to know how to
> do this in Perl.
> ...

> Until then, here's what I was thinking to do.  What I thought I would do
> is try to read each line of one record into an array or hash, t

Why each line?  It's pretty clear that the lines are not really the logical
strucure of the records in this file.  You do have to input the lines one at a
time, since that is the way Perl generally reads, but that doesn't mean that
the lines should go into a program structure without filtering.  During the
input, you actuall have more context than you would if lines become simply
elements of an array.

Unless I'm missing something here, your example indicates that each data field
spans more than one line.  unless those x's are meant literally.  I would
suggest that you should do some processing for each data field, over however
many lines of input it takes, so that the fields each have an element to
themself.  Of course an excerpt as opposed to a context-deprived schematic
would help us undestand what is actually in the data.  That is a very
important consideration when it comes time to choose a processing method.

> hen use a
> conditional to determine if that record meets the desired criteria.  If it
> meets the criteria, write out this record to another  file and then read
> in the next record.  If the record doesn't meet the criteria, read in the
> next  record.  I would keep doing this until EOF.
>
> I think I can handle the conditional stuff, but what I don't know how to
> do is read in each line of the record and stop reading when I hit the
> empty line so that I can do the conditional stuff.

I would start with making a very clear record structure specification

Can you send us an example of the real data?  Taking meaning out of data is
counter -productive to solving problems of how to handle it.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: sorter script [was: Frustrated newbie question]

2003-12-08 Thread John W. Krahn
Bryan Harris wrote:
> 
> >> My next Perl task after I get my list of one name per line, is to sort the
> >> list and eliminate duplicate names.
> >
> > I have used the following script to sort and remove duplicate entries in flat
> > text files.
> >
> > http://www.downloaddatabase.com/databasesoftware/db-sorter-script.htm
> 
> Sometimes perl isn't quite the right tool for the job...
> 
> % man sort
> % man uniq

If you code it correctly (unlike the program at the URL above) then a
perl version will be more efficient and faster than using sort and uniq.


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: pid of process opened by system

2003-12-08 Thread perl-beginners
On Tue, Dec 09, 2003 at 01:04:01AM +0100, [EMAIL PROTECTED] wrote:
> eval {
>   local $SIG{ALRM} = sub { die "alarm\n" };
>   alarm 10;
>   system($prog, @args);
>   alarm 0;
> };
> if($@ =~ /alarm/) {
>   # have to kill $prog;
# I tried with 'use POSIX qw/sys_wait_h/;'
my $kid = waitpid -1, WNOHANG;
print "$kid\n";
kill 15, $kid;
> }


But this doesn't work, because waitpid returns 0 while the child
is running.


regards,
   Mik

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




CPAN DBD install problem

2003-12-08 Thread Tim
Hi,
Got an error trying to install DBD::RAM on a 5.8.2 version of perl. The 
following is  the output:

...
CPAN.pm: Going to build J/JZ/JZUCKER/DBD-RAM-0.072.tar.gz
Checking for DBI, 1.00 or later ... ok
Checking for DBD::File ... ok
Checking for SQL::Statement, 0.1011 or later ... ok
Checking if your kit is complete...
Looks good
Writing Makefile for DBD::RAM
cp RAM.pm blib/lib/DBD/RAM.pm
Manifying blib/man3/DBD::RAM.3
  /usr/bin/make  -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
Testing empty loop speed ...
10 iterations in 0.2 cpu+sys seconds (588235 per sec)
Testing connect/disconnect speed ...
2000 connections in 3.0 cpu+sys seconds (673 per sec)
Testing CREATE/DROP TABLE speed ...
Test failed, message: Can't locate DBI object method 
"csv_cache_sql_parser_object" via package "DBD::RAM::db" at 
/usr/local/lib/perl5/site_perl/5.8.2/DBD/File.pm line 170.

Can't locate DBI object method "csv_cache_sql_parser_object" via package 
"DBD::RAM::db" at /usr/local/lib/perl5/site_perl/5.8.2/DBD/File.pm line 170.
make: *** [test_dynamic] Error 9
  /usr/bin/make test -- NOT OK
Running make install
make test had returned bad status, won't install without force.

I am at a loss; could force it, but would like to understand what's going on.
TIA,
Tim



RE: [OT] Education Level

2003-12-08 Thread Tom Kinzer
 http://perlcert.perlocity.org/

-Original Message-
From: J Ingersoll [mailto:[EMAIL PROTECTED]
Sent: Monday, December 08, 2003 4:16 PM
To: Perl Beginner's List
Subject: RE: [OT] Education Level



--- Wiggins d Anconia <[EMAIL PROTECTED]> wrote:
> > 
> > looking to break out of a
> > non-challenging career in mainframe work :^>  )
> > 
> 
> On my "own", meaning no formal education in Perl. I got my start on the
> job from 2 programmers that came before me (which is why it wasn't
> really on my own), but that was 1997 and times have changed, a lot. 
> However I learned *Perl programming* from this list and reading the docs
> over the last year and a half, before that I was, at best, doing Perl 4
> web programming, which *is* a different thing, though I wouldn't have
> admitted it (and didn't really know it), either, at the time :-).
> 
> You have hit on the key point for me, this game is about constantly
> learning, doctors have CME, dentists have CDE, other professions require
> re-education to remain licensed, while I don't know that I would agree
> with licensing programmers in a similar manner, if a developer believes
> they will not fall behind by sitting comfortably in their current
> position they are definitely going to find themselves as obsolete as the
> tech they work in.  Whether it matters is a different discussion and one
> that others have hinted to...
> 
> http://danconia.org
> 
> 
> --
> Boycott the Sugar Bowl! You couldn't pay me to watch that game.
THanks - actually i've done my best learning outside of the classroom -
however having discovered Linux about 2 yrs. ago and more recently Perl
has for the first time in a while given me something worth pursuing
"seriously". I'm working slowly towards the Linux Professional Institute's
exams - it would be nice to put down on a resume also "Perl Certified"
rather than "well I've written some neat scripts at home"...I'm looking
for good things to happen though...

ji

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: [OT] Education Level

2003-12-08 Thread J Ingersoll

--- Wiggins d Anconia <[EMAIL PROTECTED]> wrote:
> > 
> > looking to break out of a
> > non-challenging career in mainframe work :^>  )
> > 
> 
> On my "own", meaning no formal education in Perl. I got my start on the
> job from 2 programmers that came before me (which is why it wasn't
> really on my own), but that was 1997 and times have changed, a lot. 
> However I learned *Perl programming* from this list and reading the docs
> over the last year and a half, before that I was, at best, doing Perl 4
> web programming, which *is* a different thing, though I wouldn't have
> admitted it (and didn't really know it), either, at the time :-).
> 
> You have hit on the key point for me, this game is about constantly
> learning, doctors have CME, dentists have CDE, other professions require
> re-education to remain licensed, while I don't know that I would agree
> with licensing programmers in a similar manner, if a developer believes
> they will not fall behind by sitting comfortably in their current
> position they are definitely going to find themselves as obsolete as the
> tech they work in.  Whether it matters is a different discussion and one
> that others have hinted to...
> 
> http://danconia.org
> 
> 
> --
> Boycott the Sugar Bowl! You couldn't pay me to watch that game.
THanks - actually i've done my best learning outside of the classroom -
however having discovered Linux about 2 yrs. ago and more recently Perl
has for the first time in a while given me something worth pursuing
"seriously". I'm working slowly towards the Linux Professional Institute's
exams - it would be nice to put down on a resume also "Perl Certified"
rather than "well I've written some neat scripts at home"...I'm looking
for good things to happen though...

ji

__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




pid of process opened by system

2003-12-08 Thread perl-beginners
Hello,

I'm doing this:

eval {
  local $SIG{ALRM} = sub { die "alarm\n" };
  alarm 10;
  system($prog, @args);
  alarm 0;
}
if($@ =~ /alarm/) {
  # have to kill $prog;
}

The problem is, that the process is still running after the perl
script has exited. And I have to kill it by hand. But I want perl
to do the job.

regards,
   Mik

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: How to process multi-line records ?

2003-12-08 Thread Tom Kinzer
Nice.

Don't forget to "get along well with the other children" by putting $/ back!

-Tom Kinzer

-Original Message-
From: Kevin Pfeiffer [mailto:[EMAIL PROTECTED]
Sent: Monday, December 08, 2003 1:52 PM
To: [EMAIL PROTECTED]
Subject: Re: How to process multi-line records ?


Hi Perl-List!

Stuart Clemons wrote:
[...]
>
> Name:  Joe Blow
> DataField1:  x
> DateField1: 07/07/77
> DataField2: x
> DateField2: 12/07/03
>
> Name:  Fi Doe
> DataField1:  x
> DateField1: 08/08/88
> DataField2: x
> DateField2: 12/12/03
>
> etc.
>
> There is an empty line that separates each record.   I need to extract the
> records that meet certain criteria.   I would really like to know how to
> do this in Perl.
> (For a simple task like this, in the past, I would just import these
> records into a database and write a query to extract the records that I
> wanted.)
>
> I've actually thought a lot about the problem, but I haven't done any perl
> coding that would allow me to put my woeful perl ineptitude on public
> display in this forum.   I hope to find the time to start on this problem
> in the next couple of days.  As I'm certain to run into problems, I will
> then share my ineptitude while looking for proper guidance from the valued
> learned ones.
>
> Until then, here's what I was thinking to do.  What I thought I would do
> is try to read each line of one record into an array or hash, then use a
> conditional to determine if that record meets the desired criteria.  If it
> meets the criteria, write out this record to another  file and then read
> in the next record.  If the record doesn't meet the criteria, read in the
> next  record.  I would keep doing this until EOF.

Here's a simple version that writes matching records to STDOUT...

#!/usr/bin/perl
use warnings;
use strict;

# sample patterns
my $DateField1 = '07/\d+/77';   # July 77
my $Name = "Doe\n"; # Lastname is "Doe"

$/ = "";# treats empty line(s) as record terminator
while() {
   if (m{DateField1:\s+$DateField1} ||
   m{Name:.*$Name}) {
  print;
   }
}

--
Kevin Pfeiffer

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




good example of top-posting problem [Was RE: sorter script [was: Frustrated newbie question]]

2003-12-08 Thread Kevin Pfeiffer
Hi Tom,

Tom Kinzer top-posted:

> *Consciously* making the decision that your script will no longer be
> portable...
> 
> my $2Cents;
> 
> -Tom Kinzer

> -Original Message-
> From: Bryan Harris [mailto:[EMAIL PROTECTED]
> Sent: Sunday, December 07, 2003 5:32 PM
> To: Beginners Perl
> Subject: Re: sorter script [was: Frustrated newbie question]
> 
> 
> 
> 
>>> My next Perl task after I get my list of one name per line, is to sort
> the
>>> list and eliminate duplicate names.
>>
>> I have used the following script to sort and remove duplicate entries in
> flat
>> text files.
>>
>> http://www.downloaddatabase.com/databasesoftware/db-sorter-script.htm
> 
> 
> Sometimes perl isn't quite the right tool for the job...
> 
> % man sort
> % man uniq
> 
> - B

This is a good example of the problem with top-posting; particularly in this
list: I have no idea to which part of which poster your comment refers.

Sorry about complaining (I try to ignore this behaviour), but it does cause
problems in readability and comprehension (especially here). Not to mention
the problem of deciding where to position a response in such a mixed-up
message.

-K


-- 
Kevin Pfeiffer

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: How to process multi-line records ?

2003-12-08 Thread Kevin Pfeiffer
Hi Perl-List!

Stuart Clemons wrote:
[...]
> 
> Name:  Joe Blow
> DataField1:  x
> DateField1: 07/07/77
> DataField2: x
> DateField2: 12/07/03
> 
> Name:  Fi Doe
> DataField1:  x
> DateField1: 08/08/88
> DataField2: x
> DateField2: 12/12/03
> 
> etc.
> 
> There is an empty line that separates each record.   I need to extract the
> records that meet certain criteria.   I would really like to know how to
> do this in Perl.
> (For a simple task like this, in the past, I would just import these
> records into a database and write a query to extract the records that I
> wanted.)
> 
> I've actually thought a lot about the problem, but I haven't done any perl
> coding that would allow me to put my woeful perl ineptitude on public
> display in this forum.   I hope to find the time to start on this problem
> in the next couple of days.  As I'm certain to run into problems, I will
> then share my ineptitude while looking for proper guidance from the valued
> learned ones.
> 
> Until then, here's what I was thinking to do.  What I thought I would do
> is try to read each line of one record into an array or hash, then use a
> conditional to determine if that record meets the desired criteria.  If it
> meets the criteria, write out this record to another  file and then read
> in the next record.  If the record doesn't meet the criteria, read in the
> next  record.  I would keep doing this until EOF.

Here's a simple version that writes matching records to STDOUT...

#!/usr/bin/perl
use warnings;
use strict;

# sample patterns
my $DateField1 = '07/\d+/77';   # July 77
my $Name = "Doe\n"; # Lastname is "Doe"

$/ = "";# treats empty line(s) as record terminator
while() {
   if (m{DateField1:\s+$DateField1} ||  
   m{Name:.*$Name}) {
  print;
   }
}

-- 
Kevin Pfeiffer

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




What are the dangers of leaving a cgi-bin directory CHMOD 777

2003-12-08 Thread Dan Anderson

I have a perl script that writes to its directory, and as such
the directory is CHMOD 777 in  my cgi-bin.  (Linux box) I figured this
might be dangerous,  but didn't think there was any harm  in it.  Am I
right or will the script kiddies be all over me?

-Dan


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: The True Path to Learning Perl Re: [OT] Education Level

2003-12-08 Thread Tassilo von Parseval
On Mon, Dec 08, 2003 at 12:43:37PM -0800 drieux wrote:

> Learn to be nice to undergrads and grad students.
> Think about the unpleasant lack of experience that
> they have in a wide range of issues. Most of them
> grew up in normal homes with median types of families.
> ALL they have to 'validate their personhood' IS that
> college degree, and their 'connections'. Unlike
> the rest of us who have different sets of 'connections'
> and different sets of Rules that drive our 'risk analysis'.

Pretty big words by someone who happily admits to not have chosen the
academic part. I wonder whether you really know so much about the
contents of academic studies.

> At best they know what they have been taught,
> and rarely have they had the time to test their
> speculations. So if you want to learn Perl, learn it!
> Test out Ideas! See how things can be done! That
> good old fashion all american approach of basing
> one's opinion upon what one has DONE

And at this point it gets utterly ridiculous. Since this is a list
dealing with Perl, we can try to make this thread a little more on topic
by looking at the people who made and still make Perl. The current set
of perl-porters that are able and willing to work on the core are with
not many exceptions people with academic degrees. There are others as
well, but those are usually not responsible for the tricky bits that do
require more than a little bit of self-teaching: you don't usually
self-teach yourself enough number theory that is necessary for coming up
with a sane hashing-algorithm or random number generator. A self-taught
programmer will most definitely not be able to understand (let alone
create) a regular expression engine. The things to be considered when
crafting a memory allocater are usually beyond the things an autodidact
has picked up. It's stuff that can be found in the old venerable
computer-science text books that are recommended in academic circles.

> IF you learned how to do the process of learning,
> Then WHY get a college degree??? IF your skill
> mix is taking you where you want to be, then
> rock ON! if it is not, figure out where you
> want to be and go there.

I am sorry. This only works for the very simple problems. Those
problems, that are indeed not teached in university, because a graduate
is expected to acquire these things on his own. 

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~;eval


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Getting a local file

2003-12-08 Thread Jason Chinnes
I am using mod_perl with Apache 1.3 (Win32) and am having difficulty
with the following code.

--
use CGI;
use Data::Dumper; 
use HTTP::Request;
use LWP::UserAgent;

my $q = new CGI;
$ua = new LWP::UserAgent;
$site = 'http://www.example.com/';
print $q->header;   # create the HTTP header
$request = new HTTP::Request GET => $site;
$response = $ua->request($request);
print $response->content;
--

This works fine when $site = 'http://www.example.com/' or anything else
that's not on my server.  When it is on my server (say
'http://localhost/')  the client hangs.  Apache's access.log file lists:

127.0.0.1 - - [08/Dec/2003:16:57:30 -0500] "GET / HTTP/1.1" 200 3337

But, this file never seems to make it back to my script.
http://localhost/ comes up fine in a browser, and when I telnet in and
make the request manually.  Any incite would be appreciated.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: How to verify whether a directory exists

2003-12-08 Thread Jeff Westman
"B. Fongo" <[EMAIL PROTECTED]> wrote:

> I tried several alternatives to solve the problem, but failed. In most 
> cases, the script couldn't create a directory if there is a text file 
> with the same name. Rob's suggestion works better; except that it 
> overrides the directory without warning - if it already existing. But it 
> remians some how streng, because the content of the directory remains 
> intact.
> 
> mkdir $dir || die "Failed to create $dir: $!\n" unless -d $dir;
> 
> It's okay anyway - as long as it's able to create a directory - even if 
> a file (other than a directory) with the same name is found.
> 
> Thanks guys

The code snippet should be using 'or' instead of '|| to work properly. 
Consider if I put this snippet in a file called 'x'.  When I try to create a
directory also named 'x', it should fail, but does not tell me so:

  $ cat x
  #!/bin/perl -w
  $dir = $ARGV[0];
  mkdir $dir || die "Failed to create $dir: $!\n" unless -d $dir;

  $ x x
  $ echo $?
  0# success???

Now by changing '||' to 'or', we get what you'd expect:

  $ x x
  Failed to create x: File exists
  $ echo $?
  17  

# non-zero = failed, my OS is HPUX 11, dont know why I didnt get 255
(unsigned -1)

Also consider what perl sees:

Using '||':

  $ perl -MO=Deparse,-p x
  ($dir = $ARGV[0]);
  (-d($dir) or mkdir(($dir || die("Failed to create $dir: $!\n";
  x syntax OK

Using 'or':

  $ perl -MO=Deparse,-p x
  ($dir = $ARGV[0]);
  (-d($dir) or (mkdir($dir) or die("Failed to create $dir: $!\n")));
  x syntax OK


Hope that helps.

-Jeff



> Rob Dixon wrote:
> 
> >Wiggins D'Anconia wrote:
> >  
> >
> >>B. Fongo wrote:
> >>
> >>
> >>>I want to use mkdir(blah blah, o777), but want to first find out
> >>>whether the directory "blah blah" exists.
> >>>I'm not if the -e option will bw right here. Let's say:
> >>>
> >>>   unless (-e blah_blah) mkdir(blah_blah, 0777);
> >>># Is this okay?
> >>>
> >>>
> >>>  
> >>>
> >>In general -e checks for file existence, -d checks to see if an existing
> >>file is a directory (or complains that the file doesn't exist).
> >>
> >>perldoc -f -e
> >>
> >>So your above code leaves a condition, where blah_blah exists but is
> >>*not* a directory which is likely to cause you problems. But since you
> >>haven't told us what happens in this failure case it is hard for us to
> >>say, but,
> >>
> >>if (-e blah_blah) {
> >> unless (-d blah_blah) {
> >> die "File exists but is not directory";
> >> }
> >>}
> >>else {
> >> # don't forget to check mkdir's failure
> >> mkdir(blah_blah, 0777) or die "Can't make directory: $!";
> >>}
> >>
> >>
> >
> >Just a note:
> >
> >There's no need to do a separate -e call to check whether a directory
> >exists, -d won't throw an error. A simple
> >
> >  die "$dir is not directory" unless -d $dir;
> >
> >Will check that $dir both exists and is a directory, which
> >is probably all that is needed.
> >
> >Rob
> >
> >
> >
> >  
> >
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
> 
> 


__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: @INC paths on an IIS server

2003-12-08 Thread drieux
On Dec 8, 2003, at 10:41 AM, Jenda Krynicky wrote:
From: "Ron Goral" <[EMAIL PROTECTED]>
[..]
It appears that the "." directory is in @INC, but the script cannot 
find
it even though DG_DatabaseManager.pm is in the same directory as
test.cgi.  Am I wrong in thinking that "." represents the
"c:\inetpub\wwwroot\cgi-bin\develop\shp_crt" directory when that is
where test.cgi is located?
Yes


I think that might need a bit of clarification.

if there is a "test.cgi" in the same directory
as the DG_DatabaseManager.pm, then his assumption
would seem to be mostly correctish, IF the IIS
actually DOES the 'chdir' to the directory
where the test.cgi code resides.
A simple test would be to make a simple

	base_test.cgi

that would do the simple form of stuff

### #!/usr/bin/perl
### use strict;
### use warnings;
### use Cwd;
### BEGIN {
###  use FindBin qw($Bin);;
###  use lib "$Bin" ;
### }
### my $iam = cwd;
### print "Content-type: text/plain \n\n I am at: $iam\n";
###
### print "$_ \n" foreach(@INC);
###
this would tell Ron where exactly IIS was when
that code was invoked in a browser.
You may either add
use lib 'c:\inetpub\wwwroot\cgi-bin\develop\shp_crt';
[..]

I'm becoming a BIG FAN of the FindBin solution
especially in the case of CGI code, saves on
the problem of knowing where the code is...
Especially if the Web Server is not doing the
expected part of the CGI approach of doing
the chdir into the directory where the code is.
ciao
drieux
---

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: How to verify whether a directory exists

2003-12-08 Thread B. Fongo
I tried several alternatives to solve the problem, but failed. In most 
cases, the script couldn't create a directory if there is a text file 
with the same name. Rob's suggestion works better; except that it 
overrides the directory without warning - if it already existing. But it 
remians some how streng, because the content of the directory remains 
intact.

mkdir $dir || die "Failed to create $dir: $!\n" unless -d $dir;

It's okay anyway - as long as it's able to create a directory - even if 
a file (other than a directory) with the same name is found.

Thanks guys



Rob Dixon wrote:

Wiggins D'Anconia wrote:
 

B. Fongo wrote:
   

I want to use mkdir(blah blah, o777), but want to first find out
whether the directory "blah blah" exists.
I'm not if the -e option will bw right here. Let's say:
  unless (-e blah_blah) mkdir(blah_blah, 0777);
# Is this okay?
 

In general -e checks for file existence, -d checks to see if an existing
file is a directory (or complains that the file doesn't exist).
perldoc -f -e

So your above code leaves a condition, where blah_blah exists but is
*not* a directory which is likely to cause you problems. But since you
haven't told us what happens in this failure case it is hard for us to
say, but,
if (-e blah_blah) {
unless (-d blah_blah) {
die "File exists but is not directory";
}
}
else {
# don't forget to check mkdir's failure
mkdir(blah_blah, 0777) or die "Can't make directory: $!";
}
   

Just a note:

There's no need to do a separate -e call to check whether a directory
exists, -d won't throw an error. A simple
 die "$dir is not directory" unless -d $dir;

Will check that $dir both exists and is a directory, which
is probably all that is needed.
Rob



 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: The True Path to Learning Perl Re: [OT] Education Level

2003-12-08 Thread drieux
On Dec 8, 2003, at 11:18 AM, Jason Dusek wrote:
[..]
I think drieux has raised a good point in taking
a shot at the 'learning how to think' snobbery too
common among college graduates.
[..]

It is not so much a shot at 'snobbery' as it
is at the lack of 'intellectual rigor' that
the phrase bleats like a sheep. The university
system is having a lot of problems with justifying
it's existence. The older notions of it being a
prepatory system for taking over the reigns of
government and commerce are a bit strained as an
excuse to get Government and/or Private Sector Funding.
In PART because with things like the Internet, IF
one wants to learn, one can and at far cheaper rates.
You might also notice that in the UK the phrase is
"reading for..." rather than the american 'majoring in'.
So let me smack you about the head and shoulders on
the problem with getting 'student loans' - have you
ever thought of the simpler approach? Put together a
business plan, shop it around, get some Angle Funding
and go for an "A" round of funding??? The alternative
of course is to get a RealJob[dm] and let it pay the
cash flow for the duration while you master the art
of codeMongering or what ever.
One could tell those of us in the 'start up' who had
put in some time 'raising funding', 'the old fashion way',
from those who were lucky enough to get 'college grants,loans,etc'
to help them run their college Gambits. They learned one
set of 'rules' about doing 'risk analysis', which really
is the point you are trying to bang at with your kvetch
about 'powerful people' and 'break/bend' the rules. Which
I think is a part of what you are trying to smack with
the 'snobbery' point.
Those of us with the 'alternative' route through the
academic minefields arrived understanding other forms
of risk analysis. Ironically, the same set we use to
resolve do we want/need a 'strongly typed language'
so that our compiler will save us - or can we live
with bringing our 'A game' to the process - and
place it all on one chance of pitch and toss...
Learn to be nice to undergrads and grad students.
Think about the unpleasant lack of experience that
they have in a wide range of issues. Most of them
grew up in normal homes with median types of families.
ALL they have to 'validate their personhood' IS that
college degree, and their 'connections'. Unlike
the rest of us who have different sets of 'connections'
and different sets of Rules that drive our 'risk analysis'.
At best they know what they have been taught,
and rarely have they had the time to test their
speculations. So if you want to learn Perl, learn it!
Test out Ideas! See how things can be done! That
good old fashion all american approach of basing
one's opinion upon what one has DONE
There will always be poseurs. There will always
be shisters, shills, and hustlers.
IF you learned how to do the process of learning,
Then WHY get a college degree??? IF your skill
mix is taking you where you want to be, then
rock ON! if it is not, figure out where you
want to be and go there.
so that we are clear, I had $65 in my jeans,
an address from people in the old country,
and everything on my back when I landed at O'Hare.
Any Questions?

ciao
drieux
---

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE: Reading a log file, again

2003-12-08 Thread Jeff Westman
Tom Kinzer <[EMAIL PROTECTED]> wrote:

> Try this:
> 
> Caveat: This all assumes LOTS about the format of your data being
> consistent, and so should be treated as a "quick and dirty" as opposed to
> anything resembling a robust application...  I'm not sure what your
> intention with the script is, but is worth mentioning.
> 
> -Tom Kinzer
> 
> __SNIP__
> 
> my $input  = '/appl/log/200301130.txt';
> my $total;
> die "Usage: Arg1: Input File to Scan."
> unless $input;
> 
> open IN, "< $input" or die "Unable to open $input for reading, $!,
> stopped";
> 
> 
> while (  ) {
>   if ( /  Document Format/ ) { last };
> }
> 
> while (  ) {
>   if ( /  Total: -/ ) { last };
> }
> 
> while (  ) {
>   if ( /^\s*\d+/ ) {
>  chomp;
>  s/\s*(\d+)\s*/$1/;
>  $total = $_;
>  printf "Total: %010s\n", $total;
>  last;
>   }
> }
> 
> close IN;
> 
> __END__

Don't you need to do a 

  seek(IN,0,0)

in between each while loop?

Why have three while loops; why not incorporate this into a single loop?


-Jeff


__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Reading a log file, again

2003-12-08 Thread Tom Kinzer
Try this:

Caveat: This all assumes LOTS about the format of your data being
consistent, and so should be treated as a "quick and dirty" as opposed to
anything resembling a robust application...  I'm not sure what your
intention with the script is, but is worth mentioning.

-Tom Kinzer

__SNIP__

my $input  = '/appl/log/200301130.txt';
my $total;
die "Usage: Arg1: Input File to Scan."
unless $input;

open IN, "< $input" or die "Unable to open $input for reading, $!, stopped";


while (  ) {
if ( /  Document Format/ ) { last };
}

while (  ) {
if ( /  Total: -/ ) { last };
}

while (  ) {
if ( /^\s*\d+/ ) {
   chomp;
   s/\s*(\d+)\s*/$1/;
   $total = $_;
   printf "Total: %010s\n", $total;
   last;
}
}

close IN;

__END__

-Original Message-
From: Katka a Daniel Dunajsky [mailto:[EMAIL PROTECTED]
Sent: Monday, December 08, 2003 12:15 PM
To: [EMAIL PROTECTED]
Subject: Reading a log file, again


Hello Tom,

I hope you are in a good time again, because I would like to ask you for
help – again.
The first script that you did send to me works well. The problem is that I
was not accurate with the situation description.
>From what I understand, your script looks for ‘Total:’ and then for
following line with numbers, reads them and prints them. That is what I
need. However, there are 3 sections with ‘Total:’ and I am interested only
in one of them. I was trying to solve this issue by modifying your script,
now it looks like this:

#!/usr/local/bin/perl -w
use strict;

my $input  = '/appl/log/200301130.txt';
my $total;
die "Usage: Arg1: Input File to Scan."
unless $input;

open IN, "< $input" or die "Unable to open $input for reading, $!, stopped";

while ( defined() ) {

while (  ) {
if ( /  Document Format/ ) { last };
}

while (  ) {
if ( /  Total: -/ ) { last };
}

while (  ) {
if ( /^\s*\d+/ ) {
chomp;
   s/\s*(\d+)\s*/$1/;
   $total = $_;
   printf "Total: %010s", $total;
}
}
}

close IN;

Your script without modification returns 3 values:
Total: 52,497Total: 49,670Total: 49,670.
After the change I implemented it returns 2 values:
Total: 49,670Total: 49,670.
The section I am interested in (in the log file) starts with “  Document
Format” and then there is the “  Total:” and the number returned is the
first 49,670 returned after modification. The second number I am not
interested in and I don’t know how to limit script from continuing further
down. Could you please advice?

Thank you for your time.

danield

_
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=dept/features&pgmarket=en-ca&RU=http%3a%2f%2fjoin.
msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Using Perl for English Grammar

2003-12-08 Thread drieux
On Dec 8, 2003, at 1:33 AM, Jane Langley wrote:
[..]
I am interested in using Perl to generate proper
English grammatical sentences from a set "list of
words" and NOT from texts.
[..]

I think a part of the problem is sorting out
what "proper english grammatical sentences" be
about in the first place.
One of the reasons that we code in 'formal languages'
is to AVOID all the unsightly angst of 'natural languages'.
The classic gag being

	"over the fence the cow some hay throw"

which uses an 'english' lexicon, but a 'german' grammar.
Most americans would reconstruct that sentance a la
	throw the hay over the fence 'to' the cow.

as you will note from



you will probably want to get yourself
Parse::RecDescent as you start sorting
this mess out.
ciao
drieux
---

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: [OT] Education Level

2003-12-08 Thread Jason Dusek
Hi All,

I think drieux has raised a good point in taking a shot at the 
'learning how to think' snobbery too common among college graduates.  
It is a sad fact that college has very little to do with thinking or 
learning - rather it is all about:
	a)	patience with idiots
	b)	conformance to rules
	c)	facility with manipulating those rules
	d)	establishing connections with 'powerful' people
		(department chairs, etc.) so that you can break/bend the rules
That is college as I know it, anyway.  If I had a choice I would just 
sit at home, read the list, and start teaching myself C++ from some 
nice books.  But you can't get student loans for sitting at home and 
reading - you can only get loans by putting up with crap and garbage 
from the University of Wherever.

- Jason

Twenty monks and one nun, who was named Eshun, were practicing 
meditation with a certain Zen master.

Eshun was very pretty even though her head was shaved and her dress 
plain. Several monks secretly fell in love with her. One of them wrote 
her a love letter, insisting upon a private meeting.

Eshun did not reply. The following day the master gave a lecture to the 
group, and when it was over, Eshun arose. Addressing the one who had 
written to her, she said: "If you really love me so much, come and 
embrace me now." 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: stripping last field of a carriage return

2003-12-08 Thread drieux
On Dec 7, 2003, at 7:02 PM, Paul Johnson wrote:
On Sun, Dec 07, 2003 at 06:39:50PM -0800, drieux wrote:
On Dec 7, 2003, at 5:40 PM, Bryan Harris wrote:
[..]
I have tried to strip the carriage return of the last field

$field[8] =~ s/\015//g;
Uh, isn't the carriage return code 13?
our $CRLF = "\015\012";   # "\r\n" is not portable

[jeeves: 42:] perl -e 'print ord("\n")'
10[jeeves: 43:]  perl -e 'print ord("\r")'
13[jeeves: 44:]
I think we may have found the OOOPSIE...
I'm not absolutely sure what you are getting at.

$ perl -le 'print 015'
13
as others have noted, the old phrase was

	

carriage return, line feed, from the hey
days of Real Teletypes. And yes, you did get
to watch the carriage return, and THEN a LINE FEED.
 :: 015 :: 13 :: "\r"
 :: 012 :: 10 :: "\n"
unix freaks forget that "\n" is used and interpretted
by the stty to denote BOTH. DOS based systems will
acutally put TWO characters, where as Mac boxes of
the old school use the "\r".
So while I generally support the notion of chomp()
at it will hunt for the 'last' "" but may
not pick of any of them on the inside of the string.
let us assume a data string of the form

	foobar

your regex would remove the  and leave us with

	foobar

which SHOULD print out like

foo
   bar
since there was NO  to return 'the print head'
back to the zero-th position. The alternative is
that it will confuse some systems and print out like
	foo[]bar[]

So as a general rule of thumb, one can opt for
the risky strategy of
	s/\n|\r//g

or get 'literal' with say

	s/\015|\012//g

and rip them out in octal.

ciao
drieux
---

"I see bit streams"
- frightened proto-coder unaware of their powers
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



The True Path to Learning Perl Re: [OT] Education Level

2003-12-08 Thread drieux
On Dec 8, 2003, at 7:19 AM, J Ingersoll wrote:
[..]
I'd like to know how many in the list  - employed for
their perl skills - learned perl on their own (practice,
forums, books, et. al. ) and how many attended formal classes ...?
[..]

first off you really SHOULD NOT scare people
with phrases like " write microcode for " and
then refer to a four digit chipset. WAY BAD FORM.
{ and yes, doing the Motorola side of the assembler
on a RISC was much easier, none of that reverse
polish notation smack... }
The best way to learn perl is to have someone on
site who can mentor you, since that way you have
the constraint of professional requirements, and
can see where perl fits into the flow. IF you
can not find a SithLord, then, well, join the
rest of us the old fashion way, vote for
comp.lang.perl - oh yeah, that's already happened...
Buy the Big Book, make mistakes, enjoy...
The hardest part is getting the knack for telling
which things are worth knowing, and which are
merely passing fads, the cult du jure...
now back to the academic side of the chat.

On Dec 8, 2003, at 4:07 AM, Rob Dixon wrote:
Marcos Rebelo wrote:
[..]
from this side the University is very important.
Most of all, for learning how to think.
Exactly. And that's the basis of all the best English
universities which are, sadly, being swamped by all
of our 'polytechnics' being rebranded.
If you can't think, then no amount of 'Computer Science'
lectures will help you to program.
I'm not sure that I like the phrase

	"learning how to think"

as much as I would probably argue for

	"develop the habit of formal analysis"

and from there hopefully move on into the rest
of the process of being able to present that
analysis in some polite way, eg:
	"Well now that is Organic Fertilizer,..."

rather than merely blurting out say:

	"smells like dung to moi..."

What would be useful of the undergrad liberal arts
world would be a more active engagement in the
fine art of 'learning to learn' - namely that it is
not simply something that happens IN the hallowed halls
of the Ivory Tower, but is a fundamental survival skill
mix that separates "the eaters" from "the food".
It is a BAD SIGN when

On Dec 8, 2003, at 8:39 AM, Robert Brown wrote:
[..]
I spent my freshman year at Duke in 1969 and got kicked out because
the second semister I lived in the computer center and never went to
class.
[..]

One of the other things that one should be learning
as an undergrad is a bit about 'time management' as
well as the various social and cultural skills that
make the university environment the recruiting
grounds for various spying organizations...
Education is nice, but the economy is the governing factor.
I still have that wife and daughter I told you about!
This, unfortunately, is NOT something that most
universities will teach you up front. Having all
of the brilliance in the world does NOT mean that
it will make a job possible. Nor for that matter,
that one can figure out a way to sustain a long
term growing set of personal relationships.
There is also nested in Robert's presentation that
more interesting idea - namely that one go back and
attend university anyway, and this time to do it with
an intention to graduate, and in a field that you find
at least interesting and amusing. Nothing Screws Up
the Kiddies like Grey Panthers arriving back 'from
the fleet' with 'additional perspective' not included
in the SillyBuy from the Prof
Ultimately one needs to re-read Marcos' other line:

On Dec 7, 2003, at 10:57 PM, [EMAIL PROTECTED] wrote:
[..]
Anyone can do hacker programming but for doing software engineering
you need to know a little bit more.
[..]

The question remains whether that is material
that a University can provide, or is that the
sort of professionalism that comes from life
amongst the professionals.
A part of the problem IS the very phrase "software engineering".
Has it been an ambition, rather than an actual assertion, of a real
relationship between 'software' and 'engineering'.
As folks start noticing that 'there is more than one way
to do it' - in perl, out of perl, etc, etc, etc... The
mythological 'software engineering' entity really comes
under fire perchance more than merely 'hacker programming'.
Think for a moment folks, the lead time that a university
will need to just get the course catelog out the door. In
that same amount of time, the professional rags will of
course wander their way through how many different hip
new next wave trends in CodeMonger??? Anyone ever see
that 4GL? Or are we really retreating into the new
wave of IDE, that makes the CodeMonkey more productive???
So while I would so love to believe in such things
as the Mythological Perkin-Month, there is that
minor management problem that one can not merely
assign nine womyn and get one baby in a 30 day period.
Ultimately the relationship between the academic world,
the professional world will be a bit, uh, interesting.
If you can 'improve your position' by mere talent
and talent alone - 

Re: @INC paths on an IIS server

2003-12-08 Thread Jenda Krynicky
From: "Ron Goral" <[EMAIL PROTECTED]>
> I am testing some scripts on an IIS server and receive the following
> error when I attempt to "use" a module:
> 
> Can't locate DG_DatabaseManager.pm in @INC (@INC contains: C:/Perl/lib
> C:/Perl/site/lib .) at
> c:\inetpub\wwwroot\cgi-bin\develop\shp_crt\test.cgi line 9. BEGIN
> failed--compilation aborted at
> c:\inetpub\wwwroot\cgi-bin\develop\shp_crt\test.cgi line 9.
> 
> Do I have to modify %INC for IIS to find a non-standard module? 

Yes.

> It
> appears that the "." directory is in @INC, but the script cannot find
> it even though DG_DatabaseManager.pm is in the same directory as
> test.cgi.  Am I wrong in thinking that "." represents the
> "c:\inetpub\wwwroot\cgi-bin\develop\shp_crt" directory when that is
> where test.cgi is located?

Yes

You may either add
use lib 'c:\inetpub\wwwroot\cgi-bin\develop\shp_crt';
on top of the script or set the PERL5LIB system variable or add 
something to the registry (don't remember the path, look into the 
ActivePerl FAQ).

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Syntax a little funny ....

2003-12-08 Thread Jeff Westman
James Edward Gray II <[EMAIL PROTECTED]> wrote:

> On Dec 8, 2003, at 11:28 AM, Jeff Westman wrote:
> 
> > [EMAIL PROTECTED] wrote:
> >
> >> Here is some syntax I found a little funny, and I was hoping somebody
> >> could explain this too me:
> >>
> >> opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
> >> @dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR);
> >> closedir DIR;
> >>
> >> The first and 3rd lines I have no problem with.
> >
> > The first line is better written as
> >
> >   opendir(DIR, $some_dir) or die "can't opendir $some_dir: $!";
> >
> > Note the use of 'or' instead of '||'.  Precedence is extremely 
> > important,
> > especially in perl where so much of the code can be "short-circuited".
> 
> Changing the || to or in the above line has no effect.  

Right, but too often one uses '||' and meant to use 'or'.  It bites me every
time .

>  However, as 
> Jeff said, parens in Perl are often optional on subroutine calls and if 
> we leave those out:
> 
> opendir DIR, $some_dir or die "can't opendir $some_dir: $!";
> 
> We get the traditional Perl open() call and here it matters if we use 
> || or or.  Why do we write it like that?  We like the way it reads.
> 
> >> Its that line with the grep in it.
> >> grep is obviously a built-in perl function.
> >>
> >> This is something I've seen before ...
> >> the output of the function readdir is "trickling down" to become the
> >> input of the function grep ?
> >
> > One minor problem, there is a comma missing before the 'readdir':
> >
> >   @dots = grep { /^\./ && -f "$some_dir/$_" }, readdir(DIR);
> 
> The line compiles fine.  The block version of grep() does not require a 
> comma.

Right again  this is a case where using parens will get you :) .. I
usually do:

  @dots = grep /^\./ && -f "$some_dir/$_", readdir(DIR);

(no parens)

>  perldoc -f grep
> 
> > No, you would use a while or for loop and then search for files not 
> > beginning with a dot.
> 
> > So while-readdir, search for files (only) and test if they DONT begin 
> > with a dot, then store them into an array.  Now that we have the
> 
> You say this twice, but that still doesn't make it true.  

Woops ... my bad!

> I think you 
> need to reread that grep() call.  ;)  We're searching for files that DO 
> begin with a dot here and placing them in the fitting @dots array.

My bad :)

> >> If that is so, what is all that business with the curly braces ?
> >> I thought curly braces are supposed to denote code sections ?
> 
> This is correct, it's a "chunk of code".  It will be executed once for 
> each item returned by readdir().
> 
> >> p.s. It seems some of my confusion comes from the fact that I am used 
> >> to
> >> putting () around funtion calls. That still doesn't help with the 
> >> curly
> >> braces though ... %^)
> >
> > Parens are often optional.  When in doubt, use them.  I never use them 
> > in
> > simple print statemtents, but some functions like 'split', it just 
> > makes more
> > sense.
> 
> I think the easiest rule to start learning with in use parens for your 
> own subs and leave them off of built-ins, except when you need them to 
> clarify/enforce precedence.

I might add that parens can make your code more readable, but can also make
it harder to read some times too.  Parens often denote precedence, while
braces tend to be used for scoping.  This isn't a hard and fast rule though. 
Case-in-point, read:  perldoc -f map

-Jeff

__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




@INC paths on an IIS server

2003-12-08 Thread Ron Goral
I am testing some scripts on an IIS server and receive the following error
when I attempt to "use" a module:

Can't locate DG_DatabaseManager.pm in @INC (@INC contains: C:/Perl/lib
C:/Perl/site/lib .) at c:\inetpub\wwwroot\cgi-bin\develop\shp_crt\test.cgi
line 9.
BEGIN failed--compilation aborted at
c:\inetpub\wwwroot\cgi-bin\develop\shp_crt\test.cgi line 9.

Do I have to modify %INC for IIS to find a non-standard module?  It appears
that the "." directory is in @INC, but the script cannot find it even though
DG_DatabaseManager.pm is in the same directory as test.cgi.  Am I wrong in
thinking that "." represents the
"c:\inetpub\wwwroot\cgi-bin\develop\shp_crt" directory when that is where
test.cgi is located?

Ahead of time, I have this directory's permissions up to execute both
scripts and executables and, for now, it is operating under the
administrator's account so there are no issues with permissions.

Thanks -
Ron Goral


Re: [OT] Education Level

2003-12-08 Thread Chuck Fox
[EMAIL PROTECTED] wrote:

Hello,

Hi Charles,

   A recent job posting has left me curious. I would never
take a full time job as a programmer or as anything else for
that matter. I just don't make a good employee any more.
Been there. Done that.
   The job posting demanded a college degree. I had one
semester of college 20 years ago and normally classify
myself as "finished high school". I'm curious: What level of
education have list members attained?
TEA,

Charles K. Clarkson

Took a college course in Basic back in 1980.  Thats all the "higher" 
education that I took. 

Chuck

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Syntax a little funny ....

2003-12-08 Thread James Edward Gray II
On Dec 8, 2003, at 11:28 AM, Jeff Westman wrote:

[EMAIL PROTECTED] wrote:

Here is some syntax I found a little funny, and I was hoping somebody
could explain this too me:
opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
@dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR);
closedir DIR;
The first and 3rd lines I have no problem with.
The first line is better written as

  opendir(DIR, $some_dir) or die "can't opendir $some_dir: $!";

Note the use of 'or' instead of '||'.  Precedence is extremely 
important,
especially in perl where so much of the code can be "short-circuited".
Changing the || to or in the above line has no effect.  However, as 
Jeff said, parens in Perl are often optional on subroutine calls and if 
we leave those out:

opendir DIR, $some_dir or die "can't opendir $some_dir: $!";

We get the traditional Perl open() call and here it matters if we use 
|| or or.  Why do we write it like that?  We like the way it reads.

Its that line with the grep in it.
grep is obviously a built-in perl function.
This is something I've seen before ...
the output of the function readdir is "trickling down" to become the
input of the function grep ?
One minor problem, there is a comma missing before the 'readdir':

  @dots = grep { /^\./ && -f "$some_dir/$_" }, readdir(DIR);
The line compiles fine.  The block version of grep() does not require a 
comma.

perldoc -f grep

No, you would use a while or for loop and then search for files not 
beginning
with a dot.

So while-readdir, search for files (only) and test if they DONT begin 
with a dot, then store them into an array.  Now that we have the
You say this twice, but that still doesn't make it true.  I think you 
need to reread that grep() call.  ;)  We're searching for files that DO 
begin with a dot here and placing them in the fitting @dots array.

If that is so, what is all that business with the curly braces ?
I thought curly braces are supposed to denote code sections ?
This is correct, it's a "chunk of code".  It will be executed once for 
each item returned by readdir().

p.s. It seems some of my confusion comes from the fact that I am used 
to
putting () around funtion calls. That still doesn't help with the 
curly
braces though ... %^)
Parens are often optional.  When in doubt, use them.  I never use them 
in
simple print statemtents, but some functions like 'split', it just 
makes more
sense.
I think the easiest rule to start learning with in use parens for your 
own subs and leave them off of built-ins, except when you need them to 
clarify/enforce precedence.

James

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE: Can't find package AutoLoader in CGI::Application program

2003-12-08 Thread NYIMI Jose (BMB)
Try putting
1;
As the last line of your GroupRank.pm file.

Remember that a module (*.pm file) is
supposed to return a true value.

José.

-Original Message-
From: david [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 08, 2003 7:06 PM
To: [EMAIL PROTECTED]
Subject: Re: Can't find package AutoLoader in CGI::Application program


Jon Seidel wrote:

[snip]

> The beginning of my GroupRank.pm file looks like this: 
> /// package GroupRank;
> use base 'CGI::Application';
> use AutoLoader;
> #use DBI;
> 
> use strict;
> use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
> $|++;

your GroupRank.pm module doesn't seem to return a true value. change '$|++;' 
to '$|=1;' and see what happen.

david
-- 
s,.*,<<,e,y,\n,,d,y,.s,10,,s
.ss.s.s...s.sss.s.ss
s.s.s...s...s..s
...s.ss..s.sss..ss.sss.s
s.s.s...ss.sss.s
..s..sss.s.ss.sss...
..ssss.sss.sss.s

,{4},"|?{*=}_'y!'+0!$&;"
,ge,y,!#:$_(-*[./<[EMAIL PROTECTED],b-t,
.y...,$~=q~=?,;^_#+?{~,,$~=~
y.!-&*-/:[EMAIL PROTECTED] ().;s,;,
);,g,s,s,$~s,g,y,y,%,,g,eval

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]  





 DISCLAIMER 

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




perl and qmail aliases

2003-12-08 Thread Andrew Gaffney
I wrote a Perl script that runs a query against a MySQL db to get a list of customer email 
addresses. This script then takes a full email for input and rewrites the 'To' header and 
sends it with qmail-inject for each email address from the db. I have an alias set up in 
qmail that pipes anything sent through it into this script that I wrote. This setup works 
just fine, except when an email address no longer exists. The MTA of the server where the 
email no longer exists sends the failure notice to alias@ instead of to 
@. Does anyone know why this is? Also, does anyone see any ways I 
could optimize my script? My script is below.

#!/usr/bin/perl
use DBI();
my $counter = 0;
my @email;
my $dbh = DBI->connect("DBI:mysql:database=;host=", "", "", 
{'RaiseError' => 1});
my $query = "SELECT fname, lname, homeemail, officeemail FROM people WHERE current=1";
my $sth = $dbh->prepare($query);
$sth->execute();

@email = ;

while(my $ref = $sth->fetchrow_hashref()) {
  if($ref->{homeemail} ne "NULL" && $ref->{homeemail} ne "") {
open PIPE, "| /var/qmail/bin/qmail-inject $ref->{homeemail}";
foreach my $line (@email) {
  $line =~ s/^To: .+$/To: \"$ref->{fname} $ref->{lname}\" <$ref->{homeemail}>/;
  print PIPE "$line";
}
close PIPE;
  }
  if($ref->{officeemail} ne "NULL" && $ref->{officeemail} ne "") {
open PIPE, "| /var/qmail/bin/qmail-inject $ref->{officeemail}";
foreach my $line (@email) {
  $line =~ s/^To: .+$/To: \"$ref->{fname} $ref->{lname}\" <$ref->{officeemail}>/;
  print PIPE "$line";
}
close PIPE;
  }
}
$sth->finish();
$dbh->disconnect();
--
Andrew Gaffney
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Can't find package AutoLoader in CGI::Application program

2003-12-08 Thread david
Jon Seidel wrote:

[snip]

> The beginning of my GroupRank.pm file looks like this:
> ///
> package GroupRank;
> use base 'CGI::Application';
> use AutoLoader;
> #use DBI;
> 
> use strict;
> use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
> $|++;

your GroupRank.pm module doesn't seem to return a true value. change '$|++;' 
to '$|=1;' and see what happen.

david
-- 
s,.*,<<,e,y,\n,,d,y,.s,10,,s
.ss.s.s...s.sss.s.ss
s.s.s...s...s..s
...s.ss..s.sss..ss.sss.s
s.s.s...ss.sss.s
..s..sss.s.ss.sss...
..ssss.sss.sss.s

,{4},"|?{*=}_'y!'+0!$&;"
,ge,y,!#:$_(-*[./<[EMAIL PROTECTED],b-t,
.y...,$~=q~=?,;^_#+?{~,,$~=~
y.!-&*-/:[EMAIL PROTECTED] ().;s,;,
);,g,s,s,$~s,g,y,y,%,,g,eval

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: [OT] Education Level

2003-12-08 Thread McMahon, Chris

Dropped out of 3 universities on 4 separate occasions (liberal arts
program, not science).  Was National Merit Scholar.  After dropping out for
the last time, spent 10 years as a bass player, waiter, and librarian.  Got
my first ever straight job 40 hrs/week 9-to-5 in 1997 at age 33 to write
documentation.  Within 6 months was debugging native Tandem TAL programs on
live production systems, which led to software testing, which led to
whatever it is you want to call I do now.  As drieux says, I just like to
"make go zoom zoom".  It's nice to get paid well for it, though... 
-Chris   

-Original Message-
From: Charles K. Clarkson [mailto:[EMAIL PROTECTED] 
Sent: Sunday, December 07, 2003 10:34 AM
To: [EMAIL PROTECTED]
Subject: [OT] Education Level

Hello,

A recent job posting has left me curious. I would never
take a full time job as a programmer or as anything else for
that matter. I just don't make a good employee any more.
Been there. Done that.

The job posting demanded a college degree. I had one
semester of college 20 years ago and normally classify
myself as "finished high school". I'm curious: What level of
education have list members attained?


TEA,

Charles K. Clarkson
-- 
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Syntax a little funny ....

2003-12-08 Thread Jeff Westman
[EMAIL PROTECTED] wrote:

> I've just started trying to pick up a little perl.
> I'm breezing through "Learning Perl" and reading the perl docs.

Excellent book. Do more than just "breeze" through it.  Study it thoroughly,
it's probably the single best starting place to learn perl.
 
> Here is some syntax I found a little funny, and I was hoping somebody
> could explain this too me:
> 
> opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
> @dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR);
> closedir DIR;
> 
> The first and 3rd lines I have no problem with.

The first line is better written as 

  opendir(DIR, $some_dir) or die "can't opendir $some_dir: $!";

Note the use of 'or' instead of '||'.  Precedence is extremely important,
especially in perl where so much of the code can be "short-circuited".

> Its that line with the grep in it.
> grep is obviously a built-in perl function.
> 
> This is something I've seen before ...
> the output of the function readdir is "trickling down" to become the
> input of the function grep ?

One minor problem, there is a comma missing before the 'readdir':

  @dots = grep { /^\./ && -f "$some_dir/$_" }, readdir(DIR);

> In C or Java you would write
> grep(readdir(DIR)) most likely ?

No, you would use a while or for loop and then search for files not beginning
with a dot.  Sure, you can embed functions in perl (duh), but you have to put
it into a loop construct.  Here, in perl, it is implied.
 
> If that is so, what is all that business with the curly braces ?
> I thought curly braces are supposed to denote code sections ?

You mean scope definition? Someone else can do a better job than I can on
this, but you can use them basically whenever you want, or to combine
sections of code/statements.

> So, it's like the output of readdir is "trickling" through the curly
> braces and then the output after this is "trickling" through grep ?

It's a matter of precedence, really.  I wouldn't say it is "trickling",
rather one function completing and passing it's result to the next one, just
as you can in C/C++.

> If so, what is the "input" to the code section in the curly braces ?

It's readdir().   So while-readdir, search for files (only) and test if they
DONT begin with a dot, then store them into an array.  Now that we have the
files that match what we want, we close the directory since we don't need it
any longer.

> Anyhow, all this is a bit weird to me, so I was hoping someone could
> shed some light on it.

Perl can be written more 'C like', but why not take advantage of it's
combination power whenever practical (and readable!).

> thanks and cheers,

Hope this helps
 
> p.s. It seems some of my confusion comes from the fact that I am used to
> putting () around funtion calls. That still doesn't help with the curly
> braces though ... %^)

Parens are often optional.  When in doubt, use them.  I never use them in
simple print statemtents, but some functions like 'split', it just makes more
sense.

Your mileage may vary :)

-Jeff





__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Syntax a little funny ....

2003-12-08 Thread Robert Brown
That is a a great description of what is going on, but I think his
question centered on the &SYNTAX*, not the *SEMANTICS*.  As a
programmer from the "algebraic" school (FORTRAN, algol, pascal, C,
Ada, etc.), he is unacustomed to seeing a function call without
surrounding parens.  The key concept here, and one that is rather
"perly", is "list context" and "scalar context".

James Edward Gray II writes:
 > On Dec 8, 2003, at 10:52 AM, [EMAIL PROTECTED] wrote:
 > 
 > > I've just started trying to pick up a little perl.
 > > I'm breezing through "Learning Perl" and reading the perl docs.
 > >
 > > Here is some syntax I found a little funny, and I was hoping somebody
 > > could explain this too me:
 > >
 > > opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
 > > @dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR);
 > > closedir DIR;
 > >
 > > The first and 3rd lines I have no problem with.
 > >
 > > Its that line with the grep in it.
 > 
 > Okay, let's go step by step  readdir() is called (in list context), so 
 > it returns all entries in the directory.  Simple enough.
 > 
 > That returned list is immediately fed to another built-in, grep().  
 > grep() goes through every element in the list, checking it against some 
 > expression you provide (the part in the braces).  Inside the 
 > expression, the element you're currently checking is in Perl's default 
 > variable $_.  If the expression returns true for that element, it is 
 > included in grep()'s return list.  If not, it is omitted.
 > 
 > In this case, the expression check two things.  First, it uses a 
 > pattern match on the name to see if it begins with a dot (.).  If it 
 > does, it checks to make sure the entry is a file, to rule out entries 
 > like '.' and '..'.  If the entry passes both tests, grep() returns it.  
 > Otherwise, it's let out of the return list.  It may help to think of 
 > grep() as a filtering engine you can use to build on-the-fly lists.
 > 
 > Finally, the list returned by grep() is assigned to @dots, which is 
 > pretty much what it will contain, any file beginning with a dot (hidden 
 > files on a Unix system).
 > 
 > Here's a rough English translation of the line:
 > 
 > place in @dots all things beginning with . that are actually files from 
 > the listing for DIR
 > 
 > Hope that helps.
 > 
 > James
 > 
 > 
 > -- 
 > To unsubscribe, e-mail: [EMAIL PROTECTED]
 > For additional commands, e-mail: [EMAIL PROTECTED]
 >  
 > 
 > 
 > 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Syntax a little funny ....

2003-12-08 Thread James Edward Gray II
On Dec 8, 2003, at 10:52 AM, [EMAIL PROTECTED] wrote:

I've just started trying to pick up a little perl.
I'm breezing through "Learning Perl" and reading the perl docs.
Here is some syntax I found a little funny, and I was hoping somebody
could explain this too me:
opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
@dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR);
closedir DIR;
The first and 3rd lines I have no problem with.

Its that line with the grep in it.
Okay, let's go step by step  readdir() is called (in list context), so 
it returns all entries in the directory.  Simple enough.

That returned list is immediately fed to another built-in, grep().  
grep() goes through every element in the list, checking it against some 
expression you provide (the part in the braces).  Inside the 
expression, the element you're currently checking is in Perl's default 
variable $_.  If the expression returns true for that element, it is 
included in grep()'s return list.  If not, it is omitted.

In this case, the expression check two things.  First, it uses a 
pattern match on the name to see if it begins with a dot (.).  If it 
does, it checks to make sure the entry is a file, to rule out entries 
like '.' and '..'.  If the entry passes both tests, grep() returns it.  
Otherwise, it's let out of the return list.  It may help to think of 
grep() as a filtering engine you can use to build on-the-fly lists.

Finally, the list returned by grep() is assigned to @dots, which is 
pretty much what it will contain, any file beginning with a dot (hidden 
files on a Unix system).

Here's a rough English translation of the line:

place in @dots all things beginning with . that are actually files from 
the listing for DIR

Hope that helps.

James

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Syntax a little funny ....

2003-12-08 Thread ebone+perl
I've just started trying to pick up a little perl.
I'm breezing through "Learning Perl" and reading the perl docs.

Here is some syntax I found a little funny, and I was hoping somebody
could explain this too me:

opendir(DIR, $some_dir) || die "can't opendir $some_dir: $!";
@dots = grep { /^\./ && -f "$some_dir/$_" } readdir(DIR);
closedir DIR;

The first and 3rd lines I have no problem with.

Its that line with the grep in it.
grep is obviously a built-in perl function.

This is something I've seen before ...
the output of the function readdir is "trickling down" to become the
input of the function grep ?

In C or Java you would write
grep(readdir(DIR)) most likely ?

If that is so, what is all that business with the curly braces ?
I thought curly braces are supposed to denote code sections ?

So, it's like the output of readdir is "trickling" through the curly
braces and then the output after this is "trickling" through grep ?

If so, what is the "input" to the code section in the curly braces ?

Anyhow, all this is a bit weird to me, so I was hoping someone could
shed some light on it.

thanks and cheers,
e

p.s. It seems some of my confusion comes from the fact that I am used to
putting () around funtion calls. That still doesn't help with the curly
braces though ... %^)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Weekly list FAQ posting

2003-12-08 Thread casey
NAME
beginners-faq - FAQ for the beginners mailing list

1 -  Administriva
  1.1 - I'm not subscribed - how do I subscribe?
Send mail to <[EMAIL PROTECTED]>

You can also specify your subscription email address by sending email to
(assuming [EMAIL PROTECTED] is your email address):

<[EMAIL PROTECTED]>.

  1.2 -  How do I unsubscribe?
Now, why would you want to do that? Send mail to
<[EMAIL PROTECTED]>, and wait for a response. Once you
reply to the response, you'll be unsubscribed. If that doesn't work,
find the email address which you are subscribed from and send an email
like the following (let's assume your email is [EMAIL PROTECTED]):

<[EMAIL PROTECTED]>

  1.3 - There is too much traffic on this list. Is there a digest?
Yes. To subscribe to the digest version of this list send an email to:

<[EMAIL PROTECTED]>

To unsubscribe from the digest, send an email to:

<[EMAIL PROTECTED]>

This is a high traffic list (100+ messages per day), so please subscribe
in the way which is best for you.

  1.4 - Is there an archive on the web?
Yes, there is. It is located at:

http://archive.develooper.com/beginners%40perl.org/

  1.5 - How can I get this FAQ?
This document will be emailed to the list once a week, and will be
available online in the archives, and at http://learn.perl.org/

  1.6 - I don't see something in the FAQ, how can I make a suggestion?
Send an email to <[EMAIL PROTECTED]> with your suggestion.

  1.7 - Is there a supporting website for this list?
Yes, there is. It is located at:

http://beginners.perl.org/

  1.8 - Who owns this list?  Who do I complain to?
Casey West owns the beginners list. You can contact him at
[EMAIL PROTECTED]

  1.9 - Who currently maintains the FAQ?
Kevin Meltzer, who can be reached at the email address (for FAQ
suggestions only) in question 1.6

  1.10 - Who will maintain peace and flow on the list?
Casey West, Kevin Meltzer and Ask Bjoern Hansen currently carry large,
yet padded, clue-sticks to maintain peace and order on the list. If you
are privately emailed by one of these folks for flaming, being
off-topic, etc... please listen to what they say. If you see a message
sent to the list by one of these people saying that a thread is closed,
do not continue to post to the list on that thread! If you do, you will
not only meet face to face with a XQJ-37 nuclear powered pansexual
roto-plooker, but you may also be taken off of the list. These people
simply want to make sure the list stays topical, and above-all, useful
to Perl beginners.

  1.11 - When was this FAQ last updated?
Sept 07, 2001

2 -  Questions about the 'beginners' list.
  2.1 - What is the list for?
A list for beginning Perl programmers to ask questions in a friendly
atmosphere.

  2.2 - What is this list _not_ for?
* SPAM
* Homework
* Solicitation
* Things that aren't Perl related
* Monkeys
* Monkeys solicitating homework on non-Perl related SPAM.

  2.3 - Are there any rules?
Yes. As with most communities, there are rules. Not many, and ones that
shouldn't need to be mentioned, but they are.

* Be nice
* No flaming
* Have fun

  2.4 - What topics are allowed on this list?
Basically, if it has to do with Perl, then it is allowed. You can ask
CGI, networking, syntax, style, etc... types of questions. If your
question has nothing at all to do with Perl, it will likely be ignored.
If it has anything to do with Perl, it will likely be answered.

  2.5 - I want to help, what should I do?
Subscribe to the list! If you see a question which you can give an
idiomatic and Good answer to, answer away! If you do not know the
answer, wait for someone to answer, and learn a little.

  2.6 - Is there anything I should keep in mind while answering?
We don't want to see 'RTFM'. That isn't very helpful. Instead, guide the
beginner to the place in the FM they should R :)

Please do not quote the documentation unless you have something to add
to it. It is better to direct someone to the documentation so they
hopefully will read documentation above and beyond that which answers
their question. It also helps teach them how to use the documentation.

  2.7 - I don't want to post a question if it is in an FAQ. Where should I
look first?
Look in the FAQ! Get acquainted with the 'perldoc' utility, and use it.
It can save everyone time if you look in the Perl FAQs first, instead of
having a list of people refer you to the Perl FAQs :) You can learn
about 'perldoc' by typing:

"perldoc perldoc"

At your command prompt. You can also view documentation online at:

http://www.perldoc.com and http://www.perl.com

  2.8 Is this a high traffic list?
YES! You have been warned! If you don't want to get ~100 emails per day
from this list, consider s

RE: [OT] Education Level

2003-12-08 Thread Robert Brown
My junior year of high school, my school obtained an IBM 1401
computer.  I was all over that thing as soon as I saw the shipping
crates.  I had obtained a copy of the reference manual (the so called
"Principals of Operation", or "PO") before it was out of the crate.  I 
asked if classes would be taught on it, and was told one class would
be open to seniors only.  The instructor was a nice guy though, and
offerred to let me sit in on the open labs in the afternoon, even
though I was only a junior.  When I became a senior, I took the class, 
which was a peice of cake by that time, as I had a year of programming 
under my belt then.  I knew I wanted to work with computers.  I
decided to go to Duke and major in electrical engineering. 

I spent my freshman year at Duke in 1969 and got kicked out because
the second semister I lived in the computer center and never went to
class.  When finals rolled around, I could not even remember what
classes I was enrolled in, so they kicked me out!  I then tried to get 
work as a programmer, since I had already taken all the software
courses that Duke offered, and was pretty good at programming.  

It was hard to get a job the summer of 1970.  Engineers were driving
taxicabs in NYC back then.  I finally got a trainee position with the
New Jersey Bell Telephone Company.  They gave me 6 months to learn
COBOL and write a training program.  I took the RCA Spectra-70 COBOL
Languagre Reference Manual home with me and learned COBOL in less than
a week.  I thought it was a pretty brain-dead language even then, as I
had worked in FORTRAN and PL/1, with some 360-BAL.  I particularly
loathed the lack of good string manipulation routines in COBOL, so I
wrote my own strings package in assembler.  I then used this package
to write my training program.  My boss was a useless RPG programmer.
He totally did not understand what I had written.  He could see that
it worked, but the idea of a trainee writing his own hot-rod strings
package in assembler was a major shock to him.

So I went back to school -- this time in a liberal arts college that
did not even have a computer.  In fact, the only involvement I had
with computers the next 3 years was to teach a mini-course on
programming that a local aerospace firm provided the computer time
for.  I majored in math.  If the school had offered minors, I would
have had minors in physics and biology.  If I had stayed another
semister, I could have had a triple major.  I went out into the
workplace by default one spring when I could not land a summer job,
but I was able to land a full time job.  I finished up school at night 
and with an independent study.

Ten years later, now married and with a daughter, mortgage, and all
that, my wife talked me into going back to grad school.  I went at
night, and I majored again in math, because the computer science
couses were taught in in the school of business, and the computer
engineering courses were taught in around embedded systems, which I
had done so much of by that time I would have been way ahead of the
teachers.  The math department, however, was the seat of the
artificial intelligence research, and that was where my real interest
was.  I did all the credits, but not the thesis, since I had to move
before I finished.  I turned my first thesis topic into a paper and
published it in Doctor Dobbs Journal in April of 1986.  I published
another paper with them in April 1988, and 2 more later on, although
the latter two were not AI related.

By this time, I had my own consulting business, working full time as
an independent consultant, mostly on embedded systems stuff.  This
continued up until the big "dot-com crach" in 2000.  I have not had a
proper consulting assignment since March of 2001, although I did do
one little thing involving the addition of some customization to VNC.

I am seriously contemplating a minor career change from software
development to systems administration, as too many of the development
jobs are going to non-English speaking countries for below minimum
wage rates.  In order to really administer a system, you sometimes
need to be staring it in the face, where you can push buttons, flip
switches, and attack it with a screwdriver and soldering iron.  It
will be harder to ship those jobs off to a remote location.

Education is nice, but the economy is the governing factor.  I still
have that wife and daughter I told you about!


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: [OT] Education Level

2003-12-08 Thread km

Hi all,

I have done my BSc in Biology , Masters in biochemistry rightnow i am doing my PhD in 
Bioinformatics and i extensively use  Perl at my work.
Most of Perl i have learnt is from this mailing list and the  system manuals :)

KM
---
On Mon, Dec 08, 2003 at 07:19:21AM -0800, J Ingersoll wrote:
> 
> B.A., Computer Science, -- when ? -- I recall an assignment to write
> microcode for the "latest" Intel processor at that time, the 8088 (we had
> a choice between that and the Motorola 68??).  
> 
> I'd like to know how many in the list  - employed for their perl skills -
> learned perl on their own (practice, forums, books, et. al. ) and how many
> attended formal classes ...? (I'd looking to break out of a
> non-challenging career in mainframe work :^>  )
> 
> thanks ji
> 
> 
> __
> Do you Yahoo!?
> Protect your identity with Yahoo! Mail AddressGuard
> http://antispam.yahoo.com/whatsnewfree
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
> 
> 

-- 




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: [OT] Education Level

2003-12-08 Thread Tim Johnson

Everything I know about Perl I learned from books, Google, and this list.

-Original Message-
From: J Ingersoll [mailto:[EMAIL PROTECTED]
Sent: Monday, December 08, 2003 7:19 AM
To: Perl Beginner's List
Subject: RE: [OT] Education Level



I'd like to know how many in the list  - employed for their perl skills -
learned perl on their own (practice, forums, books, et. al. ) and how many
attended formal classes ...? (I'd looking to break out of a
non-challenging career in mainframe work :^>  )

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: [OT] Education Level

2003-12-08 Thread Wiggins d Anconia
> 
> B.A., Computer Science, -- when ? -- I recall an assignment to write
> microcode for the "latest" Intel processor at that time, the 8088 (we had
> a choice between that and the Motorola 68??).  
> 
> I'd like to know how many in the list  - employed for their perl skills -
> learned perl on their own (practice, forums, books, et. al. ) and how many
> attended formal classes ...? (I'd looking to break out of a
> non-challenging career in mainframe work :^>  )
> 

On my "own", meaning no formal education in Perl. I got my start on the
job from 2 programmers that came before me (which is why it wasn't
really on my own), but that was 1997 and times have changed, a lot. 
However I learned *Perl programming* from this list and reading the docs
over the last year and a half, before that I was, at best, doing Perl 4
web programming, which *is* a different thing, though I wouldn't have
admitted it (and didn't really know it), either, at the time :-).

You have hit on the key point for me, this game is about constantly
learning, doctors have CME, dentists have CDE, other professions require
re-education to remain licensed, while I don't know that I would agree
with licensing programmers in a similar manner, if a developer believes
they will not fall behind by sitting comfortably in their current
position they are definitely going to find themselves as obsolete as the
tech they work in.  Whether it matters is a different discussion and one
that others have hinted to...

http://danconia.org


--
Boycott the Sugar Bowl! You couldn't pay me to watch that game.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: This seems to ease

2003-12-08 Thread Casey West
It was Monday, December 08, 2003 when [EMAIL PROTECTED] took the soap box, saying:
: I did the 'in' function for seeing if one element is inside on list like.
: 
: sub in {
: my $match = shift;
: foreach (@_) {
: return 1 if $match eq $_;
: }
: return 0;
: }
: 
: so I'm calling the function like 
: 
: if(in($x => (1,2,3))) {
:...
: };
: 
: this seems to be nice. After this I sink: why not to write
: 
: if ($x in (1,2,3)) {
:...
: }

You would need a source filter for this, and that would be bad.  I'm
not saying my more OO solution below isn't equally evil, mind, but I
find it fun.  This code could be considered deep magic, and I use grep
to make my life easy for example, so I'm not going to explain it.
I'll leave that to others if they like. :-)

First, the SuperScalar package.

  package SuperScalar;
  require Tie::Scalar;
  @SuperScalar::ISA = qw[Tie::StdScalar];
  use overload
'""' => sub { ${$_[0]} },
'+'  => sub { ${$_[0]} + $_[1] };
  sub in {
  my ($self, @vals) = @_;
  if ( grep { ($$self cmp $_) == 0 } @vals ) {
  return 1;
  }
  return 0;
  }
  sub FETCH { $_[0] }

Next, the calling code.

  use Attribute::Handlers autotie => { SS => 'SuperScalar' };
  my $var :SS(2);
  $\ = "\n";
  print "$var"; # expect: 2   
  print $var + $var;# expect: 4   
  print $var->in(1..3); # expect: 1   
  print $var->in(3..5); # expect: 0   

Enjoy!

  Casey West

-- 
Shooting yourself in the foot with DOS 
You finally found the gun, but can't locate the file with the foot for
the life of you. 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: This seems to ease

2003-12-08 Thread Wiggins d Anconia


> On Dec 8, 2003, at 9:05 AM, Wiggins d Anconia wrote:
> 
> > I did the 'in' function for seeing if one element is inside on list 
> > like.
> >>
> >> sub in {
> >> my $match = shift;
> >> foreach (@_) {
> >> return 1 if $match eq $_;
> >> }
> >> return 0;
> >> }
> >>
> >> so I'm calling the function like
> >>
> >> if(in($x => (1,2,3))) {
> >>...
> >> };
> >>
> >
> > While I realize your question is more about creating operators, etc.
> > Would 'grep' not work the same as the above?
> >
> > perldoc -f grep
> 
> Well, grep() would be significantly less efficient for huge lists since 
> it examines all the entries, right?
> 
> James
> 

Good point, are there internal optimizations based on data that can
speed that up?  For a huge list, what about memory allocation and
resources, I would think at least passing by reference would be a better
approach?

http://danconia.org


--
Boycott the Sugar Bowl! You couldn't pay me to watch that game.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Connecting to SQL 2000 Database

2003-12-08 Thread Charles K. Clarkson
Neill <[EMAIL PROTECTED]> wrote:

: Is their a simple how to page I can access on the web ?

http://www.roth.net/perl/odbc/faq/#How%20do%20I%20use%20Win32::ODBC


HTH,

Charles K. Clarkson
-- 
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: [OT] Education Level

2003-12-08 Thread J Ingersoll

B.A., Computer Science, -- when ? -- I recall an assignment to write
microcode for the "latest" Intel processor at that time, the 8088 (we had
a choice between that and the Motorola 68??).  

I'd like to know how many in the list  - employed for their perl skills -
learned perl on their own (practice, forums, books, et. al. ) and how many
attended formal classes ...? (I'd looking to break out of a
non-challenging career in mainframe work :^>  )

thanks ji


__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: This seems to ease

2003-12-08 Thread Jeff 'japhy' Pinyan
On Dec 8, Wiggins d Anconia said:

>> I did the 'in' function for seeing if one element is inside on list like.
>
>While I realize your question is more about creating operators, etc.
>Would 'grep' not work the same as the above?

But his in() function short-circuits; grep() does not.  grep() will keep
going through the ENTIRE list, even if the FIRST element matches.

There's always the first() function from List::Util.

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


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: This seems to ease

2003-12-08 Thread James Edward Gray II
On Dec 8, 2003, at 9:05 AM, Wiggins d Anconia wrote:

I did the 'in' function for seeing if one element is inside on list 
like.
sub in {
my $match = shift;
foreach (@_) {
return 1 if $match eq $_;
}
return 0;
}
so I'm calling the function like

if(in($x => (1,2,3))) {
   ...
};
While I realize your question is more about creating operators, etc.
Would 'grep' not work the same as the above?
perldoc -f grep
Well, grep() would be significantly less efficient for huge lists since 
it examines all the entries, right?

James

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Connecting to SQL 2000 Database

2003-12-08 Thread neill . taylor


I am a complete beginner to PERL and programming. I am struggling to wade
through all the relevant documentation about database connectivity etc.  I
simply want to write a PERL script for a w2000 client machine to connect to
a SQL2000 2000 server and read a table in a database to obtain a value

Is their a simple how to page I can access on the web ?


Neill










IMPORTANT NOTICE  This email (including any attachments) is meant only for the 
intended recipient. It may also contain confidential and privileged information.  If 
you are not the intended recipient, any reliance on, use, disclosure, distribution or 
copying of this email or attachments is strictly prohibited. Please notify the sender 
immediately by email if you have received this message by mistake and delete the email 
and all attachments. 

Any views or opinions in this email are solely those of the author and do not 
necessarily represent those of Trinity Mirror PLC or its associated group companies 
(hereinafter referred to as "TM Group"). TM Group accept no liability for the content 
of this email, or for the consequences of any actions taken on the basis of the 
information provided, unless that information is subsequently confirmed in writing. 
Although every reasonable effort is made to keep its network free from viruses, TM 
Group accept no liability for any virus transmitted by this email or any attachments 
and the recipient should use up-to-date virus checking software. Email to or from this 
address may be subject to interception or monitoring for operational reasons or for 
lawful business practices. 

Trinity Mirror PLC is the parent  company of the Trinity Mirror group of companies and 
is registered in England No 82548, with its address at One Canada Square, Canary 
Wharf, London E14 5AP. 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: This seems to ease

2003-12-08 Thread Wiggins d Anconia


> I did the 'in' function for seeing if one element is inside on list like.
> 
> sub in {
> my $match = shift;
> foreach (@_) {
> return 1 if $match eq $_;
> }
> return 0;
> }
> 
> so I'm calling the function like 
> 
> if(in($x => (1,2,3))) {
>...
> };
> 

While I realize your question is more about creating operators, etc.
Would 'grep' not work the same as the above?

perldoc -f grep

http://danconia.org

--
Boycott the Sugar Bowl! You couldn't pay me to watch that game.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: [OT] Education Level

2003-12-08 Thread Bob Showalter
radhika sambamurti wrote:
> I chose the liberal arts route, and ended up with a degree in
> economics and history.

I took a similar route. B.A., History and M.B.A., Finance.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Reading from a log - still a problem

2003-12-08 Thread R. Joseph Newton
danield wrote:

> Hello all,
>
> I have received a solution for my problem (reading from log) from Tom
> Kinzer. The code is:
>
> #!/usr/bin/perl -w
> use strict;
> my $log_file = "/appl/log/4e4d/20031130.txt";
> open LOG, "< $log_file" or die "Could not open file $!";
> while (  ) {
>   chomp;
>   if ( /^GTotal Content:/ ) {
>   my ($gtotal_content, $value) = split(/:/, $_);
>   print $value;
>   }
> }
> close LOG;
>
> The problem is this code returns no value. When I remove all preceding
> lines from the log (20031130.txt) and keep there only that GTotal
> Content: 14,741,322, I will get desired result (14,741,322)
>
> What may be a solution for this?

As I recall, your desired data was on the line following that label.
Since you started a new thread here, I'm not going to hunt down the
original.  If this is the case, though, then you should still be moving
forward another line before you try to extract the data.  Also:
1) There is no point in chomp()ing all input lines.  You are testing the
start of the line, and chomp affects only the end.  I'd suggest moving the
chomp inside the if block.
2) From the sample posted on the original, it looks like you will need to
trim leading white space before taking a value.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: stripping last field of a carriage return

2003-12-08 Thread R. Joseph Newton
Tom Kinzer wrote:

> Oops.  012.  :(

Close, but not quite:

Carriage return
Hex: A;  Decimal: 10;  Octal 012

Line feed:
Hex:  D;  Decimal 13;  Octal: 015

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: This seems to ease

2003-12-08 Thread Jeff 'japhy' Pinyan
On Dec 8, [EMAIL PROTECTED] said:

>I did the 'in' function for seeing if one element is inside on list like.

Well, although it's overkill, Quantum::Superpositions has a 'any' function
that can be used like so:

  if ($x == any(1, 4, 9, 16)) { ... }

But Q::SP is a really big module, and won't work as efficiently as it
theoretically should.

>sub in {
>my $match = shift;
>foreach (@_) {
>return 1 if $match eq $_;
>}
>return 0;
>}

That's a very succinct function, and probably the best way to write it.

>package MyFilter;
>use Filter::Simple;
>use vars qw (@ISA @EXPORT @EXPORT_OK);
>
>require Exporter;
>push(@ISA, qw(Exporter));
>@EXPORT_OK = qw(in);
>
>FILTER_ONLY code => sub {
>my $ph = $Filter::Simple::placeholder;
>s/(((\$[a-zA-Z_0-9]+)|\-?[0-9]+(\.[0-9]+)?|$ph))\sin\s/in $1, /g;
>};

>This seems to work.
>Can someone test some more and give some bugs?
>Is there a generic module for doing operators?

I've never used Filter::Simple, so I don't know what $ph is representing,
so I'd like to know if your module can handle

  if ($this{big}->[$idx]{thing} in @set) { ... }

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


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Using Perl for English Grammar

2003-12-08 Thread James Edward Gray II
On Dec 8, 2003, at 3:33 AM, Jane Langley wrote:

Hi there,

I am interested in using Perl to generate proper
English grammatical sentences from a set "list of
words" and NOT from texts.
I was wondering whether there was any Perl code around
that I could have a look at, use and be able to
manipulate. There is not much around. I need it for
Windows and that is the problem. :(
Are there any potential sites, literature, research
papers that you would recommend I look at, or perl
experts in this field I could contact perhaps.
Most of the things I can remember seeing are about Perl reading 
English, not writing it.  There are a few programs and modules you 
might enjoy taking a look at in the book "Games, Diversions & Perl 
Culture", but I probably better warn you that I didn't enjoy that book 
much first.

How big a list of words are we talking about here?  What sentences will 
we be writing?  About what?  If you can give us some more details, we 
may be able to offer up some ideas.

James

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: [OT] Education Level

2003-12-08 Thread Rob Dixon
Marcos Rebelo wrote:
>
> I'm scared with this opinions. I don't know what you learn in that side of
> the Atlantic but from this side the University is very important. Most of
> all, for learning how to think.

Exactly. And that's the basis of all the best English universities which
are, sadly, being swamped by all of our 'polytechnics' being rebranded.

If you can't think, then no amount of 'Computer Science' lectures
will help you to program.

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




This seems to ease

2003-12-08 Thread Marcos . Rebelo
I did the 'in' function for seeing if one element is inside on list like.

sub in {
my $match = shift;
foreach (@_) {
return 1 if $match eq $_;
}
return 0;
}

so I'm calling the function like 

if(in($x => (1,2,3))) {
   ...
};

this seems to be nice. After this I sink: why not to write

if ($x in (1,2,3)) {
   ...
}

So I create one module like:

package MyFilter;
use Filter::Simple;
use vars qw (@ISA @EXPORT @EXPORT_OK);

require Exporter;
push(@ISA, qw(Exporter));
@EXPORT_OK = qw(in);

FILTER_ONLY code => sub { 
my $ph = $Filter::Simple::placeholder;
s/(((\$[a-zA-Z_0-9]+)|\-?[0-9]+(\.[0-9]+)?|$ph))\sin\s/in $1, /g;
};

sub in {
my $match = shift;
foreach (@_) {
return 1 if $match eq $_;
}
return 0;
}

1;

And this test script

use MyFilter qw (in);

my $xxx = "a";

if (4 in (2,3,4,5,6,7)) {
print "OK\n";
} else {
print "OPS\n"
}

if ($xxx in (2,3,"b",5,"",7)) {
print "OK\n";
} else {
print "OPS\n"
}


print('$xxx in 2, 3: ', ($xxx in 2, 3), "\n");
print('"b" in (2, 3)   : ', ("b" in (2, 3)), "\n");
print('4 in (2,3,4,5,6,7)  : ', (4 in (2,3,4,5,6,7)), "\n");
print('3.2 in 2, 3 : ', (3.2 in (2, 3)) , "\n");
print('in ($xxx => "a", 5) : ', in ($xxx => "a", 5) , "\n");


This seems to work. 
Can someone test some more and give some bugs?
Is there a generic module for doing operators?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: [OT] Education Level

2003-12-08 Thread Mr M senthil kumar
> The job posting demanded a college degree. I had one
> semester of college 20 years ago and normally classify
> myself as "finished high school". I'm curious: What level of
> education have list members attained?

> Charles K. Clarkson
> Head Bottle Washer,
> Clarkson Energy Homes, Inc.
> Mobile Home Specialists
> 254 968-8328

I have come across your mails a couple of times in this list. The
signature part always make me wonder what your profession means? Sorry if
i am offending you in anyway, i was just curious. Is it something funny
like "Assistant Button Pusher" ? Or is it something serious.

Senthil


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Using Perl for English Grammar

2003-12-08 Thread Jane Langley
Hi there,

I am interested in using Perl to generate proper
English grammatical sentences from a set "list of
words" and NOT from texts. 

I was wondering whether there was any Perl code around
that I could have a look at, use and be able to
manipulate. There is not much around. I need it for
Windows and that is the problem. :(

Are there any potential sites, literature, research
papers that you would recommend I look at, or perl
experts in this field I could contact perhaps.

Any help would be gratefully appreciated. :)

Jane



BT Yahoo! Broadband - Save £80 when you order online today. Hurry! Offer ends 21st 
December 2003. The way the internet was meant to be. 
http://uk.rd.yahoo.com/evt=21064/*http://btyahoo.yahoo.co.uk

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Education level

2003-12-08 Thread Gabor Urban
I have MSc degree (according to American levels) in math and physics,
and IT or CompSci is not my trained profession. It does not prevent me
from earning my money as a software developer (software engineer) in
the last 5 years.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: [OT] Education Level

2003-12-08 Thread Tim Johnson

I would count myself among those non-college graduates who have managed to secure 
"degree required" jobs (don't worry, I'm not a programmer, it just helps me with my 
work).  I don't think it has hurt me in the way of skills or cognitive abilities, but 
I had to learn on my own those things that I would probably have taken in a lot 
quicker in a more structured environment.  It was the hard way to go, and part of me 
will always wish I'd gone that route.  

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: [OT] Education Level

2003-12-08 Thread Marcos . Rebelo
I'm scared with this opinions. I don't know what you learn in that side of
the Atlantic but from this side the University is very important. Most of
all, for learning how to think. 

Anyone can do hacker programming but for doing software engineering you need
to know a little bit more. I have worked with all kind of persons:
physician, mathematician, web designers, ... And most of there work stinks,
the only words I can find to describe there work is "hacker programmers".

Marcos

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]