Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2004-06-13, 05:27 PM   #26
swedguy
Vagabond
 
swedguy's Avatar
 
Join Date: Aug 2003
Posts: 2,374
Send a message via ICQ to swedguy
I just went through the Perl 5.8 Changelog (I tried the script on 5.6) and nothing interesting in there. Thought they might've changed something.

If you just try this little script

PHP Code:
#!/usr/bin/perl

$var 'hello';
print 
$var
Does it work?
swedguy is offline   Reply With Quote
Old 2004-06-13, 05:29 PM   #27
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
I'm getting this error

myscripts/remove-right-mouse-code.pl: undef: command not found
myscripts/remove-right-mouse-code.pl: line 5: syntax error near unexpected token `s/(/<'
myscripts/remove-right-mouse-code.pl: line 5: `s/(/<script language="JavaScript1\.2">.*?document\.captureEvents\(Event\.MOUSEUP\).*?document\.captureEvents\(Event.MOUSEDOWN\).*?<\/script>)//

I have my scripts in a non public directory so I can't do a link but here is a copy and paste from it.
#!/usr/bin/perl -pi

undef $/;
s/<script language="JavaScript1\.2">.*?document\.captureEvents\(Event\.MOUSEUP\).*?document\.captureEvents\(Event.MOUSEDOWN\).*?<\/script>//sm;
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2004-06-13, 05:36 PM   #28
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
$ myscripts/test.pl
hello
$
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2004-06-13, 05:39 PM   #29
swedguy
Vagabond
 
swedguy's Avatar
 
Join Date: Aug 2003
Posts: 2,374
Send a message via ICQ to swedguy
Hmm, something is wrong here.

Quote:
Originally posted by Cleo
myscripts/remove-right-mouse-code.pl: line 5: syntax error near unexpected token `s/(/<'
myscripts/remove-right-mouse-code.pl: line 5: `s/(/<script language="JavaScript1\.2">.*?document\.captureEvents\(Event\.MOUSEUP\).*?document\.captureEvents\(Event.MOUSEDOWN\).*?<\/script>)//
Quote:
Originally posted by Cleo

#!/usr/bin/perl -pi

undef $/;
s/<script language="JavaScript1\.2">.*?document\.captureEvents\(Event\.MOUSEUP\).*?document\.captureEvents\(Event.MOUSEDOWN\).*?<\/script>//sm;
The remove-right-mouse-code.pl script is not the same as the one that produced the error. The error comes from the old code.
swedguy is offline   Reply With Quote
Old 2004-06-13, 05:42 PM   #30
swedguy
Vagabond
 
swedguy's Avatar
 
Join Date: Aug 2003
Posts: 2,374
Send a message via ICQ to swedguy
I could sort of reproduce the error in two ways.

1. Don't have a #!/usr/bin/perl -pi as the first line.

2. Have a space before #!/usr/bin/perl -pi
swedguy is offline   Reply With Quote
Old 2004-06-13, 05:43 PM   #31
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
I took at the empty lines in the script and got this error.

Unmatched ( in regex; marked by <-- HERE in m/( <-- HERE / at myscripts/remove-right-mouse-code.pl line 3.
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2004-06-13, 05:43 PM   #32
airdick
Shut up brain, or I'll stab you with a Q-tip!
 
Join Date: Aug 2003
Posts: 114
I'm betting on a blank first line..

ooopss. i was a little slow on the reply. Now all that's left is the perl debugging.

Last edited by airdick; 2004-06-13 at 05:48 PM..
airdick is offline   Reply With Quote
Old 2004-06-13, 05:51 PM   #33
swedguy
Vagabond
 
swedguy's Avatar
 
Join Date: Aug 2003
Posts: 2,374
Send a message via ICQ to swedguy
Quote:
Originally posted by Cleo
I took at the empty lines in the script and got this error.

Unmatched ( in regex; marked by <-- HERE in m/( <-- HERE / at myscripts/remove-right-mouse-code.pl line 3.
Awsome, then the problem was an empty line and you are still using the old code

It's probably stuck in your cache. Here's a new url for you: http://www.sponsororganizer.com/FreeScripts/cleo2.html

And remember, no empty lines in the beginning
swedguy is offline   Reply With Quote
Old 2004-06-13, 06:44 PM   #34
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
We Have Liftoff!

No errors in telnet and when I run top I see find running.

There is 7 gigs in there so I guess this will take awhile.

__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2004-06-13, 06:52 PM   #35
swedguy
Vagabond
 
swedguy's Avatar
 
Join Date: Aug 2003
Posts: 2,374
Send a message via ICQ to swedguy
swedguy is offline   Reply With Quote
Old 2004-06-13, 07:00 PM   #36
venturi
No offence Apu, but when they were handing out religions you must have been out taking a whizz
 
Join Date: Apr 2003
Location: An Oasis atop a High Desert Mesa
Posts: 282
Send a message via ICQ to venturi
Wow! This thread turned into a Perl workshop overnight!

Cool stuff SwedeGuy.
venturi is offline   Reply With Quote
Old 2004-06-13, 07:11 PM   #37
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
This has turned into a very interesting thread.

I really wish I knew more about this stuff. I know just enough to be somewhat dangerous. LOL

I already checked some pages and the script is working very well.

The directories and files are still full of spaces but it isn't that big of a deal.
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2004-06-14, 12:51 AM   #38
Entreri
WHO IS FONZY!?! Don't they teach you anything at school?
 
Join Date: Feb 2004
Posts: 42
My 2 cents

Here are my 2 cents on this thread...

1. Be sure to backup your stuff - unless you have absolute faith - before running a search-and-replace script. If you cancel the script while it is working, you might wreck one file. (Plus, without any logging or output, you cannot know which file may be messed-up)

2. The script obviously cannot strip what it doesn't know. Therefore, where you wrote the right-clicking script differently, it won't strip it. Sure, one could make the regular expression a bit more flexible but it's troubles that could be avoided.

Here are two suggestions to avoid those problems in the future :

1. If you gotta use Javascript, you might consider using *one* centralized included javascript. In our situation, you could have modified the javascript in question at will or it would make a single line to search-and-strip in all your files.

Ex.

Code:
<SCRIPT language=javascript src=http://blah/blockrightclick.js></SCRIPT>
2. Or, you could add comments that act as tags around code to clearly identify those blocks.

Code:
<!-- RightClickStart  --> 
<script>

my script to block right-click here 

</script>
<!-- RightClickEnd  -->
Then, if you think one of the files does not use the same block of code, or you want to modify the block of code, or remove it altogether, those tags make it very easy to do so.

Entreri.
Entreri is offline   Reply With Quote
Old 2004-06-14, 07:30 AM   #39
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
Yeah I made a tarball of the whole site before running this just incase something went horribly wrong.

As for the code I would never do something like this. This whole site was done in FrontPage with the server extensions by someone that had no idea what they were doing over 6 years.

I've looked through many of the pages and have yet to find any pages with this code still in them so it looks like this worked extremely well.
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2004-06-17, 10:25 PM   #40
Rorschach
Shut up brain, or I'll stab you with a Q-tip!
 
Rorschach's Avatar
 
Join Date: Nov 2003
Posts: 115
*cough*

man sed
Rorschach is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:35 AM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc