online perl courses

2010-05-23 Thread ben perl
Can anyone please recommend intermediate to advance perl online
courses/tutorials with focus on Object oriented techniques, if they know.

I am willing to pay also if it costs something.


Thanks,
-Ben


Re: data dumper

2010-05-17 Thread ben perl
Thanks everyone,

I tried the module and it is great.

Thanks,
-Ben

On Mon, May 17, 2010 at 8:00 AM, Shawn H Corey shawnhco...@gmail.comwrote:

 On 10-05-17 10:35 AM, Eric Veith1 wrote:

 Bob McConnellr...@cbord.com  wrote on 05/17/2010 02:26:58 PM:

   What is the difference between this and exporting a YAML file? Where
   would either be preferred over the other?

 Except for the obvious syntax and that YAML might be easier to read for
 end users that just happen to edit a config file, I guess there's none.
 AFAIK, YML has a notation for references (i.e., let one node of the
 document refer to another), too. So it all depends on the parser.

 I'm not sure whether evaluating perl code would be fast than parsing YML,
 but for a config file, I guess it wouldn't make much of a difference.


 Unless the parser is really slow, it shouldn't matter since this is a one
 time event.

 The thing about using Data::Dumper to store the configuration is that it is
 in Perl.  You don't have to learn a second syntax to use it.  You can change
 it directly by using a text editor.

 The reason you have a save_config subroutine is so the end user can change
 the configuration by interacting with the script.  You, the great Perl
 programmer, don't need it; you can change it directly in its file.  :)



 --
 Just my 0.0002 million dollars worth,
  Shawn

 Programming is as much about organization and communication
 as it is about coding.

 I like Perl; it's the only language where you can bless your
 thingy.

 Eliminate software piracy:  use only FLOSS.

 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/





data dumper

2010-05-16 Thread ben perl
What is the use of Data::Dumper module?

can any body please give examples?

Have been using perl for some time and never used this module. Not sure if i
am missing something by not using it.

Thanks,
-Ben


running stats on a file

2010-03-16 Thread ben perl
Hi Everyone,

I writing this program to check if a file is being touched (linux touch
command) every 25   seconds.I am using stat command on linux.

For example(please check the bold),

stat file
  File: `file'
  Size: 0   Blocks: 0  IO Block: 4096   regular empty
file
Device: 803h/2051d  Inode: 164394  Links: 1
Access: (0666/-rw-rw-rw-)  Uid: (0/   admin)   Gid: (0/root)
Access: 2010-03-16 12:09:03.0 -0700
Modify: 2010-03-16 12:09:03.0 -0700
Change: *2010-03-16 *12:09:03.0 -0700  =


After 25 seconds:

[ad...@machine ~]# stat file
  File: `file'
  Size: 0   Blocks: 0  IO Block: 4096   regular empty
file
Device: 803h/2051d  Inode: 164394  Links: 1
Access: (0666/-rw-rw-rw-)  Uid: (0/   admin)   Gid: (0/root)
Access: 2010-03-16 12:09:28.0 -0700
Modify: 2010-03-16 12:09:28.0 -0700
Change: *2010-03-16* 12:09:28.0 -0700 =


I am just worried about the change attribute above from stat command. So ,
what i am trying to do convert 12:09:03(as in the example above)  into
seconds and add 25 seconds and convert back into hour:minutes:seconds
format and check the values match.

Hope it is clear.

Thanks for the help in advance,
-Ben


Re: running stats on a file

2010-03-16 Thread ben perl
Hi Jim,

Thanks for the reply. This seem to work only if i am running perl on the
machine itself.

I am instead using expect to ssh into this machine and run stat command and
use the output from that command to check the output of that stat command.

Thanks,
-Ben



On Tue, Mar 16, 2010 at 1:31 PM, Jim Gibson jimsgib...@gmail.com wrote:

 On 3/16/10 Tue  Mar 16, 2010  12:18 PM, ben perl ben.pe...@gmail.com
 scribbled:

  Hi Everyone,
 
  I writing this program to check if a file is being touched (linux touch
  command) every 25   seconds.I am using stat command on linux.
 
  For example(please check the bold),
 
  stat file
File: `file'
Size: 0   Blocks: 0  IO Block: 4096   regular empty
  file
  Device: 803h/2051d  Inode: 164394  Links: 1
  Access: (0666/-rw-rw-rw-)  Uid: (0/   admin)   Gid: (0/root)
  Access: 2010-03-16 12:09:03.0 -0700
  Modify: 2010-03-16 12:09:03.0 -0700
  Change: *2010-03-16 *12:09:03.0 -0700  =


 
  I am just worried about the change attribute above from stat command. So
 ,
  what i am trying to do convert 12:09:03(as in the example above)  into
  seconds and add 25 seconds and convert back into hour:minutes:seconds
  format and check the values match.

 If you are writing a Perl program, you can use the Perl built-in stat
 function that returns 'last modify time' in seconds from the epoch
 (1/1/70:00:00:00 UTC), rather than the Linux stat command as above. That
 way, you can easily compare times numerically and not worry about
 converting
 between numerical and string forms. See 'perldoc -f stat' for details.

 There is also the -M file test operator that returns the age (difference
 between the time your program started and the time the file was modified)
 of
 any file in floating-point days (multiply by 86,400 to get age in seconds).
 See 'perldoc -f -X' for details.



 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/





Re: running stats on a file

2010-03-16 Thread ben perl
Thanks Jim,

Date::Parse worked.

-Ben

On Tue, Mar 16, 2010 at 2:32 PM, Jim Gibson jimsgib...@gmail.com wrote:

 On 3/16/10 Tue  Mar 16, 2010  2:05 PM, ben perl ben.pe...@gmail.com
 scribbled:

  Hi Jim,
 
  Thanks for the reply. This seem to work only if i am running perl on the
  machine itself.
 
  I am instead using expect to ssh into this machine and run stat command
 and
  use the output from that command to check the output of that stat
 command.

 Then check out the various date/time modules included with Perl or
 available
 on CPAN, including Time::localtime, Time::Local, Date::Calc, DateTime,
 and Date::Manip.

 Date::Manip in particular has the ParseDate function for return a numerical
 time given a string.

 You can also do your own parsing of the output of stat, extracting the date
 and time fields and using the timelocal or timegm functions of the
 Time::Local module to calculate Unix times.



 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/





perl script to log on to website

2009-01-29 Thread ben perl
Is there a way i can use perl to log on to my cell phone provider website
and download the minutes i have used
and email me if i am going over certain minutes?

Thanks,
-Ben


Re: explanation of @INC

2009-01-23 Thread ben perl
Thanks Everyone,
This does help..


-Bandeep

On Fri, Jan 23, 2009 at 9:48 AM, Gunnar Hjalmarsson nore...@gunnar.ccwrote:

 Scott Haneda wrote:

 On Jan 23, 2009, at 1:01 AM, Gunnar Hjalmarsson wrote:

 Scott Haneda wrote:

 ASSP required about 15 perl modules, I installed them, or wrote new
 portfiles for them to get them installed.  I have all requirements for ASSP
 installed.  I edit the ASSP source files to change the first line from:
 #!/usr/bin/perl --
 to
 #!/opt/local/bin/perl --
 When I run ASSP, it tells me three ports are not installed.  One is
 Email::Valid, which should serve well enough as a way for me to learn how 
 to
 solve this.


 Try running:
 /usr/bin/perl -MEmail::Valid -e 'print $INC{Email/Valid.pm}'


 $/usr/bin/perl -MEmail::Valid -e 'print $INC{Email/Valid.pm}'
 Can't locate Email/Valid.pm in @INC (@INC contains:
 /System/Library/Perl/5.8.8/darwin-thread-multi-2level
 /System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level
 /Library/Perl/5.8.8 /Library/Perl
 /Network/Library/Perl/5.8.8/darwin-thread-multi-2level
 /Network/Library/Perl/5.8.8 /Network/Library/Perl
 /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level
 /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1
 .).
 BEGIN failed--compilation aborted.

  and

 /opt/local/bin/perl -MEmail::Valid -e 'print $INC{Email/Valid.pm}'


 $/opt/local/bin/perl -MEmail::Valid -e 'print $INC{Email/Valid.pm}'
 /opt/local/lib/perl5/vendor_perl/5.8.9/Email/Valid.pm

  and let us know the results.


 I am not entirely sure what that all means, but I think it is telling me
 there is in fact no Email::Valid in the default install, but there is one in
 the /opt/local/bin/perl one.


 Yes, and that indicates that ASSP is still running the default Perl
 install, even if you told us that you edited the shebang line of the ASSP
 source files. Maybe you missed some file(s), maybe the command that invokes
 ASSP does not rely on the shebang line(s) to determine which of the Perl
 installs to use.

 --
 Gunnar Hjalmarsson
 Email: http://www.gunnar.cc/cgi-bin/contact.pl

 --
 To unsubscribe, e-mail: beginners-unsubscr...@perl.org
 For additional commands, e-mail: beginners-h...@perl.org
 http://learn.perl.org/





use vs require

2009-01-22 Thread ben perl
Hi Everyone,
I am could never understand the difference between use vs require? If
require is older way of including modules, why not just make it obsolete.

Thanks,
-Bandeep


Re: use vs require

2009-01-22 Thread ben perl
Hi Chas,

Can you give me an example when one would be used over the other? So, is
require used more for efficiency, so we load the module only if we need it?
Thanks,
-Ben

On Thu, Jan 22, 2009 at 2:50 PM, Chas. Owens chas.ow...@gmail.com wrote:

 On Thu, Jan 22, 2009 at 17:33, ben perl ben.pe...@gmail.com wrote:
  Hi Everyone,
  I am could never understand the difference between use vs require? If
  require is older way of including modules, why not just make it
 obsolete.
 snip

 Well, first off, because use uses require.  The use looks something
 like this internally

 BEGIN {
require Module;
import Module args_to_use;
 }


 There is also a difference in when they run.  Because of the BEGIN
 block, use statements occur at compile time, so it is not possible to
 conditionally load a module (without eval).  The require function runs
 at runtime, so you can say things like

 if ($use_module_foo) {
require Module::Foo;
import Module::Foo;
 }

 --
 Chas. Owens
 wonkden.net
 The most important skill a programmer can have is the ability to read.



disk performance or destructive testing

2008-12-16 Thread ben perl
Does anyone know any perl module for validating  or do some desctructive
testing on disks on Linux platform?

Thanks,
-Ben


trying to put in an array patters matched.

2008-12-12 Thread ben perl
Hi


I am trying to push values in array to what ever matched in  a regular
expression.


For example

$string = something22 322 abc;

$string =~ /(\d+)\s(\d+)(abc)/;

This should create an array like with elements as (22, 322,abc).

What will the best way to do it? The regular expression is really long as
compared to the one i am mentioning and was wondering if could create  a
loop
which would iterate over $1,$2,$3 .$15 (temporary variable which perl
uses to store patterns matched) and store those in an array.


Thanks,
-Ben


Re: perl cumulative module question

2008-11-27 Thread ben perl
Thanks Everyone!! This should help.



On Sat, Nov 22, 2008 at 9:17 AM, Rob Dixon [EMAIL PROTECTED] wrote:

 Rob Dixon wrote:
 
  Your arithmetic is odd. You say
 
   9-4 = 2
 
  and so your resulting list should be (2,4,2). If you want to subtract the
  previous result from the next item in your data list each time then this
 will do
  the job.
 
  HTH,
 
  Rob
 
 
  use strict;
  use warnings;
 
  my @data = (2, 6, 9);
  my @delta = @data;
  my $prev = 0;
 
  $prev = $_ = $_-$prev for @delta;
 
  print @delta\n;
 
  **OUTPUT**
 
  2 4 5

 Jay's solution is very similar but preferable to mine.

 Rob

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





perl cumulative module question

2008-11-22 Thread ben perl
Is there a perl module to find cumulative in a column? It should subtract
from the previous row and creates new column.

For example, If i have the follow column in my file

2
6
9

It gives me

2
6-2 = 4
9-4 = 2

So the resulting column is

2
4
2

Hope I am using cumulative as the right word to explain this.

I could write my own script but did not want to reinvent the wheel.


Thanks,
-Bandeep


perl module for graphs lines point

2008-11-17 Thread ben perl
Hi ,

Is there a perl module to plot graphs with lines point.

Thanks,

-Bandeep