Keith C. Ivey [EMAIL PROTECTED] schrieb im Newsbeitrag
3D20DD6E.24532.1A2D7FCB@localhost">news:3D20DD6E.24532.1A2D7FCB@localhost...
Steffen Mueller [EMAIL PROTECTED] wrote:
I hope I'm not drifting into the unfun territory, but how come
YAPC::Europe can afford to take 89EUR whereas American
On Mon, Jul 01, 2002 at 05:43:52PM +, sara starre wrote:
1) I don't think my code was obfuscated. It certainly wasn't
intended to.
2) I will never ever be at a Perl conference where they charge
over $1000 entrance fee and hundreds more for tutorials.
I'd be
On Tue, 2 Jul 2002, Abigail wrote:
As for beer, well, I don't drink alcohol anyway.
Unless you do drugs there goes the only thing I could think of to explain
some of your JAPHs. ;-)
Cheers,
Bernard
--
echo 42|perl -pe '$#=Just another Perl hacker,'
From: Abigail [EMAIL PROTECTED]
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: Maybe-useful subroutine (BETTER!)
Date: Tue, 2 Jul 2002 05:06:04 -0700
..
..
..
There isn't much going on here. '$#' followed by a name of an array gives
you the index of the last element. '@' followed
Unfortunally, I left out a '-1'. Here's the right version:
#!/usr/bin/perl -w
use strict;
use warnings 'all';
sub rotate {
return () unless $_ [1];
die Not an array ref unless ARRAY eq ref $_ [1];
return [] unless {$_ [1]};
my $l = $_ [0] % {$_ [1]};
[@{$_ [1]} [$l ..
From: Abigail [EMAIL PROTECTED]
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: Maybe-useful subroutine (BETTER!)
Date: Mon, 1 Jul 2002 08:37:42 -0700
Unfortunally, I left out a '-1'. Here's the right version:
#!/usr/bin/perl -w
use strict;
use warnings 'all';
.
.
.
Well
Yet Another *::Util Plug:
Scalar::Util::reftype finds the underlying type even for objects.
(Unfortunately for non-refs it returns undef instead of '' as the
builtin ref does.)
In article [EMAIL PROTECTED],
Abigail [EMAIL PROTECTED] wrote:
#!/usr/bin/perl -w
use strict;
use warnings 'all';
[EMAIL PROTECTED] (Yitzchak Scott-Thoennes) wrote:
I didn't think that was obfuscated.
How about this:
sub rotate {[$#{$_[!$||$|]}*@{$_[!!$_^!$_]}?@{$_[!$..!!$.]}[$_[@--@+]%@
{$_[$==~/(?=)//!$`]}..$#{$_[$??!!$?:!$?]},($)?!$):!!$))..$_[$--$-]%@{$_
[$]/$]]}-(!!$++!$+)]:@{$_[!!$^^^!$^^]}]}
In article [EMAIL PROTECTED],
sara starre [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] (Yitzchak Scott-Thoennes) wrote:
I didn't think that was obfuscated.
How about this:
sub rotate {[$#{$_[!$||$|]}*@{$_[!!$_^!$_]}?@{$_[!$..!!$.]}[$_[@--@+]%@
On Thu, Apr 18, 2002 at 06:21:52AM +0200, Paul Johnson wrote:
On Wed, Apr 17, 2002 at 07:59:22PM -0400, Michael G Schwern wrote:
Just because the safety is on doesn't mean you should juggle handguns.
Never know whose foot it'll blow off.
Awww. You're no fun.
*bang*
--
Michael G.
Michael G Schwern [mailto:[EMAIL PROTECTED]] wrote:
On Thu, Apr 18, 2002 at 06:21:52AM +0200, Paul Johnson wrote:
On Wed, Apr 17, 2002 at 07:59:22PM -0400, Michael G Schwern wrote:
Just because the safety is on doesn't mean you should juggle handguns.
Never know whose foot it'll blow
Michael G Schwern [EMAIL PROTECTED] schrieb im Newsbeitrag
20020417205231.GV851@blackrider">news:20020417205231.GV851@blackrider...
| On Wed, Apr 17, 2002 at 12:28:37PM -0700, Rick Klement wrote:
| There's already a %dispatch set up for you by perl...
|
| I'd have used it but it just fell into
On Wed, Apr 17, 2002 at 02:02:02PM -0400, Bill -Sx- Jones wrote:
I have the habit of doing:
last if (substr($vFlag, 1, 3) eq 'END');
$vSub = \Sneex if (substr($vFlag, 1, 5) eq 'SNEEX');
$vSub = \Admin if (substr($vFlag, 1, 5) eq 'ADMIN');
$vSub = \Reports if (substr($vFlag, 1,
[EMAIL PROTECTED] wrote:
On Wed, Apr 17, 2002 at 02:02:02PM -0400, Bill -Sx- Jones wrote:
I have the habit of doing:
last if (substr($vFlag, 1, 3) eq 'END');
$vSub = \Sneex if (substr($vFlag, 1, 5) eq 'SNEEX');
$vSub = \Admin if (substr($vFlag, 1, 5) eq 'ADMIN');
$vSub
');
$vSub = \Targets if (substr($vFlag, 1, 7) eq 'TARGETS');
$vSub = \Usenet if (substr($vFlag, 1, 6) eq 'USENET');
(substr($_, 0, 1) eq '[') ? next : $vSub;
(NOTE: Obviously NOT all of the 668 lines of program code
is here, so this doesn't stand on it's own two feet...)
Q: Is there a better
on it's own two feet...)
Q: Is there a better way?
Use a hash as a jump table, with the keys
being what you extract and the values being
subs. If the string is regex-able then
something like:
my %jumpz =
(
SNEEX = \sneez,
...
);
...
my ($name) = $vflag
is here, so this doesn't stand on it's own two feet...)
Q: Is there a better way?
The above implies the format is something like:
SNEEXADMINEND
in which case, suicide is an honorable option.
Adding in some sort of delimiter:
SNEEX|ADMIN|END
and then you can just split
suicide is an honorable option.
croak $$: The uers are idiots!
unless $api eq makes sense;
Adding in some sort of delimiter:
SNEEX|ADMIN|END
my %jumpz =
(
SNEEX = \foo,
ADMIN = \bar,
...
);
my $regex = join '|', keys %jumpz;
if( my ($name) = $vflag =~
On 4/17/02 2:22 PM, Michael G Schwern [EMAIL PROTECTED] wrote:
The above implies the format is something like:
SNEEXADMINEND
in which case, suicide is an honorable option.
:)
Actually, the input data looks more like
[SNEEX]
[ADMIN]
[END]
Sorry for the mass hysteria;
Actually, the input data looks more like
[SNEEX]
[ADMIN]
[END]
my $regex = '\b(' . join('|', keys %jumpz) . ')\b';
if( my ($name) = $foo =~ /$regex/o )
{
my $sub = $jumpz{$name};
...
}
Sorry for the mass hysteria;
What hysteria? Hysteria? Oh, no...
On Wed, Apr 17, 2002 at 02:34:20PM -0400, Bill -Sx- Jones wrote:
On 4/17/02 2:22 PM, Michael G Schwern [EMAIL PROTECTED] wrote:
The above implies the format is something like:
SNEEXADMINEND
in which case, suicide is an honorable option.
:)
Actually, the input data looks
On Wed, 17 Apr 2002 15:01:50 -0400, Michael G Schwern wrote:
On Wed, Apr 17, 2002 at 02:34:20PM -0400, Bill -Sx- Jones wrote:
Actually, the input data looks more like
[SNEEX]
[ADMIN]
[END]
# setup %Dispatch as before, then...
while( $vData =~ /\[([A-Z])\]/g ) {
-- Michael G Schwern [EMAIL PROTECTED]
On Wed, Apr 17, 2002 at 12:28:37PM -0700, Rick Klement wrote:
There's already a %dispatch set up for you by perl...
I'd have used it but it just fell into the gaping security hole.
A recent Phrack article pointed out that one of the SOAP/RPC/XML
On Wed, Apr 17, 2002 at 04:38:50PM -0500, Steven Lembark wrote:
A recent Phrack article pointed out that one of the SOAP/RPC/XML
modules was doing this:
$soap-$tainted_method_name(@args);
Use -T and untaint by extracting the subname:
my $flag = ::$input =~ /\w+$/;
Michael G Schwern wrote:
On Wed, Apr 17, 2002 at 12:28:37PM -0700, Rick Klement wrote:
There's already a %dispatch set up for you by perl...
I'd have used it but it just fell into the gaping security hole.
A recent Phrack article pointed out that one of the SOAP/RPC/XML
modules was
On Wed, Apr 17, 2002 at 04:16:08PM -0700, Rick Klement wrote:
Notice that the regex match (which should have been /\[([A-Z]+)\]/ )
effectively untaints and closes the security hole by disallowing
anything through that is not [A-Z]+
This is still too lenient, you've just narrowed the possible
');
$vSub = \Targets if (substr($vFlag, 1, 7) eq 'TARGETS');
$vSub = \Usenet if (substr($vFlag, 1, 6) eq 'USENET');
(substr($_, 0, 1) eq '[') ? next : $vSub;
(NOTE: Obviously NOT all of the 668 lines of program code
is here, so this doesn't stand on it's own two feet...)
Q: Is there a better way
On Wed, Apr 17, 2002 at 09:01:37PM -0400, Aaron D. Marasco wrote:
I like something like this, where the sub name is is sub_KEYWORD (from a
CGI, hopefully you can extract usefulness):
eval sub_.param('page') if (param defined param('page') defined
sub_.param('page'));
The last clause
On Wed, Apr 17, 2002 at 07:59:22PM -0400, Michael G Schwern wrote:
Just because the safety is on doesn't mean you should juggle handguns.
Never know whose foot it'll blow off.
Awww. You're no fun.
--
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net
On Fri, Jan 25, 2002 at 11:31:37AM -0600, [EMAIL PROTECTED] wrote:
Greetings, On Friday, January 25, 2002, at 10:56 AM,
[EMAIL PROTECTED] wrote:
/[fF][oO][oO]/ better than /foo/i
That'd be Mr. RE Jeffrey Freidl in the Mastering RE/Owl book.
The parser
has to do less backtracking
Greetings, On Friday, January 25, 2002, at 10:56 AM,
[EMAIL PROTECTED] wrote:
/[fF][oO][oO]/ better than /foo/i
That'd be Mr. RE Jeffrey Freidl in the Mastering RE/Owl book.
The parser
has to do less backtracking or something.
I have to disagree; while I have read the RE/Owl (I hear
Bill -OSX- Jones wrote:
Greetings, On Friday, January 25, 2002, at 10:56 AM,
[EMAIL PROTECTED] wrote:
/[fF][oO][oO]/ better than /foo/i
That'd be Mr. RE Jeffrey Freidl in the Mastering RE/Owl book.
The parser
has to do less backtracking or something.
I have to disagree; while
On Jan 25, Bill -OSX- Jones said:
Greetings, On Friday, January 25, 2002, at 10:56 AM,
[EMAIL PROTECTED] wrote:
/[fF][oO][oO]/ better than /foo/i
That'd be Mr. RE Jeffrey Freidl in the Mastering RE/Owl book.
The parser
has to do less backtracking or something.
I have to disagree
On Jan 25, Bill -OSX- Jones said:
$_ = a planet of Perl Fun;
for $y(qw/a e f l n o p r t u/){$x||=y/$y//%2; print $y $x \n}
What is $x being set to and why ?
$x is going to be zero for all of them, because $_ does not contain any
_'s or y's.
--
Jeff japhy Pinyan [EMAIL PROTECTED]
*
should know better.
(Besides, I realize I am not good enough to win on my own efforts,
I just had a fever in that I *felt* s close but could not get
past even sets of vowels, IE merlyn. And besides, posting did
confuse or dismay some potential beginners postings - plus what I
posted was WRONG
On Fri, Jan 25, 2002 at 12:50:54PM -0500, Bill -OSX- Jones wrote:
So, to come back, allow me to ask:
$_ = a planet of Perl Fun;
for $y(qw/a e f l n o p r t u/){$x||=y/$y//%2; print $y $x \n}
What is $x being set to and why ?
Nothing interesting, as y/// doesn't extrapolate. Try
You guys are waayyy to fast :)
Nothing interesting, as y/// doesn't extrapolate.
Where does a knuckle draggin' neanderthal go to evolve around here?
:)
_Sx
('-Sx- IUDICIUM
//\ Have Computer -
v_/_Will Hack...
Bill -OSX- Jones wrote:
You guys are waayyy to fast :)
Nothing interesting, as y/// doesn't extrapolate.
Where does a knuckle draggin' neanderthal go to evolve around here?
:)
_Sx
('-Sx- IUDICIUM
//\ Have Computer -
v_/_Will Hack...
: Bill -OSX- Jones [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: Better ?
You guys are waayyy to fast :)
Nothing interesting, as y/// doesn't extrapolate.
Where does a knuckle draggin' neanderthal go to evolve around here?
:)
_Sx
('-Sx- IUDICIUM
-
| /[fF][oO][oO]/ better than /foo/i
The /i penalty had nothing to do with backtracking, but with making an
extra copy of the target string. If the target string was short, it wasn't
really much of an issue. It's described on p278.
Once the book came out, it (and many other bugs) were fixed
$c = grep {/[osx]/i} @_;
Is there a better way?
_Sx
('-Sx- IUDICIUM
//\ Have Computer -
v_/_Will Hack...
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Thursday, January 24, 2002, at 10:14 , Bill -OSX- Jones wrote:
$c = grep {/[osx]/i} @_;
Is there a better way?
To do... what?
- --
Craig S. Cottingham
[EMAIL PROTECTED]
PGP key available from:
http://pgp.ai.mit.edu:11371/pks/lookup?op
On Thu, Jan 24, 2002 at 11:24:47AM -0500, Bill -OSX- Jones wrote:
$c = grep {/[osx]/i} @_;
Is there a better way?
To do... what?
Sorry -
Given:
$_ = Mac OS X;
split //;
$c = grep {/[osx]/i} @_;
Regardless, the {} there is redundant and actually slows you down a
bit (Perl has
element which isn't
cheap and its not smart enough to optimize it out.
But you can't just take them off since you'd need to put a comma in
then:
$c = grep /[osx]/i, @_;
or perhaps even
$c = grep /[osxOSX]/, @_;
ISTR someone saying that matching /[fF][oO][oO]/ was better than /foo/i
44 matches
Mail list logo