[31763] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3026 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 11 14:09:26 2010

Date: Sun, 11 Jul 2010 11:09:09 -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, 11 Jul 2010     Volume: 11 Number: 3026

Today's topics:
    Re: access to files in multiple combinations of folders <geoff@invalid.invalid>
    Re: CGI Program Questions <edgrsprj@ix.netcom.com>
    Re: CGI Program Questions <tadmc@seesig.invalid>
    Re: CGI Program Questions <jurgenex@hotmail.com>
        How to convert between a string w/ backslashes and a st <pengyu.ut@gmail.com>
    Re: How to convert between a string w/ backslashes and  <ben@morrow.me.uk>
    Re: How to convert between a string w/ backslashes and  sln@netherlands.com
    Re: How to convert between a string w/ backslashes and  <tadmc@seesig.invalid>
    Re: How to convert between a string w/ backslashes and  <hjp-usenet2@hjp.at>
    Re: How to convert link encoded by javascript command t <hjp-usenet2@hjp.at>
        Perl script permission question <cdalten@gmail.com>
    Re: Perl script permission question (Kenny McCormack)
    Re: Perl script permission question <ben@morrow.me.uk>
    Re: Perl script permission question <dmw@coder.cl>
    Re: regex Mcalpine to McAlpine <john1949@yahoo.com>
    Re: regex Mcalpine to McAlpine <ben@morrow.me.uk>
    Re: regex Mcalpine to McAlpine sln@netherlands.com
        what's the correct one? <robin1@cnsp.com>
    Re: what's the correct one? <spamtrap@shermpendley.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 10 Jul 2010 20:01:09 +0100
From: Geoff <geoff@invalid.invalid>
Subject: Re: access to files in multiple combinations of folders?
Message-Id: <bqgh3699p0s8roh2os35vh0cmitboq98p0@4ax.com>

On Tue, 29 Jun 2010 11:19:23 +0200, Martijn Lievaart
<m@rtij.nl.invlalid> wrote:

>On Fri, 11 Jun 2010 07:18:47 +0100, Geoff wrote:
>
>> On Fri, 11 Jun 2010 07:53:28 +0200, Martijn Lievaart
>> <m@rtij.nl.invlalid> wrote:
>> 
>>>On Thu, 10 Jun 2010 23:54:58 +0100, Geoff wrote:
>>>
>>>
>>>> Now I know I can have a .htaccess file in each folder but that would
>>>> mean giving user A three different user name and password
>>>> combinations, user B four different combinations.
>>>> 
>>>> 
>>>No, it doesn't. Use one htpasswd file and use the .htaccess per
>>>directory to control who has access to that directory. It's really
>>>simple, no perl or php needed. And access control using javascript is
>>>always a BAAAD idea, it is always easily circumvented.
>> 
>> Thanks Martijn,
>> 
>> Do you mean using require user A for example in following .htaccess?
>> 
>> AuthUserFile /usr/local/you/safedir/.htpasswd AuthGroupFile /dev/null
>> AuthName EnterPassword
>> AuthType Basic
>> 
>> require user A
>> 
>> 
>> For both A and B is the line
>> 
>> require user A, B
>> 
>> or something different?
>
>That is the basic idea yes. The Apache docs can be a bit confusing and 
>daunting, but it is all in there.


Martijn,

Apologies for the late reply - but thanks!

Cheers

Geoff

>
>M4


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

Date: Sun, 11 Jul 2010 03:15:24 -0500
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: CGI Program Questions
Message-Id: <LOKdnXj21vE94KTRnZ2dnUVZ_oGdnZ2d@earthlink.com>

After consulting with various parties including the ones who are running the 
Web server where I have a Web site it appears that not too many people know 
how to answer these types of questions.  So, back to the Perl Newsgroup.

Question:  Can anyone recommend a specific Perl language program that can be 
stored on a Web site where it will do the following?

---  Accept an E-mail letter sent to some address at the Web site
---  Extract attached files such as GIF picture files from the E-mail letter
---  Store those picture files in some directory at the Web site

A Perl language program would be best.  But for the moment, probably a 
program written in any language that can run at a Web site would work.  And 
again, there might be a sizeable number of Perl programs out there that can 
do that.  But there are likely just a few that people are recommending more 
than others.  For doing bulletin board work the "Movable Type" program is 
presently being evaluated.



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

Date: Sun, 11 Jul 2010 12:09:07 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: CGI Program Questions
Message-Id: <slrni3juf5.283.tadmc@tadbox.sbcglobal.net>

E.D.G. <edgrsprj@ix.netcom.com> wrote:

> Subject: Re: CGI Program Questions


You do not need a CGI program for this.

CGI programs are for responding to HTTP requests.

Nothing in your problem description leads me to believe
that there is an HTTP request anywhere that needs to be
responded to...

Please re-read RedGrittyBrick's response again. It is chock full
of good advice. If you don't understand what was said, ask a
specific question about the part that you didn't understand.


> After consulting with various parties including the ones who are running the 
> Web server where I have a Web site it appears that not too many people know 
> how to answer these types of questions.


Perhaps that is because what you request has nothing whatsoever
to do with the World Wide Web.


> Question:  Can anyone recommend a specific Perl language program that can be 
> stored on a Web site where it will do the following?

> ---  Accept an E-mail letter sent to some address at the Web site


This has nothing to do with any Web site.

This has something to do with email.

email and the www are separate services, conflating them will make
it harder for you to find a solution.

I'm not too sure what "accept" means here. Do you have a working
email system already? That is, can you send an email to the address
that you want, and then read that email?

Configuring email is not a Perl topic.


> ---  Extract attached files such as GIF picture files from the E-mail letter


That depends on how the files are attached.

Seems likely that a module with "MIME" in its name would be
helpful with that part.


> ---  Store those picture files in some directory at the Web site

    perldoc -f open
    perldoc -f binmode
    perldoc -f print


> A Perl language program would be best.  

Writing a Perl language program would be best.

Learn Perl or find someone who already knows Perl to do your job for you.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.


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

Date: Sun, 11 Jul 2010 11:08:48 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: CGI Program Questions
Message-Id: <iq1k36l55den08rbpgdf2lgoba8ddfc6c0@4ax.com>

"E.D.G." <edgrsprj@ix.netcom.com> wrote:
>After consulting with various parties including the ones who are running the 
>Web server where I have a Web site it appears that not too many people know 
>how to answer these types of questions.  

Maybe that is because of the type of question? Not many people would be
able to answer a question about how to use a bicycle to cross a white
water river, either.

>So, back to the Perl Newsgroup.
>
>Question:  Can anyone recommend a specific Perl language program that can be 
>stored on a Web site where it will do the following?
>
>---  Accept an E-mail letter sent to some address at the Web site

Extremely unlikely because email are not send to web site addresses.
They are send to email addresses which have nothing whatsoever to do
with WWW.

>---  Extract attached files such as GIF picture files from the E-mail letter

Check any of the MIME modules. Chances are (although there is no
guarantee) that the email client used MIME encoding for the attachement.

>---  Store those picture files in some directory at the Web site

Where is the problem? Doesn't open() and print() work (depeding on your
platform you may need to investigate binmode()? 

jue


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

Date: Sat, 10 Jul 2010 16:48:13 -0700 (PDT)
From: Peng Yu <pengyu.ut@gmail.com>
Subject: How to convert between a string w/ backslashes and a string w/  special characters?
Message-Id: <2bba7ed2-6c9a-486e-b496-625093fda7a9@d8g2000yqf.googlegroups.com>

Suppose I have a string $x='\t\n', I want to convert it to $y="\t\n".
I also want to convert $y back to $x. I have googled. But I haven''t
any related function, maybe because I didn't use the right search
keywords. Would you please let me know what functions I can use to do
the conversions?


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

Date: Sun, 11 Jul 2010 01:22:11 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: How to convert between a string w/ backslashes and a string w/  special characters?
Message-Id: <jefng7-qas.ln1@osiris.mauzo.dyndns.org>


Quoth Peng Yu <pengyu.ut@gmail.com>:
> Suppose I have a string $x='\t\n', I want to convert it to $y="\t\n".
> I also want to convert $y back to $x. I have googled. But I haven''t
> any related function, maybe because I didn't use the right search
> keywords. Would you please let me know what functions I can use to do
> the conversions?

String::Escape, Encode::Escape.

Ben



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

Date: Sun, 11 Jul 2010 09:53:02 -0700
From: sln@netherlands.com
Subject: Re: How to convert between a string w/ backslashes and a string w/ special characters?
Message-Id: <ovsj36tasi2a2v7oi4djr6msoi6aa0j3gl@4ax.com>

On Sat, 10 Jul 2010 23:55:55 -0500, Tad McClellan <tadmc@seesig.invalid> wrote:

>Peng Yu <pengyu.ut@gmail.com> wrote:
>
>> Suppose I have a string $x='\t\n', I want to convert it to $y="\t\n".
>
>--------------------
>#!/usr/bin/perl
>use warnings;
>use strict;
>
>$_ = q($x='\t\n');
>tr/x'/y"/;
>print "$_\n";
>--------------------

He has a string, it has a known value, its a constant.
Any conversion can't be treated programatically if the
new value is known and constant. Therefore, transliterate
is overkill, conceptually wrong, and slow.

The only answer is:

$string = q($x='\t\n');
$string = q($y="\t\n");

-sln


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

Date: Sat, 10 Jul 2010 23:55:55 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: How to convert between a string w/ backslashes and a string w/ special characters?
Message-Id: <slrni3ijgb.tcs.tadmc@tadbox.sbcglobal.net>

Peng Yu <pengyu.ut@gmail.com> wrote:

> Suppose I have a string $x='\t\n', I want to convert it to $y="\t\n".

--------------------
#!/usr/bin/perl
use warnings;
use strict;

$_ = q($x='\t\n');
tr/x'/y"/;
print "$_\n";
--------------------


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.


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

Date: Sun, 11 Jul 2010 11:14:55 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: How to convert between a string w/ backslashes and a string w/ special characters?
Message-Id: <slrni3j2sf.sug.hjp-usenet2@hrunkner.hjp.at>

On 2010-07-11 04:55, Tad McClellan <tadmc@seesig.invalid> wrote:
> Peng Yu <pengyu.ut@gmail.com> wrote:
>> Suppose I have a string $x='\t\n', I want to convert it to $y="\t\n".
>
> --------------------
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> $_ = q($x='\t\n');
> tr/x'/y"/;
> print "$_\n";
> --------------------

From the posting guidelines:

|    Speak Perl rather than English, when possible
|        Perl is much more precise than natural language. Saying it in Perl
|        instead will avoid misunderstanding your question or problem.
|
|        Do not say: I have variable with "foo\tbar" in it.
|
|        Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
|        or I have $var = <DATA> (and show the data line).

I think Yu was folling your advice here.

	hp



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

Date: Sat, 10 Jul 2010 20:15:35 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: How to convert link encoded by javascript command to the actual url?
Message-Id: <slrni3he67.ivs.hjp-usenet2@hrunkner.hjp.at>

On 2010-07-10 17:29, Peng Yu <pengyu.ut@gmail.com> wrote:
> Suppose I see a webpage on a website that has the following link
> encoded by javascript, I want to user perl to parse such webpage and
> convert it to the actual url. Could you please let me know what
> package I should use? I thought that HTML package may not handle this.
> But please let me know if I'm wrong.
>
><a herf="javascript:some_command_return_a_url();">Link</a>

I would start at
http://search.cpan.org/search?query=javascript&mode=all

	hp


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

Date: Sat, 10 Jul 2010 17:07:18 -0700 (PDT)
From: Chad <cdalten@gmail.com>
Subject: Perl script permission question
Message-Id: <0e0440e7-821a-4949-91b0-6930159e5c36@k1g2000prl.googlegroups.com>

The question stems from an IRSSI irc client scripting tutorial site
found at the following URL...

http://juerd.nl/site.plp/irssiscripttut

"Because Irssi scripts are embedded in Irssi and not executed from the
console, they do not need to be executable. A permission mode setting
of 600 is enough for scripts in your home directory, 644 is enough for
system wide script installations. The shebang line is not required, as
this is only the case for executable scripts. "

How can a script actually run if it isn't executable?


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

Date: Sun, 11 Jul 2010 00:25:41 +0000 (UTC)
From: gazelle@shell.xmission.com (Kenny McCormack)
Subject: Re: Perl script permission question
Message-Id: <i1b325$ggo$1@news.xmission.com>

In article <0e0440e7-821a-4949-91b0-6930159e5c36@k1g2000prl.googlegroups.com>,
Chad  <cdalten@gmail.com> wrote:
>The question stems from an IRSSI irc client scripting tutorial site
>found at the following URL...
>
>http://juerd.nl/site.plp/irssiscripttut
>
>"Because Irssi scripts are embedded in Irssi and not executed from the
>console, they do not need to be executable. A permission mode setting
>of 600 is enough for scripts in your home directory, 644 is enough for
>system wide script installations. The shebang line is not required, as
>this is only the case for executable scripts. "
>
>How can a script actually run if it isn't executable?

Many possibilities.  The most straightforward is if it is executed as:

	perl yourscript.pl

-- 
"We should always be disposed to believe that which appears to us to be
white is really black, if the hierarchy  of the church so decides." 

    - Saint Ignatius Loyola (1491-1556) Founder of the Jesuit Order -



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

Date: Sun, 11 Jul 2010 01:26:14 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Perl script permission question
Message-Id: <6mfng7-qas.ln1@osiris.mauzo.dyndns.org>

[f'ups set to clpmisc]

Quoth Chad <cdalten@gmail.com>:
> The question stems from an IRSSI irc client scripting tutorial site
> found at the following URL...
> 
> http://juerd.nl/site.plp/irssiscripttut
> 
> "Because Irssi scripts are embedded in Irssi and not executed from the
> console, they do not need to be executable. A permission mode setting
> of 600 is enough for scripts in your home directory, 644 is enough for
> system wide script installations. The shebang line is not required, as
> this is only the case for executable scripts. "
> 
> How can a script actually run if it isn't executable?

You can run any script you can read with

    % perl script

Perl doesn't check if the script is executable or not. Irssi does
something similar, except it passes the script to its embedded perl
interpreter rather than executing /usr/bin/perl.

The *only* time a script needs to be executable is when it has a #! line
and you want to invoke it as

    % script

or

    % ./script

rather than explicitly invoking perl.

Ben



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

Date: Sun, 11 Jul 2010 08:41:53 -0400
From: Daniel Molina Wegener <dmw@coder.cl>
Subject: Re: Perl script permission question
Message-Id: <8sKdnXqApd6OIaTRnZ2dnUVZ_uidnZ2d@giganews.com>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA512

On Sáb 10 Jul 2010 20:07,
Chad wrote:

> The question stems from an IRSSI irc client scripting tutorial site
> found at the following URL...
> 
> http://juerd.nl/site.plp/irssiscripttut
> 
> "Because Irssi scripts are embedded in Irssi and not executed from the
> console, they do not need to be executable. A permission mode setting
> of 600 is enough for scripts in your home directory, 644 is enough for
> system wide script installations. The shebang line is not required, as
> this is only the case for executable scripts. "
> 
> How can a script actually run if it isn't executable?

  As many dynamic languages today, Perl is an embedable language, so
you can examine your perl documentation using:

  $ perldoc perlembed

  And take wider look on how to embed Perl into other applications,
such as Irssi. In other words, Perl and other dynamic languages, can
be embeded as a component of your application.

Best regards,
- -- 
Daniel Molina Wegener <dmw [at] coder [dot] cl>
System Programmer & Web Developer
Phone: +56 (2) 979-0277 | Blog: http://coder.cl/
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQIcBAEBCgAGBQJMObwRAAoJEHxqfq6Y4O5NCmoQAJcSju4uP78cXtrH5rHjMd1x
ifqIIUtsaOq4DW8lzEohEeLAqsuRPLZ2edUUaTR69O5AhiG3ImB0wZIbVLN60wKm
C9Er1pLJKPNo4nZhylQJrMkRIbmG+lv4dDbAf4Hs6o0X/ilc7cYUiSqDbktHVjRZ
/ZY6tqkZOMxgzZBDun0N/STLZY2Cww9mnUNM0ViSMj7v/H6bopWVM0neBG0GxaVQ
ouDbEAdb5eK7LItgvHE8+QEPjp6OMyTmuyldtEWCmmSKvoI2ErHrrhfa7A5vF+ZD
E7kO+29jfgtPe+NzddN+qOC7tFUu/+9kYI0E5RJ/cq6kGmWxa+TAiChquApNhNPL
z56DMdxNxfhiji2GP7av5y9Ei1Y8UHv/2yPCA41wnSuxPIpW4Zy3Q95ZWMf3d6ny
f1dQKhTWtEnM8rlTGjXoRnYcJzc8H+BdBVEll5I670zdPm9qxBy1EBsaBtB3kC7i
nj9PXOUlAoyBRS81fbsgqztFv1+zp5I4LeVHqAuaIItNylIA2i/vP+k3Oq3LJmTP
A8rulvdj+zycbDj6zhu3xGVkKcamnAdMqv3jUmhmzL5MzXVPdyZMPxMZS6OOebWu
8jALGR6F/hYJC0eHDGxCUZlARiSYQMEZGmfUQDxwOF/Afhbs+b4X1Nujsdbe8WKv
hX176R7RJWZ6UzWmHNgb
=9Ct2
-----END PGP SIGNATURE-----



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

Date: Sun, 11 Jul 2010 09:58:13 +0100
From: "John" <john1949@yahoo.com>
Subject: Re: regex Mcalpine to McAlpine
Message-Id: <i1c133$ih5$1@news.albasani.net>

Thank you gentlemen.

That was very useful.

I can use either \u without e modifer or uc($1) with e modifier.

Thanks for pointing out the [a-z] error.

I had realised machine and macro need to be checked.  There are other less 
important words that would be trapped.

Appereciate your input.  Thank you.

Regards
John





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

Date: Sun, 11 Jul 2010 12:16:41 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: regex Mcalpine to McAlpine
Message-Id: <pplog7-0331.ln1@osiris.mauzo.dyndns.org>


Quoth Tad McClellan <tadmc@seesig.invalid>:
> 
> So then,
> 
>     s/\bMc([a-z])/Mc\U$1/;
> or
>     s/(?<=\bMc)([a-z])/\U$1/;
> 
> 
> Good luck getting MacArthur from Macarthur without also getting
> MacHine from Machine...

    s/(?<=\bMac)(?!h)([a-z])/\U$1/;

obviously...

Ben



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

Date: Sun, 11 Jul 2010 10:09:02 -0700
From: sln@netherlands.com
Subject: Re: regex Mcalpine to McAlpine
Message-Id: <5guj36tasi2a2v7oi4djr6msoi6aa0j34t@4ax.com>

On Sun, 11 Jul 2010 12:16:41 +0100, Ben Morrow <ben@morrow.me.uk> wrote:

>
>Quoth Tad McClellan <tadmc@seesig.invalid>:
>> 
>> So then,
>> 
>>     s/\bMc([a-z])/Mc\U$1/;
>> or
>>     s/(?<=\bMc)([a-z])/\U$1/;
>> 
>> 
>> Good luck getting MacArthur from Macarthur without also getting
>> MacHine from Machine...
>
>    s/(?<=\bMac)(?!h)([a-z])/\U$1/;
>
>obviously...
>
?? What about Machenderson ??
I think Mc... is a little easier to "divine" than Mac...
Either way, a list of valid names would have to be used.
The point is moot.

-sln


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

Date: Sun, 11 Jul 2010 03:01:46 -0700 (PDT)
From: Robin <robin1@cnsp.com>
Subject: what's the correct one?
Message-Id: <c9338513-20b9-4957-96b7-1edb97ef59c5@j8g2000yqd.googlegroups.com>

I want to know how to it is a simple question, but hard to answer, how
can I get cpan to work on windows 7, I don't have nmake and can't get
it to work on win7 how do I emulate make it doesn't work with gnu mak
also.
-rob


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

Date: Sun, 11 Jul 2010 12:19:57 -0400
From: Sherm Pendley <spamtrap@shermpendley.com>
Subject: Re: what's the correct one?
Message-Id: <m27hl29ej6.fsf@shermpendley.com>

Robin <robin1@cnsp.com> writes:

> I want to know how to it is a simple question, but hard to answer, how
> can I get cpan to work on windows 7

Have a look at Strawberry Perl:

  <http://strawberryperl.com/>

From <http://www.cpan.org/ports/#win32>:

  "A 100% Open Source CPAN-capable Perl for Windows that works exactly
   the same as Perl everywhere else (includes Perl for Win32, MinGW,
   dmake, CPAN preconfigured, libwin32, Win32::API, PPM, PAR, Expat/
   XML::Parser)."

sherm--

-- 
Sherm Pendley                <www.shermpendley.com>
                             <www.camelbones.org>
Cocoa Developer


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

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:

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

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 3026
***************************************


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