Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

silent11 (2860)

  (email not shown publicly)

Journal of silent11 (2860)

Friday July 01, 2005
03:43 PM

Fed up with myself ( Class::DBI hurts my brain )

Napoleon: Gosh!

I can't wrap my brain around Class::DBI. I don't think I understand what exactly a has_a is or something. Or maybe it's Friday and it's been a loooooong week.

I'm writing this little code repository script ( that is quite weak) just to get some practice with cdbi.

Here is my module

package Repository::DBI;
        use base 'Class::DBI';

packag e Repository::Users;
        use base 'Repository::DBI';
        Repository::Users->columns(All => qw`users_id users_name users_email users_since users_password`);
        Repository::Users->has_many('entries', "Repository::Entry" => 'entry_user_id');

package Repository::Category;
        use base 'Repository::DBI';
        Repository::Category->columns(All => qw`cat_id cat_name cat_description`);
        Repository::Category->has_many('entries', 'Repository::Entry' => 'entry_cat_id');

package Repository::Entry;
        use base 'Repository::DBI';
        Repository::Entry->columns(All => qw`entry_id entry_user_id entry_cat_id entry_code entry_description entry_mod_date entry_create_date`);
        #Repository::Entry->has_a(user => 'Repository::Users');
        #Repository::Entry->has_a(category => 'Repository::Category');

The commented lines are the ones giving me trouble.

And my database:

# category table

CREATE TABLE `repository_cat` (
  `cat_id` int(11) NOT NULL auto_increment,
  `cat_name` varchar(50) default NULL,
  `cat_description` text,
  PRIMARY KEY  (`cat_id`)

# entry table

CREATE TABLE `repository_entry` (
  `entry_id` int(11) NOT NULL auto_increment,
  `entry_user_id` int(11) NOT NULL default '0',
  `entry_cat_id` int(11) default NULL,
  `entry_code` longtext,
  `entry_description` text,
  `entry_mod_date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `entry_create_date` date default NULL,
  PRIMARY KEY  (`entry_id`)

# users table

CREATE TABLE `repository_users` (
  `users_id` int(11) NOT NULL auto_increment,
  `users_name` varchar(50) default NULL,
  `users_email` varchar(225) default NULL,
  `users_since` date default NULL,
  `users_password` varchar(25) default NULL,
  PRIMARY KEY  (`users_id`)

My script (below) only works with the last 2 lines in my .pm file commented out.

1 #!/usr/bin/perl
3 use strict;
4 use lib '/home/will/lib/';
5 use Repository::DBI;
8 my $iterator = Repository::Users->retrieve_all;
9 print join("\t",qw/id name email/) , "$/" ;
10 while (my $user = $iterator->next){
11         print join("\t",($user->users_id, $user->users_name, $user->users_email, $/));
12 }

09:20 AM

CPANPLUS and installing lotsa modules at once

I'm still getting my Linux box ready for development, and I've been installing a hella lota modules. I know CPANPLUS is already the easy way, but comon! There are like 40+ Net::Amazon modules and a ton for Template::* etc...

I tried CPAN Terminal> install Net::Amazon::* but that didn't work. After looking in the docs I noticed that CPANPLUS accepts install MODULE | NUMBER .... Which installs modules by name or by search number.

Still, knowing the search number wouldn't save me time. Then I thought , wouldn't it be cool if I could do something like install Net::Amazon 1..LAST_IN_SEARCH

Well I searched on Net::Amazon, found that 41 modules existed, and issued a i Net::Amazon 1..41 and do you know it WORKED!

This will save me soo much time, especially with the Template::* modules.

The only problem is that it wouldn't follow dependencies, which I do have CPANPLUS set up to do.

Monday June 27, 2005
03:56 PM

One man show++

I do some web development on the side. I'm at the point where I can't do everything on my own -- juggling a full time *real* job, school, family, etc...

At the same time, this development work I do is nowhere near enough to compensate for my *real* job -- however I'd love it if I could get away with it.

So how does one go about finding a partner/employee to help with the work load? This person would need to be willing to work at wholesale, as well as being honest enough not to jump in bed with the client.

I'm open to ideas.
03:33 PM

Most Useful Academic Programming Language ...

I need to decide which programming lauguage to study for a Computer Information Systems degree. The following are my options:
  • CIS 4304 Advanced Programming in C++
  • CIS 4321 Advanced Programming in Visual Basic
  • CIS 4325 Advanced Programming in COBOL
  • CIS 4330 Advanced Programming in Java

I know a just a little of Java and VB, as for the others I know even less.

What I'd really like to know is which language will best

  1. Help me further my understanding of programming concepts
  2. Help my resume & earning potential
  3. Be of use in the real world

I'd love to hear your thoughts on this from some of you experienced programmers out there. Also, I may not get around to taking this class for a few semesters. In the event that VB is replaced with C# would your choice change?


03:10 PM

Back to School

Well, I've taken a long enough break from school. Our little tyke is 4 months old now, so tending to him is no longer an excuse ( especially since my wife stays at home with him ).
I've been going back and forth between the following degrees in various business schools:

$schools = {
'University of Houston' = ['Entrepreneurship', 'MIS', 'Finance'],
'University of Houston Downtown' = ['Finance', 'Computer Information Systems'],
'Sam Houston State University' = ['General Business']

I've decided to go with Computer Information Systems at UHD.
I feel good about my decision and I can't wait to start.
Friday June 24, 2005
10:26 AM

Getting back into things

I've been idle with my Perl for quite some time now, more than a year., and some internal motivations have really motivated me to get back into perl!
Monday August 30, 2004
08:53 AM


use strict;
use LWP::Simple;
use HTML::TokeParser;

# usage Links("URL","File Extension","Save Files to");
# This will download the Book of Mormon in MP3 format.

Links(",18692,5297-41,00.html", "mp3" , "./BofM/");

sub Links
        my $count = 0;
        my $url   = shift;
        my $type  = shift;
        my $dir   = shift;

            if ( defined $dir )
                    # mkdir $dir || die $!;
                    print "$dir directory was created\n";

        print "URL : $url \n TYPE: $type \n\n";

        unless ( defined $url )
                return("No URL Provided\n");
                die $!;
        unless ( defined $type )
                return("No Link Type Provided\n");
                die $!;

        my $html = get( $url );

        my $page = HTML::TokeParser->new(\$html);

        while ( my $token = $page->get_tag("a"))
                 my $url = $token->[1]{href} || "-";
                 my $file = $url;
                    $file =~ s/^.+\///;

             if ($url =~ /$type$/i)
              print "Getting $url as $file \n\n";
              sleep 3;
              getstore( $url , $dir . '/' . $file ) || die $!;
              $count ++;

08:50 AM

use LWP::Simple 'getstore';

for (1..140){
getstore(''.$_.'.gi f',$_.'.gif');
print qq~
<table background="$_.gif" height="400" width="100%">
<td align="center" valign="middle"><h1>$_</h1></td>


perl > out.html

Monday May 19, 2003
02:18 PM

Houston Texas Perl Mongers

With a population of over 4 million people you'd think that the Houston PM group could muster more than 3 steady participants to their meetings. David and I are trying frantically to get something together. {sigh} I know the group can be more active than it is now.
Tuesday April 01, 2003
03:20 PM

what next....

[ #11381 ]
<sigh of frustration> I'm not sure what to do with myself..... So things are looking bleak, at best, at work. The workload is diminishing, our projects are ending, our responsiblities are vanishing. Mergers can do that to groups, especially unwanted groups.

What do I do?

  • look for another job
  • return to school
  • ride this job out and hope for the best
  • eat lots of icecream

It wouldn't be that bad if I wasn't married, and if I had a degree, however, I am, and I don't. Currently I have the flexabality to work full tiem while going to school part time. The last 3 years hear have really been a blessing, a blessing that is drawing to an end. It makes me regret that I wasn't so ambitious towards school while I had it easy over the last little while. The way things are looking now I'm gonna be out of a job with no degree and *some* skills.

Going back to school full time would be FUN in my opinion, however It's not just me anymore. Being married is so interesting like that. Don't get me wrong, I wouldn't change a thing in my life, especially being married! It's just that we can both have the same aspirations and goals, with 2 different roads leading to the goal.

I'd rather get this school/degree thing out of the way ASAP and if I do find myself unemployed this would be the perfect time to do it. We are used to a certain standard of living tho, and I'd hate to yank that comfortable carpet out from underneath my wife with one big tug.

In my mind the only way to do both (education/income) would be to land some perfect job (even more perfect than the one I have now) where I could attend school during the day and work making serious bank at night.

I have faith that things will work out for us, it's just no fun waiting for the future sometimes.