in reply to SEO Fixer Part II - Updated
Its much more basic than that, see Re^4: Trying to Insert Alt Tags Programmatically, your program, once again, looks nothing like that, you still got Metabot, and all the other things you copy/pasted, except now you have Ebola and Botulism too.
#!/usr/bin/perl -- use strict; use warnings; use ... all the other things that you need; Main( @ARGV ): exit( 0 );
Another question what is sub Ebola supposed to be doing?
Nothing if you don't know. I could try to explain how it was supposed to replace part of your code that kept repeating, how you're supposed to make sure it does what you need, and name it something descriptive, but honestly, whats the point, you're just going to ignore what i wrote, and copy/paste the code section
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: SEO Fixer Part II - Updated
by socrtwo (Sexton) on Apr 06, 2011 at 15:06 UTC | |
| [reply] |
Re^2: SEO Fixer Part II - Updated
by socrtwo (Sexton) on Apr 06, 2011 at 16:03 UTC | |
To anonymous, my apologies once again. I didn't mean to offend your sense of the effort I should be putting in and I really am grateful for the help you are giving me. I love Perl when I can figure it out, but have difficulty learning things in a classroom setting. Additionally a lot of CPAN is impenetrable and discouraging to me. I know I'm abusing Perl Monks and other source by hacking my way through this, but believe me, I'm learning a lot even though it's shocking often what I don't know, I'm sure. I have hacked my way through things successfully in the past you can see that by looking up my record here. I have a bunch of hacked Perl things I have placed on sourceforge too. Maybe my motivations are vainglorious, and am abusing Perl Monks to get there, but I also love each new bit I learn new about Perl. It's a very powerful language and despite my trouble maybe the next easiest after html.
I remember now a reason I may have gone back to the original. I also received an error about the $FOLLOW scalar not being initiated. I just initiated it with a "my $FOLLOW;" and got things working again, rewriting your the code to fit your skeleton as recommended. I didn't understand what $FOLLOW was supposed to be doing. I suspect that the regex is there to tell the spider not to try to evaluate pdf files and the like but only those ending in htm and html. I don't how $FOLLOW magically works. I'm certainly willing to write in a regex that only looks for htm, html, php and asp pages if $FOLLOW needs that definition. As for Ebola, I suspecting now that you mean I should rewrite that as a routine for the img alt attribute substitution. I'm not sure exactly how to do that. At any rate, the code for the images now works in the body of the botulism sub (I get the joke about it being an infected bot...). However the code for the meta tags does not. I don't understand how substitutions are being made in the $tree for title and img but not splicing in of the new meta tags... You are right, your code does properly spider when I made $FOLLOW initiated with "my". The code below produces results, and now spiders correctly, it just doesn't inject the new meta tags.
| [reply] [d/l] |
by Anonymous Monk on Apr 06, 2011 at 20:24 UTC | |
I'll try to explain about Ebola, I'll try be clear. In Re^3: Trying to Insert Alt Tags Programmatically you posted this (I've run it through perltidy ) Read more... (2 kB)
Every time you write repetitive stuff like that
you should turn it into a subroutine, which I did, and I called it Ebola (surely you noticed substr/push_content). To learn to Ebola you would write a program like this (Ebola.pl) And the output of this program is This is how you learn to Ebola, by writing a small program (Ebola.pl) to explore how HTML::TreeBuilder/HTML::Element objects behave. For the next step in the process, you write a program called Ebola.t Where AsdfQwerty(), like Ebola.pl, puts Ebola() through its paces. That is, AsdfQwerty(), tests Ebola(), by feeding Ebola() various inputs, and checking that the output Ebola() produces meets your expectations. Problems are easier to spot and fix in very small programs. Forget about your big task (SEO Fixer) for the moment, write 5 or 10 of these little programs, each dealing with a single small task, a single function (Ebola). But don't call it Ebola, Ebola isn't descriptive, it doesn't explain or even hint at what the subroutine is supposed to accomplish or demonstrate/teach you. Do you follow what I'm saying? The reason I chose names like Ebola is because you're supposed to change them. Learning to program is hard, there is a lot of information you have to juggle inside your head, and only sticks if you write/rewrite code yourself. You still have part of my demo prog in this post i'm replying to This code was supposed to demonstrate/teach how look_down works, and how to modify any tags you might find, it wasn't meant for direct inclusion in your program, after all, I'm not writing your program :) Its like learning to juggle
I know this must seem overwhelming (hey, I'm typing my fingers bloody here :D) so here is the last surprise, AsdfQwerty is better written using Test::More, like http://cpansearch.perl.org/src/PETEK/HTML-Tree-3.23/t/attributes.t Read more... (1022 Bytes)
But it isn't necessary, its just motorized equipment, chainsaw versus handsaw.
Good luck. | [reply] [d/l] [select] |