[29409] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 653 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 15 16:10:04 2007

Date: Sun, 15 Jul 2007 13:09:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 15 Jul 2007     Volume: 11 Number: 653

Today's topics:
    Re: Does my JAPH suck? (Randal L. Schwartz)
    Re: Does my JAPH suck? <spamtrap@dot-app.org>
        Download videos from YouTube, Myspace, DailyMotion...  7design@7design.hr
    Re: FAQ 4.30 How do I capitalize all the words on one l <brian.d.foy@gmail.com>
    Re: FAQ 5.6 How do I make a temporary file name? <savagebeaste@yahoo.com>
    Re: File::Find <joe@inwap.com>
        How to unambiguously escape non-printables in filenames <john.stumbles@ntlworld.com>
    Re: How to unambiguously escape non-printables in filen <noreply@gunnar.cc>
    Re: How to unambiguously escape non-printables in filen <john.stumbles@ntlworld.com>
    Re: How to unambiguously escape non-printables in filen <noreply@gunnar.cc>
        new CPAN modules on Sun Jul 15 2007 (Randal Schwartz)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 14 Jul 2007 07:19:58 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Does my JAPH suck?
Message-Id: <86ps2vjcdt.fsf@blue.stonehenge.com>

>>>>> "Peter" == Peter Wyzl <wyzelli@yahoo.com> writes:

Peter> I don't know that obfu itself is necessarily so important...  After all the
Peter> most common by the inventor himself was simply

Peter> print "Just Another Perl Hacker";

Officially, it's

print "Just another Perl hacker,"; # note the final comma

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-- 
Posted via a free Usenet account from http://www.teranews.com



------------------------------

Date: Sat, 14 Jul 2007 15:30:24 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Does my JAPH suck?
Message-Id: <m2k5t2iy0f.fsf@dot-app.org>

Michele Dondi <bik.mido@tiscalinet.it> writes:

> On Sat, 14 Jul 2007 01:19:32 GMT, "Peter Wyzl" <wyzelli@yahoo.com>
> wrote:
>
>>I don't know that obfu itself is necessarily so important...  After all the 
>>most common by the inventor himself was simply
>>
>>print "Just Another Perl Hacker";
>
> The inventor himself is of the opinion of having shot himself in the
> foot:
>
> : And this is a bit ironic, since I invented the JAPH, so I've effectively
> : created my own worst enemy here. {grin}
> : - Randal L. Schwartz in PerlMonks.

Given that his JAPHs were used as evidence against him - "Look, your honor,
he's one of those evil hackers! He brags about it!" - I can understand the
sentiment.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


------------------------------

Date: Sun, 15 Jul 2007 03:27:48 -0700
From:  7design@7design.hr
Subject: Download videos from YouTube, Myspace, DailyMotion...
Message-Id: <1184495268.464452.194460@r34g2000hsd.googlegroups.com>

Hello,

I just start my web site: www.downvideos.net.

You can download and search videos from YouTube, Myspace, Bolt,
Break.com, DailyMotion, Blip.tv, Ifilm & Google Video.

Enyoj!!



------------------------------

Date: Sat, 14 Jul 2007 19:09:58 -0500
From: brian d  foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 4.30 How do I capitalize all the words on one line?
Message-Id: <140720071909580855%brian.d.foy@gmail.com>

In article <f7ah8r.1ec.1@news.isolution.nl>, Dr.Ruud
<rvtol+news@isolution.nl> wrote:

> PerlFAQ Server schreef:
> 
> 
> > $string =~ s/ (
> >                 (^\w)    #at the beginning of the line
> >                   |      # or
> >                 (\s\w)   #preceded by whitespace
> >               )
> >            /\U$1/xg;
> 
> With a subexpression anchored to the start, the g-modifier is strange,
> but the regexp-optimizer might cope with that.

The /g is necessary to capitalize all the words, not just the first
one. It's probably better to move the edge case to the end of the
alternation, but that looks kinda odd too.

This could be two separate expressions, but it could be a lot of
things. :)

-- 
Posted via a free Usenet account from http://www.teranews.com



------------------------------

Date: Sat, 14 Jul 2007 18:37:03 -0700
From: "Clenna Lumina" <savagebeaste@yahoo.com>
Subject: Re: FAQ 5.6 How do I make a temporary file name?
Message-Id: <5ftbu9F3dkklsU1@mid.individual.net>

PerlFAQ Server wrote:
[...]
>            BEGIN {
>            use Fcntl;
>            my $temp_dir = -d '/tmp' ? '/tmp' : $ENV{TMPDIR} ||
>            $ENV{TEMP}; my $base_name = sprintf("%s/%d-%d-0000",
> $temp_dir, $$, time());
>
>            sub temp_file {
>                    local *FH;
>                    my $count = 0;
>                    until (defined(fileno(FH)) || $count++ > 100) {
>                    $base_name =~ s/-(\d+)$/"-" . (1 + $1)/e;
>                    # O_EXCL is required for security reasons.
>                    sysopen(FH, $base_name, O_WRONLY|O_EXCL|O_CREAT);
>                    }
>
>            if (defined(fileno(FH))
                                     ^^^

>                    return (*FH, $base_name);
>                }
>            else {
>                    return ();
>                }
>            }
>            }

Not sure if this has been pointed out before, but there is no opening 
{ after C< if (defined(fileno(FH)) >

-- 
CL 




------------------------------

Date: Sat, 14 Jul 2007 21:32:12 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: File::Find
Message-Id: <3fGdnadLSrPLPgTbnZ2dnUVZ_rzinZ2d@comcast.com>

Jim Gibson wrote:

> You can shorten the above 6 lines to:
> 
>   m{/}{} for @include;

   s{/}{} for @include;

> but if you really only want to remove a '/' from the first position in
> the string and not the first one in the string, as your comment
> declares, you need to anchor your search:
> 
>   m{^/}{} for @include;

   s{^/}{} for @include;


------------------------------

Date: Sun, 15 Jul 2007 09:38:11 GMT
From: John Stumbles <john.stumbles@ntlworld.com>
Subject: How to unambiguously escape non-printables in filenames
Message-Id: <7Wlmi.28120$nE2.10138@newsfe3-win.ntli.net>

I want to be able to write a list of filenames (and associated data from
stat($file)) to a text file, so I need to be able to escape any newlines in
the filenames (yes, it happens). It seems sensible then to escape all
non-printable chars, like:
sub quote_filename	{
  $_=shift or die;
  s/\\/\\\\/;		# change single backslashes to doubles
  # replace non-printable chars in filenames with backslash+hex strings
  s|([\x00-\x1f\x80-\xff])|sprintf"\\%2.2X",ord($1)|eg;
  $_;
}
So far so good, but I'm having difficulty with the reverse transformation.
sub unquote_filename	{
  $_=shift or die;
  # replace backslash+hex string with character
  s/\\([0-9a-fA-F\\]{2})/sprintf"%c",hex($1)/eg;
  s/\\\\/\\/g;	# change double backslashes back to singles
  $_
}

However what if my original (unquoted) filename contains characters
looking like an escaped hex string e.g. \0A i.e. matching
/\\[0-9a-fA-F]{2}/ ? After quote_filename it will look like \\0A and
unquote_filename will convert it to a single char preceded by a backslash.

I suspect that (a) this is a non-trivial problem (b) if there is a solution
someone else has already invented it!

Any suggestions?

-- 
John Stumbles

I used to think the brain was the most interesting part of the body
                        - until I realised what was telling me that


------------------------------

Date: Sun, 15 Jul 2007 12:52:19 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: How to unambiguously escape non-printables in filenames
Message-Id: <5fucp6F3efvpdU1@mid.individual.net>

John Stumbles wrote:
> I want to be able to write a list of filenames (and associated data from
> stat($file)) to a text file, so I need to be able to escape any newlines in
> the filenames (yes, it happens). It seems sensible then to escape all
> non-printable chars

What you are trying to do sounds very close to URI escaping.

     perldoc URI::Escape

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


------------------------------

Date: Sun, 15 Jul 2007 12:57:28 GMT
From: John Stumbles <john.stumbles@ntlworld.com>
Subject: Re: How to unambiguously escape non-printables in filenames
Message-Id: <YQomi.22214$vA3.18811@newsfe2-win.ntli.net>

On Sun, 15 Jul 2007 12:52:19 +0200, Gunnar Hjalmarsson wrote:

> John Stumbles wrote:
>> I want to be able to write a list of filenames (and associated data from
>> stat($file)) to a text file, so I need to be able to escape any newlines in
>> the filenames (yes, it happens). It seems sensible then to escape all
>> non-printable chars
> 
> What you are trying to do sounds very close to URI escaping.
> 
>      perldoc URI::Escape

Hmmm
       uri_unescape($string,...)
           Returns a string with each %XX sequence replaced with the actual byte (octet).

           This does the same as:

              $string =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;

           but does not modify the string in-place as this RE would.

$perl -e 'use URI::Escape;$a="a\tbc%xyz%2abc";$b=uri_escape($a,"\x00-\x1f\x7f-\xff");$c=uri_unescape($b);print"$a\n$b\n$c\n"'
a       bc%xyz%2abc
a%09bc%xyz%2abc
a       bc%xyz*bc

So URI escape is fooled by an occurrence of an escape sequence in the
original string.

This is hard. Maybe the only way is to use an escape character that cannot
be part of the original string. I don't know if % is allowed in URIs: if
not then URI::Escape is broken! For filenames only / is safe, but I'm
saving full pathnames not just the name of the file so I can't use it
directly as an escape char. I guess I could use // as long as I ensure the
pathname doesn't contain // before quoting.

-- 
John Stumbles

Women always generalise


------------------------------

Date: Sun, 15 Jul 2007 16:51:56 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: How to unambiguously escape non-printables in filenames
Message-Id: <5fuqqgF3cmve7U1@mid.individual.net>

John Stumbles wrote:
> Gunnar Hjalmarsson wrote:
>> John Stumbles wrote:
>>> I want to be able to write a list of filenames (and associated data from
>>> stat($file)) to a text file, so I need to be able to escape any newlines in
>>> the filenames (yes, it happens). It seems sensible then to escape all
>>> non-printable chars
>>
>> What you are trying to do sounds very close to URI escaping.
>>
>>      perldoc URI::Escape
> 
> Hmmm
>        uri_unescape($string,...)
>            Returns a string with each %XX sequence replaced with the actual byte (octet).
> 
>            This does the same as:
> 
>               $string =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
> 
>            but does not modify the string in-place as this RE would.
> 
> $perl -e 'use URI::Escape;$a="a\tbc%xyz%2abc";$b=uri_escape($a,"\x00-\x1f\x7f-\xff");$c=uri_unescape($b);print"$a\n$b\n$c\n"'
> a       bc%xyz%2abc
> a%09bc%xyz%2abc
> a       bc%xyz*bc
> 
> So URI escape is fooled by an occurrence of an escape sequence in the
> original string.

That's because you excluded '%' from the set of characters that are to 
be escaped. If you replace

     $b=uri_escape($a,"\x00-\x1f\x7f-\xff");

in your code above with

     $b=uri_escape($a,"\x00-\x1f\x7f-\xff%");

or

     $b=uri_escape($a);

it works just fine.

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


------------------------------

Date: Sun, 15 Jul 2007 04:42:17 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sun Jul 15 2007
Message-Id: <JL7EEH.1Fsv@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Algorithm-Combinatorics-0.24
http://search.cpan.org/~fxn/Algorithm-Combinatorics-0.24/
Efficient generation of combinatorial sequences 
----
Apache-AppSamurai-0.9
http://search.cpan.org/~pauldoom/Apache-AppSamurai-0.9/
An Authenticating Reverse Proxy/Application Front End 
----
Bundle-CompleteCatalyst-0.01
http://search.cpan.org/~ski/Bundle-CompleteCatalyst-0.01/
installs all Catalyst modules 
----
CPAN-1.91_52
http://search.cpan.org/~andk/CPAN-1.91_52/
query, download and build perl modules from CPAN sites 
----
DBIx-Class-0.08003
http://search.cpan.org/~mstrout/DBIx-Class-0.08003/
Extensible and flexible object <-> relational mapper. 
----
DBIx-Simple-1.31
http://search.cpan.org/~juerd/DBIx-Simple-1.31/
Easy-to-use OO interface to DBI 
----
E-Mail-Acme-822
http://search.cpan.org/~rjbs/E-Mail-Acme-822/
----
Email-MIME-Creator-1.454
http://search.cpan.org/~rjbs/Email-MIME-Creator-1.454/
Email::MIME constructor for starting anew. 
----
HTML-Template-Compiled-Plugin-LineBreak-0.01
http://search.cpan.org/~hagy/HTML-Template-Compiled-Plugin-LineBreak-0.01/
HTC Plugin to replaces any newlines with <br> HTML tags. 
----
Mail-Audit-2.220
http://search.cpan.org/~rjbs/Mail-Audit-2.220/
Library for creating easy mail filters 
----
Net-SSLeay-1.31_02
http://search.cpan.org/~flora/Net-SSLeay-1.31_02/
Perl extension for using OpenSSL 
----
POE-Component-Client-NRPE-0.03
http://search.cpan.org/~bingos/POE-Component-Client-NRPE-0.03/
a POE Component that implements check_nrpe functionality 
----
Pod-Manual-0.02
http://search.cpan.org/~yanick/Pod-Manual-0.02/
Aggregates several PODs into a single manual 
----
TAP-Parser-0.52
http://search.cpan.org/~andya/TAP-Parser-0.52/
Parse TAP output 
----
Test-WWW-Selenium-CGIApp-0.10
http://search.cpan.org/~markstos/Test-WWW-Selenium-CGIApp-0.10/
Test your CGIApp application with Selenium 
----
Text-Statistics-Arabic-0.04
http://search.cpan.org/~fernandes/Text-Statistics-Arabic-0.04/
Performs statistical corpora analysis 
----
Text-Statistics-Cyrillic-0.04
http://search.cpan.org/~fernandes/Text-Statistics-Cyrillic-0.04/
Performs statistical corpora analysis 
----
Text-Statistics-Devanagari-0.04
http://search.cpan.org/~fernandes/Text-Statistics-Devanagari-0.04/
Performs statistical corpora analysis 
----
Text-Statistics-GreekAndCoptic-0.04
http://search.cpan.org/~fernandes/Text-Statistics-GreekAndCoptic-0.04/
Performs statistical corpora analysis 
----
Text-Statistics-GreekAndCoptic-0.05
http://search.cpan.org/~fernandes/Text-Statistics-GreekAndCoptic-0.05/
Performs statistical corpora analysis 
----
Weed-0.0082
http://search.cpan.org/~hooo/Weed-0.0082/
Don't use it. It's in development. For test purposes only! 
----
XML-Grammar-Screenplay-0.0401
http://search.cpan.org/~shlomif/XML-Grammar-Screenplay-0.0401/
CPAN distribution implementing an XML grammar for screenplays. 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 653
**************************************


home help back first fref pref prev next nref lref last post