Re: Searching tecknical documentation

2004-11-16 Thread u235sentinel
Actually he wanted free documentaion not Oreilly stuff.  It's not free last 
time I checked.

If you want Oreilly stuff then try this:

http://oreilly.com/



> This is just what you want:
> 
> http://www.mamiyami.com/document/oreilly/
> 
> On Tue, 16 Nov 2004 11:02:18 +0800 (CST)
> Stephen Liu <[EMAIL PROTECTED]> wrote:
> 
> > Hi folks,
> > 
> > Please advise where can I find similar free
> > documentation on Internet, like;
> > 
> > programming perl (O'reilly)
> > Learning Perl (Llama)
> > Programming Perl (Camel)
> > Perl Cookbook (Ram)
> > 
> > Google search brought me tons of links which a
> > beginner finds it hard to sort out
> > 
> > TIA
> > 
> > B.R.
> > Stephen Liu
> > 
> > -- 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >  
> > 
> > 
> > 
> 
> 
> -- 
> Whatever you do will be insignificant,but 
> the important is you do it!
> 
> -- 
> 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: Perl Help: Array Manipulation

2003-12-25 Thread u235sentinel
I'm a newbie to perl also.  Been workign with it for a whole 2 weeks 
now.  Actually.. make that 3 ::grinz::

Warning.. lengthy email below.. I beg forgiveness in advance :-)

Ok.  Here is what I did.

#!/usr/bin/perl

@array1[0..5] = 1;
@total[0] = 0;
for($i=0; $i<4; $i++)
{
if($i == 0)
{
 @total[$i] = @array1[$i];
   print "First group";
 print @total[$i];
}
else
{
 $j = $i - 1;
   print "Second group";
 @total[$i] = @total[$j] + @array1[$i];
 print @total[$i];
}
}
When I run it I get the following:

First group1Second group1Second group1Second group1

So technically it's not even printing the total of your array.  The 
array is fine.  Every container is populated with the #1.  You are 
basically printing each container entry in the array.  If you are 
looking for a total of all containers in the @total array you need to 
add them together in the array.  You will need to add them to a scalar 
variable or a particular container (total[5] perhaps?).  Here is what I 
did.  Warning.. not a clean bit of code but it get's the idea across.. I 
think:

#!/usr/bin/perl

@array1[0..5] = 1;
@total[0] = 0;
for($i=0; $i<4; $i++)
{
if($i == 0)
{
 @total[$i] = @array1[$i];
   print "First group";
 print @total[$i];
   $total = $total + @total[$i];
   print "\n";
   print $total;
}
else
{
 $j = $i - 1;
   print "Second group";
 @total[$i] = @total[$j] + @array1[$i];
   $total = $total + @total[$i];
 print @total[$i];
   print "\n";
   print $total;
}
}
So now you see on the left the sum of each container in the array. 

Ok.. I away the flogging.  Someone is bound to have done a better job 
explaining this.  At least I can blame it on being up after midnight ;-)

Speaking of which... MERRY CHRISTMAS TO ALL!!!

Night.

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



Re: Perl Help: Array Manipulation

2003-12-25 Thread u235sentinel
But wouldn't the original initilization also work?

@array1[0..5] = 1;

This seemed to populate the array just fine. 

Randy W. Sims wrote:

On 12/25/2003 2:51 AM, Duong Nguyen wrote:

  From: Randy W. Sims 
 >

  On 12/25/2003 12:59 AM, Duong Nguyen wrote:
  > Hello everyone,
  >   > Sorry for the spam, I am new to Perl and am having a hard 
time manipulating arrays.  Below is the sample code that I am working 
on:
  >   > @array1[0..5] = 1;
  > @total[0] = 0;
  >   > for($i=0; $i<4; $i++)
  > {
  >  if($i == 0)
  >  {
  >   @total[$i] = @array1[$i];
  >   print @total[$i];
  >  }
  >  else
  >  {
  >   $j = $i - 1;
  >   @total[$i] = @total[$j] + @array1[$i];
  >   print @total[$i];
  >  }
  >  }
  >   > This code would work in C/C++, but with Perl, instead of 
adding up the previous values, the array "Total" seems to treat the 
integer value as a string and join them together.  So instead of 
ending up with 4 as my resulting total, I instead get .  I know 
this is a rather dumb question, but any help would be GREATLY 
appreciated.  Thanks in advance.

  hint #1: Add the following to the beginning of your program

  use strict;
  use warnings;
  hint #2: Do you know the difference between '@total[$i]' and 
'$total[$i]' ?

>
> Every time I use "strict" my program goes all crazy on me with the 
global and local variables.  So instead, I just comment that out.

That craziness suggests opportunities to learn. It really is easier to 
debug when you get in the habit of using those pragmas. It prevents a 
lot of headache.

> The difference between '@total[$i]' and "@total[$i]" is that with 
the single quote, what u have there is what gets printed out.  With 
double quote, the element of the array gets printed out.

No, look at the first character '@total[0]' vs '$total[0]' (@ vs $).
The first refers to an array (slice) with one element. The second 
refers to one element of an array.

BTW, wrt your other reply to the group, the initialization syntax you 
want is:

@array[0..5] = (1) x 6;

Regards,
Randy.




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



Re: Perl Help: Array Manipulation

2003-12-25 Thread u235sentinel
Understood.  I guess I was trying to show him ( the senec route) that 
basically no running total was being compiled.  Also that  wasn't  
the total.  I guess it was too late at night for a simple response from 
me :-)

Charles K. Clarkson wrote:

u235sentinel <[EMAIL PROTECTED]> wrote:
[snipped valiant attempt]
: 
: So now you see on the left the sum of each container in the array. 
: 
: Ok.. I await the flogging.  Someone is bound to have done a better job 
: explaining this.  At least I can blame it on being up after 
: midnight ;-)

   Test your solution with:

@array1[0..5] = ( 1, 4, -200, 8, 15, 0 );



HTH,

Charles K. Clarkson
 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Perl Help: Array Manipulation

2003-12-25 Thread u235sentinel
Ahhh.. Ok.  I see the mistake.  I've purchased Oreilly's "Learning Perl" 
3rd Edition and have been steadily plugging through it.  There is an 
example on page 45 which shows another way to populate an array.  Here 
is one such example they give.

@numbers = 1..1e5;

So basically if you didn't want to use  =(1) x 6 you could do it this way.

I had confused where the .. goes :-)

thx for the clarify



Randy W. Sims wrote:

On 12/25/2003 12:18 PM, u235sentinel wrote:

But wouldn't the original initilization also work?

@array1[0..5] = 1;


No. Think of this in terms of parallel assignment, ignoring for the 
moment that we are talking of arrays, the above is equivalent to:

($e0, $e1, $e2, $e3, $e4, $e5) = 1;

which is equivalent to:

($e0, $e1, $e2, $e3, $e4, $e5) = (1);

because the list on the left-hand side of the assignment operator 
('='), puts the right-hand side in list context. This is then filled 
in by perl to become:

($e0, $e1, $e2, $e3, $e4, $e5) = (1, undef, undef, undef, undef, undef);

because the list on the right-hand side must have the same number of 
elements as the list on the left-hand side.

The common idiom to populate an array with a particular value is to 
use the times operator ('x') which reproduces its left-hand argument 
the number of times specified by its right-hand argument:

($e0, $e1, $e2, $e3, $e4, $e5) = (1) x 6;

which is equivelent to:

($e0, $e1, $e2, $e3, $e4, $e5) = ((1), (1), (1), (1), (1), (1));

which then gets flatened to:

($e0, $e1, $e2, $e3, $e4, $e5) = (1, 1, 1, 1, 1, 1);

With an array slice, perl basically turns the original:

@array1[0..5] = 1;

into something like:

($array1[0], $array1[1], $array1[2], $array1[3], $array1[4], 
$array1[5])  = (1, undef, undef, undef, undef, undef);

in the same manner as the first example above.

Regards,
Randy.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Using perl to parse specific lines by date...

2003-12-26 Thread u235sentinel
While I've already done this with a simple shell script using grep, I 
was trying to figure out how I can do the same thing in perl.

I have an access_log  from my apache web server and while I can manually 
enter a date for my pattern match (which works fine), I can't seem to 
get it automated properly.  I suspect the $date variable may be passing 
`date +%d/%b` instead of  26/Dec to the pattern matching if statement. 

FYI...  when I run the program I pass the name of the file I want parsed 
( example:   code.pl access_log )

Any thoughts on my mistake?

Thx

-

Script I'm using.

#!/usr/bin/perl

 $date=`date +%d/%b`;
 print "\n";
 print "Current search pattern is $date";
 print "\nStarting parse routine...\n\n";
 while (<>) {
   if (m|$date|) {
 print $_;
  } else {
 #  print "No match.\n";
  }
}


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



Re: Using perl to parse specific lines by date...

2003-12-26 Thread u235sentinel
Are these date functions of perl part of the normal distribution or a 
CPAN module?

   if (m|\Q$date\U|)


This didn't seem to make a difference.

I noticed a couple of commands that may help.  System and exec.  
Apparently they were further in the Learning Perl book (I cheated.. 
flipped ahead ::grinz::)

If there is a perl function that will populate a variable with today's 
date please let me know.  I'll try the system/exec commands and cross my 
fingers :D

Thx

Randy W. Sims wrote:

On 12/26/2003 5:39 PM, u235sentinel wrote:

While I've already done this with a simple shell script using grep, I 
was trying to figure out how I can do the same thing in perl.

I have an access_log  from my apache web server and while I can 
manually enter a date for my pattern match (which works fine), I 
can't seem to get it automated properly.  I suspect the $date 
variable may be passing `date +%d/%b` instead of  26/Dec to the 
pattern matching if statement.
FYI...  when I run the program I pass the name of the file I want 
parsed ( example:   code.pl access_log )

Any thoughts on my mistake?

Thx

-

Script I'm using.

#!/usr/bin/perl

 $date=`date +%d/%b`;


You could use perl's date functions for this.

 print "\n";
 print "Current search pattern is $date";
 print "\nStarting parse routine...\n\n";
 while (<>) {
   if (m|$date|) {


Any time you get a string you want to match from an external source, 
you should probably quote it:

   if (m|\Q$date\U|) {


 print $_;
  } else {
 #  print "No match.\n";
  }
}







--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Using perl to parse specific lines by date...

2003-12-26 Thread u235sentinel
Thx to everyone on this.  I chucked the system date function I 
originally wrote and used strftime and localtime. Guess I haven't read 
that part of the perl book yet ;-)

So when I wrote the program originally, was it populating $date 
incorrectly?  I'm hoping to understand why it didn't work in the first 
place. 

FYI... %e would have blank padded what I was looking for.  The access 
logs in apache have the / between the month and day.  The error logs 
however would have worked with %e since they space out the month& day.

Thx again!!



John W. Krahn wrote:

U235sentinel wrote:
 

While I've already done this with a simple shell script using grep, I
was trying to figure out how I can do the same thing in perl.
I have an access_log  from my apache web server and while I can manually
enter a date for my pattern match (which works fine), I can't seem to
get it automated properly.  I suspect the $date variable may be passing
`date +%d/%b` instead of  26/Dec to the pattern matching if statement.
FYI...  when I run the program I pass the name of the file I want parsed
( example:   code.pl access_log )
Any thoughts on my mistake?

Thx

-

Script I'm using.

#!/usr/bin/perl
   

use warnings;
use strict;
 

 $date=`date +%d/%b`;
   

There is no need to run an external program to get the date:

my @mons = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
my $date = sprintf '%02d/%s', (localtime)[3], $mons[ (localtime)[4] ];
Or:

use POSIX 'strftime';
my $date = strftime '%d/%b', localtime;
 

 print "\n";
 print "Current search pattern is $date";
 print "\nStarting parse routine...\n\n";
 while (<>) {
   if (m|$date|) {
   

This should work.  Are you sure that the day of the month format is %d
and not %e?
 

 print $_;
  } else {
 #  print "No match.\n";
  }
}
   



John
 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: Using perl to parse specific lines by date...

2003-12-26 Thread u235sentinel
26/Dec

FYI.. playing with it a bit.  I discovered there must be a carriage 
return (new line) after the line processes.  I changed my original code 
to do this

chomp(my $date = `date +%d/%b`);

This fixed the problem.  hehehe... I should have thought of this.  Oh 
well.. not bad after a few weeks of perl coding

So now I've learned a few new ways to pull stuff into perl. 

Thx guys!



R. Joseph Newton wrote:

u235sentinel wrote:

 

While I've already done this with a simple shell script using grep, I
was trying to figure out how I can do the same thing in perl.
I have an access_log  from my apache web server and while I can manually
enter a date for my pattern match (which works fine), I can't seem to
get it automated properly.  I suspect the $date variable may be passing
`date +%d/%b` instead of  26/Dec to the pattern matching if statement.
FYI...  when I run the program I pass the name of the file I want parsed
( example:   code.pl access_log )
Any thoughts on my mistake?

Thx

-

Script I'm using.

#!/usr/bin/perl

 $date=`date +%d/%b`;
   

Since you have a question about what the $date variable contains, here would
be an excellent place to:
print "I see the date as $date\n";
Let us know what prints.

Joseph

 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Re: stop

2004-01-07 Thread u235sentinel
After being part of this list for a month, I don't recall seeing more than just this 
email requesting removal from the list.  

Oh well.  An amusing message.  I see them all the time in the Linux mail lists I 
participate in. Pity people can't follow directions :-)

> Uhhh...at the bottom of every list message is:
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
> 
> 
> 
> -Dan
> 
> 
> -- 
> 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]
 




Oreilly's "Learning Perl 3rd Edition"

2004-01-13 Thread u235sentinel
I'm nearly finished with this book (definitely excellent book!).  Some items I need to 
review again (expressions will take some work).  Afterwards I plan on moving upward 
and onward in perl.  I'm curious if Oreilly's "Programming Perl" or "Perl Cookbook" 
would be good to jump into.  Or is there another book I should study?

Thanks!

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




Re: Sending mails

2004-02-06 Thread u235sentinel
I'm still learning myself and haven't tried sending email's from perl scripts (yet).  
I did however notice one typo which might help you grab more info on what's going on.

Check the below in your code.  Change 'use warnigs' to 'use warnings'

Hopefully it will help give you a bit more to go on. 

> #!/usr/bin/perl
> use warnigs;
> use strict;
> use MIME::Lite;
> use CGI 'param';
> I tried using this code but it's giving error.
> Can you explain in details pls as this is my first perl script & don't know 
> much of programming.
> 
> Thanks
> Nilanjana
> ---
> 
> 
> > On Wed, 4 Feb 2004 14:07:43 +0530, [EMAIL PROTECTED] (Nilanjana
> > Bhattacharya) wrote:
> > 
> > >Hello everybody,
> > >
> > >I have two radio buttons in a form. I want - When any one clicks on
> button "A" 
> > >a mail will be sent to "A" & when any one clicks on button "B" mail will
> be 
> > >sent to button "B". In both the cases whether someone clicks on A or B I
> will 
> > >receive a mail. Can anyone help me with the coding pls? 
> > 
> > Well here is some untested code which will give you a start.
> > 
> > #!/usr/bin/perl
> > use warnigs;
> > use strict;
> > use MIME::Lite;
> > use CGI 'param';
> > 
> > # Assign variables to arguments
> > # you need your html form to send these
> > my $a =  param{'button_a_address'} || undef;
> > my $b = param{'button_b_address'} || undef;
> > 
> > my $me = '[EMAIL PROTECTED]';
> > my $addr;
> > 
> > if(defined $a){$addr = $a}else{$addr = $b}
> > 
> > my $msg = MIME::Lite->new(
> > >From =>'[EMAIL PROTECTED]',
> > To   =>$addr,
> > Bcc  =>$me,
> > Subject  =>'test message',
> > Type =>'TEXT',
> > Data =>'This is a test',
> > );
> > $msg->attach(Type =>'application/octet-stream',
> > Encoding =>'base64',
> > Path =>'test.zip',
> > );
> > $msg->send;
> > 
> > # Print HTML Out
> > print "Content-type: text/html\n\n";
> > print <<"END";
> > 
> > 
> > Mail Sent!!
> > 
> > 
> > 
> > The file has been successfully sent to
> > print $addr;
> > 
> > 
> > 
> > **END**
> > __END__

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




Re: [OT] Re: Script Kiddie issues

2004-02-07 Thread u235sentinel
I've been holding off on responding to this thread but now

I've dealth with security for some time on Unix/Linux systems.  Some of 
my favorite products certainly have the ability to perform a counter 
attack however the author of those products always warn the user NOT to 
taunt happy fun ball. :-)

You will only annoy the attacker (presuming it's not a zombie) and you 
will become a target.  Just a warning.



Daniel Staal wrote:

--As off Saturday, February 7, 2004 12:37 PM -0500, Wiggins d'Anconia 
is alleged to have said:

What is to stop a spammer or script kiddie finding out about your
ruse, possibly even listening in on the conversation, and rather
than trying to hack your system starts sending out mass emails to
people with a URL in it that directs them to your system and that
URL, all of a sudden your victims become his victims and he has
used you in a scheme to haunt the very users you wished to defend.


--As for the rest, it is mine.

Or, the more likely scenario: Launching his attack from a compromised 
computer in the first place.  (That is, the first attempt to contact 
you is from some poor computer that the script kiddie has already 
compromised.  Not their own computer.  Not even someone who knows they 
are running the script kiddie's software.)

After all, that is the normal way they work...

Daniel T. Staal

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


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



Re: Script Kiddie issues

2004-02-09 Thread u235sentinel
Unfortunately this attitude is not solely American.  We've been around for only 200 
years and these problems seem to come from much MUCH further in the past from a 
variety of countries.

Now back to the reason we are really here.  Perl anyone ::grinz::
> Lone Wolf wrote:
> 
> > Nah, because the only ones who receive the file are those attempting to
> > do harm to my system.  Granted I could make it go to a warning page,
> > which after a few seconds dumps them to the other page, thereby giving
> > them a warning before I fire the shot, just like a trespasser in my
> > house.  Do I shoot first when they are in MY house in the middle of the
> > night, or do I give them enough time to shoot me?  They are trespassing
> > on my system.  Normal use of the system does NOT require access to
> > cmd.exe or other files they are looking for to use to exploit the
> > system.  Normal use laws apply, and you CAN and folks DO take steps to
> > secure their system from others.
> > 
> > Legally I checked with lawyers and the ones in my area say as long as I
> > keep a log of the accesses I am fine.  I took this step after sending
> > over 200 messages to ISPs to halt their users and receiving no response
> > to any of the inquiries even though I provided the ISPs with log files
> > and everything.  I did the same with ISPs with spammers and open relays.
> > Multiple emails to their main offices and local branches with the
> > spammers email addresses, full headers, and no word back.  If the ISP
> > was not even willing to answer multiple emails they were sent another
> > email with how to contact me directly and then their entire domain was
> > added to the server kill file.  Cut down on the spam in MY inbox.
> > 
> > 
> > -Original Message-
> > From: Michael C. Davis [mailto:[EMAIL PROTECTED] 
> > Sent: Saturday, February 07, 2004 8:30 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Script Kiddie issues
> > 
> > 
> > What a great idea.  You'll make lots of new friends in the Big House.
> > 
> > 
> 
> 
> American attitude will destroy the world. thank you.
> If your system is stable, (nearly) no one can harm you.
> stop beeing paranoid. attack and destruction are as always the best 
> solutions.
> regards
> 
> Eternius
> 
> 
> -- 
> 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: switch statement

2004-02-19 Thread u235sentinel
In addition, I've been playing around with the 'use diagnostics' feature in perl.  
That's in addition to 'use warnings'.  I don't recommend it for regular coding but 
when stumped it may help.



> On Feb 19, 2004, at 3:14 PM, Anthony Vanelverdinghe wrote:
> 
> > Hi
> 
> Howdy.
> 
> > Could anyone please tell me what's wrong with the following "program"?
> 
> I'll try.
> 
> > The compiler gives errors in the switch statement.
> 
> Perl doesn't have a native switch statement, but it is included as a 
> module in 5.8+
> 
> > Thx!!
> >  Anthony
> 
> First, things missing are right here:
> 
> #!/usr/bin/perl
> 
> use strict;   # play by the good coder rules
> use warnings; # helps us help you
> 
> use Switch;   # request the switch module
> 
> > %commands=('v',0,'w',1,'t',2,'/pattern/',3,'s',4,'x',5);
> 
> Then you'll need:
> 
> my %commands = ('v',0,'w',1,'t',2,'/pattern/',3,'s',4,'x',5); # to 
> satisfy 'strict'
> 
> > $end = 0;
> 
> my $end = 0;
> 
> > while (!end){
> 
> I believe that's supposed to be:
> 
> while ( ! $end ) {# note $
> 
> > print "bookmarks.html>";
> > $operation = <>;
> > chop $operation;
> 
> Don't use chop(), use chomp().  You can even do it in one line, 
> replacing the two above with:
> 
> chomp(my $operation = <>);
> 

> > $op=$commands{$operation};
> > switch ($op) {
> 
> switch ($commands{$operation) {
> 
> >case 0 {
> >&add ();
> 
> Don't call subs like that.  Just use:
> 
> add();
> 
> >last;}
> >case 1 {
> >&delete();
> >last;}
> >case 2 {
> >&show();
> >last;}
> >case 3 {
> >&pattern();
> >last;}
> >case 4 {
> >&save();
> >last;}
> >case 5 {
> >&exit ();
> >last;}
> > }
> > }
> >
> >
> >
> >
> > sub add{
> >print "add";
> > }
> >
> > sub delete{
> >print "delete";
> > }
> >
> > sub show{
> >print "show";
> > }
> >
> > sub pattern{
> >print "pattern";
> > }
> >
> > sub save{
> >print "save";
> > }
> >
> > sub exit{
> >$end = 1;
> > }
> 
> See if that gets you going.
> 
> 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]
 




Module to pull Netstat summary information?

2004-02-26 Thread u235sentinel
Is there a CPAN module to pull netstat summary information from a system?

Rather than run 'netstat -s', I was hoping to find some way within perl.

What I basically want to do is generate a couple of reports from the summary output.  
ICMP and TCP information.  If someone can point me in the right direction I should be 
good to go :-)

Thanks

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




Re: Module to pull Netstat summary information?

2004-02-26 Thread u235sentinel
This works however I was hoping perl had a module so I didn't have to run a system 
application.  I've been playing around with modules such as scp, telnet and ftp.  I'm 
curious if there is one for netstat.

thanks :-)
> I am still new to working with Perl myself but I think I know the anwer 
> to this one...
> 
> #!/bin/perl
> 
> use strict;
> use warnings;
> 
> my $cmd = system('netstat -s')or die "Could not run command: $1";
> my $cmd = system('netstat -a | grep tcp')or die "Could not run command: $1";
> 
> HTH
> Jas
> 
> [EMAIL PROTECTED] wrote:
> 
> > Is there a CPAN module to pull netstat summary information from a system?
> > 
> > Rather than run 'netstat -s', I was hoping to find some way within perl.
> > 
> > What I basically want to do is generate a couple of reports from the summary 
> output.  ICMP and TCP information.  If someone can point me in the right 
> direction I should be good to go :-)
> > 
> > Thanks
> 
> 
> -- 
> 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: Question regarding Perl on RH9

2004-03-11 Thread u235sentinel
Perhaps you can post the code so we can look at it?

Or even a link where we can get it.  I'm not familiar with that tool.  

Thx
> Not really a perl programmer but have used the perl utility "mirror" for
> a good number of years now. The problem I have is that mirror worked on
> RH8 but does not on RH9. Both releases have perl v5.8.0. On RH9 mirror
> stops with:
> 
> [EMAIL PROTECTED] mirror]# ./mirror -d packages/all
> unknown input in "./mirror.defaults" line 10 of: package=defaults
> unknown keyword in "./mirror.defaults" line 10 of:
> [EMAIL PROTECTED] mirror]#
> 
> Anybody come across this problem?
> 
> Thanks,
> 
> L. Baker
> 
> 
> 
> -- 
> 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: Folder Clean-up

2004-03-15 Thread u235sentinel
I know this doesn't fully answer you question but I'm wondering, do you mean files 
that your users haven't accessed in 30 days?  What if they are using it like once a 
week?

I'm reading through the "Learning Perl 3rd Edition" and on page 159 there are a number 
of file tests available.  If your users are accessing a file regularly (with in the 30 
days lets say) then I would recommend using the -A option when testing the file(s).  
It checks access age measured in days.

If you simply want to remove the files regardless of whether they are accessed 
regularly or not, perhaps the module File::Basename will meet your needs.  Just a 
thought
> Hi,
> 
> I've /share_folder with many user folders.
> 
> e.g.,
> 
> /share_folder/user_a
> /share_folder/user_b
> ...
> 
> I would like to scan all user folders for files that are older than 30 
> days and delete them. Is this doable with Perl?
> 
> Regards,
> Norman
> 
> 
> -- 
> 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: Folder Clean-up

2004-03-15 Thread u235sentinel
Not the prettiest way but here is how I check if File::Find is installed:

 perldoc -X File::Find


Like I said, it's not pretty.  I figure there wouldn't be a doc on the machine if the 
module wasn't there.  Bad presumtion I know.  Still, maybe someone can help educate 
us.  I'm a sorta perl-newbie now (yes.. I can be taught!)


> > 
> > Sorry. I'm a super-newbie. How do I check if File:Find is installed on
> > my Linux box?
> > 
>   No problem. I am used to Windows and ActiveState. I just go the doc on 
> Perl for ActiveState.  File::Find will be on your Perl setup. It will come as 
> part of the standard(core) load. You will need someone who has Linux/Unix 
> background to tell you how to find the doc.  I see you have another reply 
> already from someone with a Linux background, so will stop here. 
> 
>   Anything else, please let me know.
> 
> Wags ;)
> > Regards,
> > Norman
> 
> 
> 
>   Any questions and/or problems, please let me know.
> 
>   Thanks.
> 
> Wags ;)
> Int: 9-8-002-2224
> Ext: 408-323-4225x2224
> 
> 
> 
> **
> This message contains information that is confidential
> and proprietary to FedEx Freight or its affiliates.
> It is intended only for the recipient named and for
> the express purpose(s) described therein.
> Any other use is prohibited.
> 
> 
> 
> -- 
> 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: Find User Apache is running as

2004-03-28 Thread u235sentinel
I'm wondering if there is a perl module to read from the apache server 
status screen.  Doesn't it tell you the server version running?

Also, when you connect to a web server, doesn't it pass along this 
information also?

Been awhile since I've worked with web servers (I'm still a perl noob 
btw).  Maybe connect with a perl module to the server (localhost) then 
parse that info. 

Just a thought



JupiterHost.Net wrote:

Thank you Gaffney and Jones for your input.

I may have to parse external program output I suppose. I was hoping 
there would be a more built in or Modular way to get it. Part of the 
problem is foo.pl can be run simultaneously by 2 different users so 
I'm not sure how I'd be able to make foo.pl tell which ps it belongs to.

I suppose I can use the process Id in $$ in the parseing of ps output.

I was hoping for a builtin variable or module that would tell me :)

Any other ways besides parsing external program output?

TIA

Lee.M - JupiterHost.Net



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



Re: using strict

2004-04-01 Thread u235sentinel
Does the following turn off strict for a vars?

no strict "vars";

Could you also turn off strict for other things besides vars, refs and subs?  Say for 
a subroutine (for example).

Just curious.  I've run into situations where I've come across badly maintained code 
and would like to do this for pieces instead of the whole deal.

Thx
> On 4/1/2004 5:01 PM, [EMAIL PROTECTED] wrote:
> 
> > People of the Perl, 
> > 
> > from my understanding strict disallows soft references, ensures that all 
> > variables are declared before usage and disallows barewords except for 
> > subroutines.
> > 
> > what is a soft reference?
> > what is a bareword?
> > why is strict disallowing a compile here When I comment out strict the 
> > syntax checks outs as ok!???
> 
> perldoc strict
> 
> answers all of the above questions. Those below have already been answered.
> 
> > how do I display each element # with its corresponding data line, b/c I 
> > only want certain elements printed out?
> > 
> > thank you!
> > 
> > # Set pragma
> > 
> > use strict;
> > 
> > &tsm_critical_servers;
> > 
> > # Declare sub
> > 
> > sub tsm_critical_servers {
> > 
> > my $crout="/tmp/critical_servers.out";
> > 
> > # Make system call for data gathering 
> > 
> > system ("dsmadmc -id=menu -password=xx 'q event * * 
> > begind=-1 begint=15:30 endd=today endtime=now' > $crout");
> >  

> > # Create array and read in each line as a seperate element
> >  
> > open (CRITICALSERVERS, "$crout") || die "can't open file \n: $!";
> > while ( defined($line = ) ) {
> > chomp ($line);
> > my @tsm = ;
> > foreach $_ (@tsm) {
> > print $_;
> > }
> > }
> > close (CRITICALSERVERS);
> > }
> > 
> > 
> > Derek B. Smith
> > OhioHealth IT
> > UNIX / TSM / EDM Teams
> > 
> > 
> 
> 
> 
> -- 
> 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: book suggestion for atypical beginner

2004-04-07 Thread u235sentinel
I started with the "Learning Perl 3rd Edition" and have moved to "Perl Object, 
References and Modules" both published by Oreilly.  Been working with Perl code for a 
few months now. I also have purchased the "Perl Cookbook".  There are many great 
examples how to do something useful. Great books!  Recently I joined the 
"perlmonks.org".  I highly recommend them.  Great place to ask questions and learn 
from other's.  They also have code snippets to help push you along.

I've worked with C and C++ but never really got into it.  I had few real world 
situations in which I needed to code as a Unix SA making it difficult to break into 
coding.  Perl OTOH has much to offer including tons of modules for the average 
Unix/Windows SA.  This helped me keep up my interest in coding and push forward.

/me thx Larry for a great language!


>   I got the Camel book "Programming Perl" and immediately starting
> solving problems with Perl.  I subscribed to this list, and I googled a
> lot.  Now I think I'm *barely* an intermediate Perl programmer, but with
> a little experience under my belt, the PerlMonks site is really helpful.
> 
>   So I suggest getting Programming Perl-- because you'll need it
> eventually anyway.  If you find that it's too heavy, get Learning Perl
> or one of the more basic books as Plan B.  
>   Have fun...
> -Chris   

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




Re: New to perl ...

2004-04-13 Thread u235sentinel
What have you tried?  Please post the code so we can help



Bajaria, Praful wrote:

Hello,

I would like to swap the file name only and not the extension or the
content. 

Example:
There are two file : 1.jpg and 3.jpg 
output = 1.jpg becomes 3.jpg and 3.jpg becomes 1.jpg

OR

1.jpg and 3.gif
output  = 1.jpg becomes 3.jpg and 3.gif becomes 1.gif
here we are changing the name only and not the extension.
Inside my program I don't know either files extension, but they will be only
"jpg or gif"
Any help...

 



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



Re: b in regexp..

2004-04-14 Thread u235sentinel
If I'm reading this correctly, you are trying to match a word at the end of a string.  
If that's the case then move the word boundary to the end of your match.

print $& ."\n" if (/eat\b/);
print $& ."\n" if (/gre\b/);

Reading from the "Learning Perl 3rd" Edition on page 108:

"The \b anchor matches at the start or end of a group of \w characters".

\b at the beginning of the word will match only the beginning and no ending characters.

If you are looking for more then perhaps a nonword-boundary anchor is what you are 
looking for?

>From Page 109 it reads:

"The nonword-boundary anchor is \B; it matches at any point where \b would not match.  
/\bsearch\B/ will match searches but not researching".

Hope this helps.

> friends,
> 
> script :
> 
> $_='as great as perl';
> print $& ."\n" if (/\beat/);
> print $& ."\n" if (/\bgre/);
> 
> output :
> gre
> ***
> Why 'boundary' assertion does not match in end of word , but only the start of 
> word?
> 
> thanks,
> Jay
> 
> -- 
> 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: s/// w/o RE

2004-04-14 Thread u235sentinel
Wouldn't it be this instead?

substr $_, index($_, $ss), length($ss) = $rs;


I was looking up substr and didn't see a fourth parameter.  Didn't have a chance to 
try it either :-)

Thx
> On Apr 14, 2004, at 2:06 AM, Bryan Harris wrote:
> 
> >
> > A quick question for the wizards--
> 
> Will I do?
> 
> > Is it possible to do a substitution without compiling the pattern at 
> > all?
> 
> Sure.
> 
> > **
> > #!/usr/bin/perl
> >
> > $ss = "cool???";
> > $rs = "cool.";
> > $_ = "Perl is really cool???";
> > s/$ss/$rs/g;
> 
> The above line could also be written:
> 
> substr $_, index($_, $ss), length($ss), $rs;
> 
> > print "$_\n";
> > **
> 
> 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: s/// w/o RE

2004-04-14 Thread u235sentinel
> > That won't work.  Because of precedence it evaluates to:
> >
> > substr $_, index($_, $ss), ( length($ss) = $rs );

Ok.  I get it now.  Didn't realize I was doing that :D

> perldoc -f substr

I was looking it up in the "Learning Perl 3rd" edition.  

/me slaps Oreilly

Still a great book.  Should have checked perldoc.  At this rate I won't be a Perl Noob 
for long ;-)  Learned something new today!


BTW, is the above what you guys call "bottom posting"?

Thx

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




Re: Size checking?

2004-04-15 Thread u235sentinel
> I am not sure HOW to do the file size check.

(untested)
if -s $filename > 100 then print "$filename greater than 100 bytes!";

Something like this perhaps?  


If you also need the actual size then perhaps this will work (again untested)

my $size_in_k = (-s) / 1000;
print "$_ is $size_in_k Kbytes";

Just a thought.

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




Re: Perl vs PHP

2004-04-22 Thread u235sentinel
hehehe... You might be surprised.

While IANACY (I an not a coder... yet!), I have dabbled with other 
languages.  The last 6+ months I've been studying Perl programming 
intending to push into coding.  I've seen code in other languages (C for 
example) and much of it looks very similar to Perl.  If I didn't look 
closer I would have mistakenly said it was Perl code ::grinz::

Even though languages are very different in what they can do, they have 
many similarities.



Jan Eden wrote:

Ron B wrote on 22.04.2004:

 

Why would one prefer Pepsi over Coke, or vice versa? :) That's the
answer to your question.
[EMAIL PROTECTED] wrote:
   

Why would one prefer PHP over PERL, or vice, versa?  I'm guessing
PERL has more functionaltiy and is more robust.  What are the
technical arguments for one over the other? JP
 

This implies that programming/scripting languages differ not more than softdrinks. Interesting. So by knowing (a little) Perl, I can program also Fortran and Cobol! I never knew that. Thanks Ron! ;)

Jan
 



Re: hour -1 routine

2004-05-28 Thread u235sentinel
What have you tried so far?  Perhaps we can help tweak the code.

Anthony J Segelhorst wrote:
I am trying to set up a script that will do the do a current time -1 
routine.

Examples:
Current Time:
mmddyy:hhss
052804:1030
Output:
052804:0930
Current Time:
052704:0015
Output:
052604:23:15
I think the add_delta module is where I need to go, but I have never used 
modules before. 

Anthony J Segelhorst
Enterprise Systems Management Team
Phone: 937-495-1876
Email: [EMAIL PROTECTED]

This email has been scanned for all viruses by the MessageLabs SkyScan
service.___
This electronic message contains information from MeadWestvaco
Corporation or subsidiary companies, which may be confidential,
privileged or otherwise protected from disclosure.  The
information is intended to be used solely by the recipient(s)
named.  If you are not an intended recipient, be aware that
any review, disclosure, copying, distribution or use of this
transmission or its contents is prohibited.  If you have
received this transmission in error, please notify MeadWestvaco
immediately at [EMAIL PROTECTED]
___
 


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



Re: Glossary

2004-06-08 Thread u235sentinel
I agree.  Also "Perl for Dummies" might help a bit.  In the back there is a list of 
major commands typically used in Perl.  The book was ok.  "Learning Perl 3rd Edition" 
by Oreilly was better IMO.



> Karen,
> 
> I realize I am not answering your question directly but may I suggest
> that you purchase a copy of 'Learning Perl' by Randal Schwartz & Tom
> Phoenix.
> 
> It is an excellent introduction to Perl. You may find it easier than
> going through the man pages.
> 
> Cheers,
> Levon Barker
> 
> 
> On Tue, 2004-06-08 at 15:36, Karen McAtamney wrote:
> > I'm in the process of learning perl (hmm - right at the beginning of this
> > process), and I'm having great difficulty working my way through the man
> > pages. I'm a Windows user and perl is the first language I'm learning, so
> > *everything* is new to me. I am also having to get to grips with using my
> > shell account which is just adding to the difficulties.
> > 
> > What would really make my life easier right now is a glossary of programming
> > specific terms so that I'm not struggling to find meanings for the
> > terminology used in some of the man pages (specifically I'm trying to work
> > my way through man screen) every other word. Does such a glossary exist? I'm
> > aware of the Jargon Files and I'm aware that many of these terms have man
> > pages of their own (but my entire reason for reading man screen is to learn
> > how to have different windows open with different things going on in each
> > window!).
> > 
> > Thank you for all your help,
> > 
> > Karen
> > 
> 
> -- 
> 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: Glossary

2004-06-08 Thread u235sentinel
Understood however I thought you were also lookinig for a glossary of Perl commands.  
The "Perl for Dummies" book has such a list in the back.  "Learning Perl" doesn't have 
a list.  Still... it's currently my favorite Perl book :D


> From: [EMAIL PROTECTED]:
> > I agree.  Also "Perl for Dummies" might help a bit.  In the back there is
> a list of >major commands typically used in Perl.  The book was ok.
> "Learning Perl 3rd >Edition" by Oreilly was better IMO.
> 
> I've already got a copy of Learning Perl, and I've made it few the first
> couple of chapters without too much grief, but it doesn't help with this
> particular problem:-(
> 
> Karen
> 

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




Re: How to call a perl script....

2004-06-25 Thread u235sentinel
Beau E. Cox wrote:
On Thursday 24 June 2004 08:32 pm, Charlene Gentle wrote:
 

You can use the 'system' command:
##--master--
...
my $rc = system "perl slave.pl";
...
 

Does this mean it runs in parallel with the parent Perl Program?  
Reading through "Learning Perl 3rd Edition" and I thought I caught a 
reference to something like this.

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



Re: 'system' and parallel execution (was: Re: How to call a perl script....)

2004-06-25 Thread u235sentinel

Wiggins d Anconia wrote:
Not exactly, it has been forked and does technically run in parallel,
however 'system' blocks your current process waiting for the child to
finish, so your process is in fact running, but it won't be doing any
work except for waiting for a signal from the child.
There are other ways to have parallel execution,
perldoc perlipc
perldoc -f fork
perldoc -f system
Ok.  I'll read those in a minute.  After reviewing Learning Perl, I 
realize I need to open the process as a file handle for parallel 
operations.  Called a "piped open". (page 201 Oreilly Learning Perl).

Will get you started. "Network Programming with Perl" by Lincoln Stein
also has excellent chapters on this subject, though lacks a chapter
(probably because of its age) on POE.
 

Haven't purchased that book yet (it's on my amazon wish list however).  
I'll check it out.

Thanks!


Re: 'system' and parallel execution (was: Re: How to call a perl script....)

2004-06-25 Thread u235sentinel
Exec will shell out and run whatever exec called.  At least I believe 
the correct term is "shell out".  Learning Perl says in page 196 that 
exec  locates the program you called and jumps to it.  There is no perl 
process anymore.  So I guess it's more of an exit Perl and run this 
command sort of thing..  So once you do that, Perl is gone.  System 
however returns you back to Perl.  If you want Perl not to wait you can 
open a process as a file handle.  I haven't tried it however it suggests 
this will run Perl and your process in parallel.

Something to try

[EMAIL PROTECTED] wrote:
from what I remember reading and was told as a best practice using exec 
/...// was recommended over system.  For this reason exec does not 
create a child and therefore does not have to wait.  the perl process 
itself runs the command or program.  what are the pros and cons of each?

thanks
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams


u235sentinel <[EMAIL PROTECTED]>
06/25/2004 11:58 AM
   To: 
   cc: [EMAIL PROTECTED]
   Subject:Re: 'system' and parallel execution (was: Re: How to call a perl 
script)


Wiggins d Anconia wrote:
 

Not exactly, it has been forked and does technically run in parallel,
however 'system' blocks your current process waiting for the child to
finish, so your process is in fact running, but it won't be doing any
work except for waiting for a signal from the child.
There are other ways to have parallel execution,
perldoc perlipc
perldoc -f fork
perldoc -f system
   

Ok.  I'll read those in a minute.  After reviewing Learning Perl, I 
realize I need to open the process as a file handle for parallel 
operations.  Called a "piped open". (page 201 Oreilly Learning Perl).

 

Will get you started. "Network Programming with Perl" by Lincoln Stein
also has excellent chapters on this subject, though lacks a chapter
(probably because of its age) on POE.
   

Haven't purchased that book yet (it's on my amazon wish list however). 
I'll check it out.

Thanks!

 



Re: 'system' and parallel execution (was: Re: How to call a perl script....)

2004-06-25 Thread u235sentinel
Wiggins d Anconia wrote:
perldoc -f exec
Ok.  makes sense. 

*** Since it's a common mistake to use "exec" instead
  of "system", Perl warns you if there is a following­
  statement which isn't "die", "warn", or "exit"***
I've pretty much decided it's either system or a filehande process for 
me.  I don't see myself using exec too often :-)

Yes, alternatively you can use fork+exec to have a forked process that
is non-blocking, the reason to use pipes is so that the two can
communicate more easily, this isn't always desired. 
 

I get the impression that fork may not be a good idea.  Perldoc suggests 
it "could" leave zombie child processes hanging around.  It also gives a 
suggestion how to fix this ($SIG(CHLD)).  Not sure this really is a 
great idea.  It would affect not just Perl but other system processes 
running.  Might not want to set it to ignore.  Also, it makes the 
presumption the system has that handy.

The thing I really like about Perl, there is always another way to do 
something :-)

This exercise has really helped my understanding BTW.  I appreciate the 
help!!!


Re: 'system' and parallel execution (was: Re: How to call a perl script....)

2004-06-25 Thread u235sentinel
Wiggins d Anconia wrote:
It's dangerous to make blanket statements like this. Each is a tool that
should be understood and applied in the right manner. 

I agree with this.  Generally system would be the right fit for many of 
my Perl programs.  However exec has it's place like any tool.

That is why it is
more important to understand the concepts of process execution,
parallelism, blocking, etc. rather than any one particular function.
'system' is really just a combination of a fork+exec+waitpid model that
is easy to use, the backticks are similar to the open pipe model, but
generally easier to use as well, the open pipe model is really just a
fancy version of the same fork+exec+waitpid model.  So some would claim
you should use fork+exec+waitpid, because 'system' really just uses
them, others would say that is the beauty of Perl, 'system' provides a
very good shortcut, assuming it accomplishes the goal.
hmm... So system could generate zombie processes?  Or a filehandle 
process? 

I guess it really depends on what we are kicking off and whether it 
exists cleanly.


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



Re: A possibly stupid 'Perl' question?

2004-06-25 Thread u235sentinel
I haven't used it myself however I understand there is "Active Perl" for 
Windows available.  I don't have any details but perhaps you could 
google for it or someone here could give you directions.

Ron Smith wrote:
I'm in a situation wherein I want to brush up on my 'Perl', but have no personal computer. I'm 
currently reading my way through "Learning Pearl", but can't do the exercises because 
I only have access to 'Windows' machines that do not have Perl installed at all. Is there a way 
to use Perl on-line from such a machine? Is Perl small enough to be installed on a floppy disk 
that can be moved from machine to machine?
Is it possible to use 'Perl' without having to install it on a particular machine?
TIA
Ron Smith

		
-
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
 


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



Re: Copyright Violation -> RE: unique array

2004-07-02 Thread u235sentinel

Bakken, Luke wrote:
How nice of you to decide this for O'Reilly.
I think the local grocery store has made enough money for today, and I
think I'll go in and take an apple.
Why just an apple?  Why not a big fat steak?  It doesn't have to end 
there also, maybe I can come back for dessert later :-)
It's easy to justify anything these days.  Doesn't make it right. 

I mean, I can't police 
the internet
single-handedly.
   

No, but you can at least refrain from posting links to copyrighted
material to the beginners list.
 

Somebody screwed up and violated the copyright laws by publishing those 
awesome books.  Let's support good authors and their works by purchasing 
them.  Publishing the links anywhere doesn't further better products.  
That's why the copyright laws exist.


Re: pls help

2004-07-11 Thread u235sentinel
I agree.  If they are a competent company then shallow knowledge of Perl 
will get him nowhere.  I've been studying for almost a year and have 
written basic code (IMO) to accomplish a few things.  In a recent 
interview I was asked about my Perl knowledge.  They had a couple of 
basic questions which were fairly easy to answer.  Fortunately for me, 
they aren't looking for a Perl hot shot :-)

To start learning Perl, Check out the Oreilly books.  I strongly 
recommend "Learning Perl 3rd Edition" and perhaps "Perl for Dummies".  
Don't fake it or you will be caught.   Be honest.  It can come back to 
bite you otherwise in the future.  I know.  I caught one sucker recently 
who isn't competent (I'm being kind btw).  Needless to say he didn't 
make it.


Jenda Krynicky wrote:
From: shashideep nuggehalli <[EMAIL PROTECTED]>
 

Hello everybody,
 My name is Shashideep. I am new member of the group. I have been
learning PERL for the last few days. I want to be good enough to take
up interviews . 
   

BEG YOUR PARDON ???
 

I would be grateful if somebody could direct me to any
site which would give me an idea of what type of questions can be
expected while applying for PERL related jobs. 
   

You should learn Perl so that you are able to program in the language 
effectively, not just so you can fake the knowledge in an interview.

Though ... if they are so easily deceived they deserve what they get.
Jenda
P.S.: I probably should not tell you, but it's either Perl (the 
language) or perl (the interpreter), but never PERL.

P.P.S.: In the unlikely case you do want to learn something you might 
as well start with the "art" of using mailing lists. Lesson 1, use 
meaningfull subjects:
http://www.catb.org/~esr/faqs/smart-questions.html#bespecific
= [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

 



Re: Could people please use sensible subjects?

2004-07-11 Thread u235sentinel

Jenda Krynicky wrote:
Here are a few subjects I've seen in the list lately:
From [EMAIL PROTECTED] 

I simply delete them without a second thought.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: pls help

2004-07-12 Thread u235sentinel
shashideep nuggehalli wrote:
Thank you for ur concern . Btw , I do not really appreciate the use of
the term  "sucker" and I am not sure if such language could be used in
public mailing lists with out understanding the proper reasons for the
mail.
I simply agreed with the other poster as pasted below.  Take it or leave it.
This is turning into a flame so I'll end is now.
Regards.

n Sun, 11 Jul 2004 12:54:30 -0600, u235sentinel
<[EMAIL PROTECTED]> wrote:
I agree.  If they are a competent company then shallow knowledge of Perl
will get him nowhere.  I've been studying for almost a year and have
written basic code (IMO) to accomplish a few things.  In a recent
interview I was asked about my Perl knowledge.  They had a couple of
basic questions which were fairly easy to answer.  Fortunately for me,
they aren't looking for a Perl hot shot :-)
To start learning Perl, Check out the Oreilly books.  I strongly
recommend "Learning Perl 3rd Edition" and perhaps "Perl for Dummies".
Don't fake it or you will be caught.   Be honest.  It can come back to
bite you otherwise in the future.  I know.  I caught one sucker recently
who isn't competent (I'm being kind btw).  Needless to say he didn't
make it.

Jenda Krynicky wrote:
 

From: shashideep nuggehalli <[EMAIL PROTECTED]>
   

Hello everybody,
My name is Shashideep. I am new member of the group. I have been
learning PERL for the last few days. I want to be good enough to take
up interviews .
 

BEG YOUR PARDON ???

   

I would be grateful if somebody could direct me to any
site which would give me an idea of what type of questions can be
expected while applying for PERL related jobs.
 

You should learn Perl so that you are able to program in the language
effectively, not just so you can fake the knowledge in an interview.
Though ... if they are so easily deceived they deserve what they get.
Jenda
P.S.: I probably should not tell you, but it's either Perl (the
language) or perl (the interpreter), but never PERL.
P.P.S.: In the unlikely case you do want to learn something you might
as well start with the "art" of using mailing lists. Lesson 1, use
meaningfull subjects:
http://www.catb.org/~esr/faqs/smart-questions.html#bespecific
   



Re: Serious question on using Perl or not...

2004-07-26 Thread u235sentinel
Several ways come to mind including hashs or possibly an array.  If it doesn't have to 
stay in memory (I know he said memory.. just exploring options), it's always possible 
to setup maybe a DBM hash and write/pull off of that (Yes I know it was already 
mentioned... I'm agreeing with Wiggins basically).

I've written several simple databases using Perl (as many here have I'm sure).  It's 
not all that hard.  I'm still new to Perl and I've done it fairly easily. Post code 
here and maybe we can help.  

As for learning Perl, I really liked the latest Oreilly "Learning Perl 3rd Edition".  
I highly recommend it.  They have a section on using Arrays and another dealing with 
Hashes.  I also recommend Chapter 16 "Simple Databases".  Not memory related there but 
still good reading.



> > 
> > Hi!
> > 
> > I do not know I am on the right mailing list.
> > If not, sorry for the burden.
> >
> 
> The advocacy list is not the appropriate list, so I have bcc'd it so it
> gets dropped from the discussion. Your question is better asked to the
> [EMAIL PROTECTED] list, I have copied it so that it is in the discussion.
>  
> > To say thing briefly:
> > I am a programmer for some 25 years using various old and newer languages.
> > I have to write some small things in Perl.
> > It was fine and fast with some text analysis.
> > 
> > Now I have to write something using an in-memory "database", i.e. a SINGLE
> > table filled with records.
> > 
> > I am trying to simply add records then retriev them.
> > I already spent more than 20 hours for something which should take 30
> > minutes
> > 
> > Seriousely considering making my customer change his mind and revert to
> > plain old C++
> > Just to be certain not to miss something simple, I attach a small part
> of my
> > very, very basic trials.
> > 
> > As you can see when running this small piece of "code", as soon as you
> push
> > a new record, all records already existing become
> > filled with the new pushed record and it is impossible to get any other...
> > 
> > Looks like Perl is not able to handle trivial data structure like an array
> > of records (or hashes).
> > 
> 
> Don't sell Perl short because you have not given it enough time to
> learn. The reason this is complicated for you isn't Perl's problem, it
> is lack of time taken to learn its fundamentals, I would say the same
> things about C++. Whether you have that time or wish to do it is up to
> you.  Perl can easily handle what you are after using either a Hash of
> hashes or an Array of hashes.  Perl has references to handle complex
> data structures, similar to what you describe. But including lines such
> as "shit language perl" in the comments of a script posted to a group on
> advocacy for Perl isn't likely to get you very far. I would suggest
> reading through,
> 
> perldoc perllol
> perldoc perldsc
> perldoc perlreftut
> perldoc perlref
> 
> Before assuming this trivial task can't be handled by Perl, and/or if
> you are still interested repost a better question to the beginners list
> explaining what you are attempting to do and why it is failing.  You
> should also be using 'strict' in all of your code.
> 
> I would have devoted more time to your script had your attitude been
> better from the start
> 
> http://www.catb.org/~esr/faqs/smart-questions.html
> 
> http://danconia.org
> 
> -- 
> 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: Serious question on using Perl or not...

2004-07-27 Thread u235sentinel
Personally I figured the original coder would join this list and respond (or at least 
respond).  If he's really interested in Perl then more questions/answer would come.  
Silence get's his request dropped from my short term memory :-)


> > Wiggins d Anconia wrote:
> > > Gregorie Hostettler wrote:
> > > > ...
> > > > As you can see when running this small piece of "code", as soon as
> > > > you push a new record, all records already existing become
> > > > filled with the new pushed record and it is impossible to get any
> > > > other... 
> > > > 
> > > > Looks like Perl is not able to handle trivial data structure like
> > > > an array of records (or hashes). 
> > 
> > Where's the code? We're flying blind here.
> > 
> > 
> 
> Sorry, code was snipped by me in my transfer from the advocacy ->
> beginners list. Was hoping for a clarification of the problem to be
> posted along with "cleaned" code.
> 
> http://danconia.org
> 
> 
> -- 
> 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: setting the environment variables in perl

2004-07-27 Thread u235sentinel
Good point in fact Oracle (for example) recommends setting the environment before you 
even install Oracle.  To do it any other way invites trouble and as Oracle would say, 
you're on your own :-)


> jason corbett wrote:
> > How does one go about assuring that the environment variables are
> > properly set in perl? I read several books, but none go in depth
> > about how to write a script that includes all the required variables,
> > that way nothing gets left out.
> 
> It's really not a Perl issue per se. I assume you're talking about variables
> used by Oracle libraries, like ORACLE_HOME and ORACLE_SID.
> 
> I advise you to *not* attempt to set or monkey with these variables inside
> the Perl script. The whole point of environment variables is so the user can
> establish his environment *before* invoking your script.
> 
> -- 
> 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: Secure Shell and system command

2004-08-30 Thread u235sentinel
I would run system commands with the backticks.  That tells Perl to run the command 
and place the contents in the variable you defined.

System OTOH returns if the command completed successfully (at least I believe that's 
what happened here).


> Moon, John wrote:
> 
> Hello,
> 
> > I run the following commands but ALWAYS get a 1 returned from the 
> > system "scp ... ".  
> > 
> > Has anyone else experienced similar problems with ssh? Or see anything I'm
> > doing wrong?
> > 
> > 
> > my $results=system 'scp -q accounts_4_unix.dat '
> > .
> "[EMAIL PROTECTED]:Inbox/System_Support/MakeProjects/projects.dat";
> 
> perldoc -f system
> 
> system() doesn't do/return what you think it does I beleive.
> 
> Try
> my $results = `scp ...`;
> 
> HTH :)
> Lee.M - JupiterHost.Net
> 
> .
> 
> Thanks for the reply... 
> 
> That, back tics, "seems" to take care of the problem (?)...
> 
> Now, I guess I'm a little confused as to when to use "system" and when to
> use back tics...
> 
> jwm 
> 
> -- 
> 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: bundle install fails

2004-09-13 Thread u235sentinel
You might want to try downloading the binhex code and build it without cpan.  I did 
find this during my google on ExtUtils::Command::MM

It suggests the code is not stable.  Might be the problem. It's not on your system and 
CPAN installs of it might be a problem.

http://www.perldoc.com/perl5.8.4/lib/ExtUtils/Command/MM.html


> Hello,
> 
> I am trying to install the "Convert::BinHex" bundle from CPAN, but I am
> getting the error below. Any ideas on how I can fix this.
> 
> Thank you in advance.
> 
> ~James 
> 
>  CPAN.pm: Going to build E/ER/ERYQ/Convert-BinHex-1.119.tar.gz
> 
> Checking if your kit is complete...
> Looks good
> Writing Makefile for Convert::BinHex
> cp lib/Convert/BinHex.pm blib/lib/Convert/BinHex.pm
> Manifying blib/man3/Convert::BinHex.3pm
>   /usr/bin/make  -- OK
> Running make test
> PERL_DL_NONLAZY=1 /usr/bin/perl5.8.3 "-MExtUtils::Command::MM" "-e"
> "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
> t/comp2binCan't locate package Exporter for @Checker::ISA at
> t/comp2bin.t line 3.
> Undefined subroutine &main::check called at t/comp2bin.t line 75.
> t/comp2bindubious
> Test returned status 255 (wstat 65280, 0xff00)
> Scalar found where operator expected at (eval 153) line 1, near "'int'
> $__val"
> (Missing operator before   $__val?)
> DIED. FAILED tests 1-9
> Failed 9/9 tests, 0.00% okay
> Failed Test  Stat Wstat Total Fail  Failed  List of Failed
> 
> 
> 
> t/comp2bin.t  255 65280 9   18 200.00%  1-9
> Failed 1/1 test scripts, 0.00% okay. 9/9 subtests failed, 0.00% okay.
> make: *** [test_dynamic] Error 2
>   /usr/bin/make test -- NOT OK
> Running make install
>   make test had returned bad status, won't install without force
> 
> cpan>
> 
> 
> 
> -- 
> 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: perl_mod

2004-09-13 Thread u235sentinel
Chris Devers wrote:
On Mon, 13 Sep 2004, Patricio Bruna V. wrote:
 

where i can start?
   

Google? 

Amazon? 

Specific, concrete questions?

 

Personally I started at the beginning.  But that's me ;-)
Seriously though.  Perhaps starting at perl.apache.org.  Also, there is 
the Oreilly book "Practical Mod_Perl".

Please give us more details so we can provide help.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: bundle install fails

2004-09-13 Thread u235sentinel

Thank you for your response. 

Sorry for the newbie question, but from where and how do install the
Convert::BinHex code and build it?
Thank you, again.
James 

 

No worries.  I usually go to cpan.org.
Here is the direct link to the info page. Lots of good details on how it 
works.

http://search.cpan.org/~eryq/Convert-BinHex-1.119/lib/Convert/BinHex.pm
Here is where you can download the source
http://search.cpan.org/CPAN/authors/id/E/ER/ERYQ/Convert-BinHex-1.119.tar.gz 


Good Luck!

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



RE: bundle install fails

2004-09-14 Thread u235sentinel
Looks ok to me.

What you are probably seeing are the tests usually associated with the CPAN install.  
It may also find a new version the CPAN.pm module and upgrade it on the fly.  It does 
that every now and then. 

I didn't see anything to worry about.  Looks like the 'make install' worked just fine. 
 You might want to go ahead and create some test programs to make sure it's working.  
Otherwise you should be good to go.



> >Sorry for the newbie question, but from where and how do I install the
> >Convert::BinHex code and build it?
> >  
> >
> No worries.  I usually go to cpan.org.
> 
> Here is the direct link to the info page. Lots of good details on how it 
> works.
> 
> http://search.cpan.org/~eryq/Convert-BinHex-1.119/lib/Convert/BinHex.pm
> 
> Here is where you can download the source
> 
> http://search.cpan.org/CPAN/authors/id/E/ER/ERYQ/Convert-BinHex-1.119.tar.gz
> 
> 
> ~~~
> Hello,
> 
> Thanks for all the help and info. After downloading the tarball I ran, 'perl
> Makefile.PL', and 'make', then 'make install', but I am not sure if this is
> all I need to do. When running the install from CPAN so much more seems to
> take place (as far as the verbose output on the terminal shows). Below is
> the output from tarball build. Is this everything for an install or am I
> missing something? 
> 
> Thanks again for your help.
> 
> [EMAIL PROTECTED] Convert-BinHex-1.119]# perl Makefile.PL
> Checking if your kit is complete...
> Looks good
> Writing Makefile for Convert::BinHex
> [EMAIL PROTECTED] Convert-BinHex-1.119]# ls
> bin/  COPYING  docs/  lib/  Makefile  Makefile.PL*  MANIFEST  README
> README-TOO  t/  test/  testin/  testout/
> [EMAIL PROTECTED] Convert-BinHex-1.119]# make
> cp lib/Convert/BinHex.pm blib/lib/Convert/BinHex.pm
> Manifying blib/man3/Convert::BinHex.3pm
> [EMAIL PROTECTED] Convert-BinHex-1.119]# ls
> bin/  blib/  blibdirs  COPYING  docs/  lib/  Makefile  Makefile.PL*
> MANIFEST  pm_to_blib  README  README-TOO  t/  test/  testin/  testout/
> [EMAIL PROTECTED] Convert-BinHex-1.119]# make install
> Installing /usr/lib/perl5/site_perl/5.8.3/Convert/BinHex.pm
> Installing /usr/share/man/man3/Convert::BinHex.3pm
> Writing
> /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi/auto/Convert/BinHex/.
> packlist
> Appending installation info to
> /usr/lib/perl5/5.8.3/i386-linux-thread-multi/perllocal.pod
> 
> ~~~
> ~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: cp command error check

2004-09-17 Thread u235sentinel
I believe you want to print $!.  Give it a try.


> Hello
> 
> This does not work.
> 
>  `cp $srcfile $dstfile`; || do {
>   print "cannot copy $srcfile to $dstfile";
> };
> 
> do is also execute if cp working fine. Whz is this so? The next thing I 
> would like to
> know how I can print the cp's error message.
> 
> Thanks
> 
> Urs
> 
> -- 
> 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]