[30858] in Perl-Users-Digest
Perl-Users Digest, Issue: 2103 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 8 03:09:46 2009
Date: Thu, 8 Jan 2009 00:09:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 8 Jan 2009 Volume: 11 Number: 2103
Today's topics:
Re: mail address validation <g_m@remove-comcast.net>
Re: mail address validation <stoupa@practisoft.cz>
new CPAN modules on Thu Jan 8 2009 (Randal Schwartz)
opening a file <george@example.invalid>
Re: opening a file <jurgenex@hotmail.com>
Re: opening a file <kkeller-usenet@wombat.san-francisco.ca.us>
Re: opening a file <wahab@chemie.uni-halle.de>
Re: Parsing a string into a hash <hansmu@xs4all.nl>
Re: remote invocation for any user <tim@burlyhost.com>
Re: remote invocation for any user <tim@burlyhost.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 7 Jan 2009 17:11:10 -0500
From: "~greg" <g_m@remove-comcast.net>
Subject: Re: mail address validation
Message-Id: <D4udnTv9DNGrtfjUnZ2dnUVZ_vCdnZ2d@giganews.com>
"Petr Vileta "fidokomik"" <stoupa@practisoft.cz> wrote in message news:ggrr68$1g6d$1@ns.felk.cvut.cz...
>I have read RFC822 and check groups and ansk Uncle Google but I'm still confused.
> I want to perform mail address validation as simple as possible. Strings I want to check will not look like
> "my Name" my.name@example.com
> but always will be in "simple" format
> user@domain.top
> where
> "user" is username part of address
> "domain" is domain (subdomain) part of address
> ".top" mean top level domain (e.g. country).
> I tested some CPAN modules but all work bad or I misunderstand RFC.
> For example next addresses are wrong I think
> some"strange@user@example.com
> natíonál@example.com
> (baduser]@example.com
>
> My questions are:
>
> 1) what characters are forbidden in "user" part
> 2) what characters are forbidden in "domain" part
> 3) are allowed single character top level domains, say "example.o" ?
>
> Many thanks for any explanation.
this might help a little ....
http://community.opensourcedotnet.info/blogs/computer/archive/2006/09/16/Email-Address-Format-Myths.aspx
------------------------------
Date: Thu, 8 Jan 2009 01:37:31 +0100
From: "Petr Vileta \"fidokomik\"" <stoupa@practisoft.cz>
Subject: Re: mail address validation
Message-Id: <gk3iae$1cs7$1@ns.felk.cvut.cz>
~greg wrote:
> "Petr Vileta "fidokomik"" <stoupa@practisoft.cz> wrote in message
>> My questions are:
>>
>> 1) what characters are forbidden in "user" part
>> 2) what characters are forbidden in "domain" part
>> 3) are allowed single character top level domains, say "example.o" ?
>>
>> Many thanks for any explanation.
>
>
> this might help a little ....
>
> http://community.opensourcedotnet.info/blogs/computer/archive/2006/09/16/Email-Address-Format-Myths.aspx
Thanks a lot. This is exactly what I need.
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail.
Send me your mail from another non-spammer site please.)
Please reply to <petr AT practisoft DOT cz>
------------------------------
Date: Thu, 8 Jan 2009 05:42:26 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Jan 8 2009
Message-Id: <KD516q.1Msy@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.
Audio-Extract-PCM-0.03
http://search.cpan.org/~pepe/Audio-Extract-PCM-0.03/
Extract PCM data from audio files
----
CGI-Application-Plugin-I18N-0.02
http://search.cpan.org/~cosmicnet/CGI-Application-Plugin-I18N-0.02/
I18N and L10N methods for CGI::App
----
CPAN-WWW-Testers-0.41
http://search.cpan.org/~barbie/CPAN-WWW-Testers-0.41/
Present CPAN Testers data
----
Darcs-Inventory-1.0
http://search.cpan.org/~david/Darcs-Inventory-1.0/
Read and parse a darcs version 1 or 2 inventory file
----
Darcs-Inventory-1.0.1
http://search.cpan.org/~david/Darcs-Inventory-1.0.1/
Read and parse a darcs version 1 or 2 inventory file
----
Darcs-Notify-1.0
http://search.cpan.org/~david/Darcs-Notify-1.0/
Send emails when a Darcs repository has patches added or removed
----
DateTime-Format-Atom-v1.0.1
http://search.cpan.org/~ikegami/DateTime-Format-Atom-v1.0.1/
Parse and format Atom datetime strings
----
DateTime-Format-RFC3339-v1.0.1
http://search.cpan.org/~ikegami/DateTime-Format-RFC3339-v1.0.1/
Parse and format RFC3339 datetime strings
----
Devel-NoGlobalSig-v0.0.1
http://search.cpan.org/~ewilhelm/Devel-NoGlobalSig-v0.0.1/
croak when a global %SIG is installed
----
Devel-PerlySense-0.0176
http://search.cpan.org/~johanl/Devel-PerlySense-0.0176/
Perl IDE backend with Emacs frontend
----
Directory-Transactional-0.04
http://search.cpan.org/~nuffin/Directory-Transactional-0.04/
----
EV-3.52
http://search.cpan.org/~mlehmann/EV-3.52/
perl interface to libev, a high performance full-featured event loop
----
HTML-GoogleMaps-9
http://search.cpan.org/~nmueller/HTML-GoogleMaps-9/
a simple wrapper around the Google Maps API
----
IO-Handle-Record-0.13
http://search.cpan.org/~opi/IO-Handle-Record-0.13/
IO::Handle extension to pass perl data structures
----
KiokuDB-Backend-DBI-0.06
http://search.cpan.org/~nuffin/KiokuDB-Backend-DBI-0.06/
DBI backend for KiokuDB
----
MojoMojo-0.999026
http://search.cpan.org/~mramberg/MojoMojo-0.999026/
A Catalyst & DBIx::Class powered Wiki.
----
Monotone-AutomateStdio-0.02
http://search.cpan.org/~aecooper/Monotone-AutomateStdio-0.02/
Perl interface to Monotone via automate stdio
----
MouseX-Getopt-0.03
http://search.cpan.org/~masaki/MouseX-Getopt-0.03/
A Mouse role for processing command line options
----
MouseX-Types-URI-0.01
http://search.cpan.org/~masaki/MouseX-Types-URI-0.01/
A URI type library for Mouse
----
Net-OpenSSH-0.12
http://search.cpan.org/~salva/Net-OpenSSH-0.12/
Perl SSH client package implemented on top of OpenSSH
----
Net-Twitter-1.23
http://search.cpan.org/~cthom/Net-Twitter-1.23/
Perl interface to twitter.com
----
Net-Twitter-2.00_02
http://search.cpan.org/~cthom/Net-Twitter-2.00_02/
Perl interface to twitter.com
----
Padre-Plugin-Encode-0.1.3
http://search.cpan.org/~keedi/Padre-Plugin-Encode-0.1.3/
convert file to different encoding in Padre
----
Padre-Plugin-Perl6-0.024
http://search.cpan.org/~azawawi/Padre-Plugin-Perl6-0.024/
Padre plugin for Perl6
----
Padre-Plugin-Perl6-0.025
http://search.cpan.org/~azawawi/Padre-Plugin-Perl6-0.025/
Padre plugin for Perl6
----
Parse-CPAN-Meta-0.04
http://search.cpan.org/~smueller/Parse-CPAN-Meta-0.04/
Parse META.yml and other similar CPAN metadata files
----
Spreadsheet-ParseExcel-0.43
http://search.cpan.org/~jmcnamara/Spreadsheet-ParseExcel-0.43/
Extract information from an Excel file.
----
Syntax-Highlight-Perl6-0.030
http://search.cpan.org/~azawawi/Syntax-Highlight-Perl6-0.030/
Perl 6 Syntax Highlighter
----
Sys-Mmap-Simple-0.03_3
http://search.cpan.org/~leont/Sys-Mmap-Simple-0.03_3/
Memory mapping made simple and safe.
----
Sys-Mmap-Simple-0.03_4
http://search.cpan.org/~leont/Sys-Mmap-Simple-0.03_4/
Memory mapping made simple and safe.
----
Task-Padre-Plugins-0.09
http://search.cpan.org/~fayland/Task-Padre-Plugins-0.09/
Get many Plugins of Padre at once
----
Task-Padre-Plugins-0.10
http://search.cpan.org/~fayland/Task-Padre-Plugins-0.10/
Get many Plugins of Padre at once
----
Test-SFTP-0.01
http://search.cpan.org/~xsawyerx/Test-SFTP-0.01/
An object to help test Net::SFTP
----
Test-TempDatabase-0.14
http://search.cpan.org/~bosu/Test-TempDatabase-0.14/
temporary database creation and destruction.
----
Text-Naming-Convention-0.0.6
http://search.cpan.org/~sunnavy/Text-Naming-Convention-0.0.6/
Naming or Renaming( for identifiers, mostly )
----
Text-OutputFilter-0.14
http://search.cpan.org/~hmbrand/Text-OutputFilter-0.14/
Enable post processing of output without fork
----
Time-Simple-Range-1.2
http://search.cpan.org/~zummo/Time-Simple-Range-1.2/
A range of Time::Simple objects
----
VCI-0.5.2
http://search.cpan.org/~mkanat/VCI-0.5.2/
A generic interface for interacting with various version-control systems.
----
WWW-PivotalTracker-0.13
http://search.cpan.org/~jhelwig/WWW-PivotalTracker-0.13/
Functional interface to Pivotal Tracker <http://www.pivotaltracker.com/>
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/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Wed, 7 Jan 2009 19:50:14 -0700
From: George <george@example.invalid>
Subject: opening a file
Message-Id: <1qwqvnlin69b2.hm7dfrwrclg.dlg@40tude.net>
I thought I would use perl instead of fortran to parse a text file, what
with the new m// s/// capabilities at my fingertips.
So it is that I need to open a text file and send it to STDOUT. This may
come across as a contemptable FAQ to some. I've just looked at all the
entries with the string 'file' beginning them in the index of the camel
book, and it's huge and ambiguous to a guy who is not in the native perl
environment, ie, a server, but simply needs to get a little io on windows.
This is what I have so far:
use strict;
use warnings;
my $divider= "%\n" # a percentage sign and a newline
# perl scraper1.pl
In fortran, the snippet would be:
open(unit=50,file='ehp3.txt',form='formatted')
do
read(50,*,iostat=eof) line
if (eof /= 0) exit
write(*,*) trim(line)
end do
close(unit=50)
Thanks for your comment.
--
George
It's going to be the year of the sharp elbow and the quick tongue.
George W. Bush
Picture of the Day http://apod.nasa.gov/apod/
------------------------------
Date: Wed, 07 Jan 2009 19:05:01 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: opening a file
Message-Id: <24ram45m71afffs0bv7bilf92nsq1f2fhi@4ax.com>
George <george@example.invalid> wrote:
>
>I thought I would use perl instead of fortran to parse a text file, what
>with the new m// s/// capabilities at my fingertips.
>
>So it is that I need to open a text file
perldoc -f open
>and send it to STDOUT.
perldoc -f print
>This may
>come across as a contemptable FAQ to some. I've just looked at all the
>entries with the string 'file' beginning them in the index of the camel
>book, and it's huge and ambiguous to a guy who is not in the native perl
>environment, ie, a server,
There is no relation between Perl and servers.
>but simply needs to get a little io on windows.
>
>This is what I have so far:
>
> use strict;
> use warnings;
>
>
>my $divider= "%\n" # a percentage sign and a newline
>
>
># perl scraper1.pl
>
>In fortran, the snippet would be:
I do not speak Fortran, therefore I cannot translate
Maybe you could just describe what your program is meant to achieve, aka
a spec?
jue
------------------------------
Date: Wed, 7 Jan 2009 20:57:31 -0800
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: opening a file
Message-Id: <rmdg36xa8v.ln2@goaway.wombat.san-francisco.ca.us>
On 2009-01-08, George <george@example.invalid> wrote:
>
> So it is that I need to open a text file and send it to STDOUT. This may
> come across as a contemptable FAQ to some. I've just looked at all the
> entries with the string 'file' beginning them in the index of the camel
> book, and it's huge and ambiguous to a guy who is not in the native perl
> environment, ie, a server, but simply needs to get a little io on windows.
Look at
perldoc -q 'entire file'
which has an example of both reading a file into memory, and processing
a file line-by-line.
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information
------------------------------
Date: Thu, 08 Jan 2009 09:04:21 +0100
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: opening a file
Message-Id: <gk4c20$2m39$1@nserver.hrz.tu-freiberg.de>
George wrote:
> So it is that I need to open a text file and send it to STDOUT. This may
> come across as a contemptable FAQ to some. I've just looked at all the
> entries with the string 'file' beginning them in the index of the camel
> book, and it's huge and ambiguous to a guy who is not in the native perl
> environment, ie, a server, but simply needs to get a little io on windows.
>
> This is what I have so far:
> use strict;
> use warnings;
> my $divider= "%\n" # a percentage sign and a newline
Whats meant by 'divider'. Is this the
'input record seperator'. Your fortran
example doesn't give a hint.
> In fortran, the snippet would be:
> open(unit=50,file='ehp3.txt',form='formatted')
> do
> read(50,*,iostat=eof) line
> if (eof /= 0) exit
> write(*,*) trim(line)
> end do
> close(unit=50)
This is the closest I could get (under strict):
open(50, '<ehp3.txt');
DO:
{ my $line = readline(*50);
if(eof != 0) { exit }
print $line; # no 'write' here
redo DO } # no 'end' possible
close(50)
This is, of course, just for fun and not
really useful ;-) But it works.
The real "perlish" approach to this
problem is already given in the other
responses to your question.
Regards
M.
------------------------------
Date: Thu, 08 Jan 2009 01:27:04 +0100
From: Hans Mulder <hansmu@xs4all.nl>
Subject: Re: Parsing a string into a hash
Message-Id: <4965497b$0$198$e4fe514c@news.xs4all.nl>
IanW wrote:
> Can each individual string be parsed into %hash in one line
Creating one-liners in Perl is easy.
Just apply this to your script:
#!/usr/bin/perl
$_=<>;if(/^#!/){print;$_='';}undef$/;$_.=<>;
s/([\$\@\\#])/\\$1/g;s/\n/\\n/g;print"eval qq#$_#;\n";
It'll produce a one-liner version of your script.
Readability not included.
Disclaimer: I didn't write this thing myself; I just found it
on Usenet. I think is was originally written by Larry Wall.
-- HansM
------------------------------
Date: Wed, 07 Jan 2009 13:19:05 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: remote invocation for any user
Message-Id: <e%89l.15264$Ou7.14818@newsfe24.iad>
james.bruckmann@yahoo.com wrote:
> On Jan 7, 6:57Â pm, Tim Greer <t...@burlyhost.com> wrote:
>> james.bruckm...@yahoo.com wrote:
>> > Hello perl gurus,
>>
>> > I have a big problem with the following program:
>> > DCC.pl
>> > ...
>> > $cmd = "ssh  operator\@192.168.12.12 /usr/local/bin/CCD.pl $IP
>> > $user \n";
>> > system($cmd);
>>
>> > It works perfectly, for the operator user. It invokes on another
>> > box the specified program CCD.pl with the correct parameters. Both
>> > boxes are Sun running Solaris 8 and openssh. and I have ran
>> > ssh-keygen -t rsa to generate pub and private keys and used these
>> > to enusre that ssh works without a password.
>>
>> > The two parameters are entered by the user in a GUI over which I
>> > dont have a lot of control.
>>
>> > The _big_ problem is that lots of different users need to log into
>> > the GUI and this remote invocation only works for the operator
>> > user.
>>
>> > If you have an idea on a possible solution then please post it!!
>>
>> > TIA
>>
>> > James
>>
>> How is it failing for the other (non operator) users? Â Did you test
>> this from a non operator user's shell to rule out this being a Perl
>> related issue? Â Are you sure you don't want to enclose the command
>> and arguments in double quotes for the ssh call? Â Are you sure you
>> want to allow any user access to blindly pass a command over a
>> trusted SSH key to another server, where your code looks like it'll
>> allow them to break out of that command and pass other commands and
>> arguments? Â I.e., "/pah/to/program argument; /bin/rm -rf /" (as an
>> example). Â I hope you're doing some sanity and security checks if you
>> are going to let just anyone enter commands and arguments.
>> --
<please don't quote signatures>
>>
>> - Show quoted text -
>
> Thanks for your interest!
>>How is it failing for the other (non operator) users?
> It just hangs the gui.
>>Did you test this from a non operator user's shell to rule out this
>>being a Perl related issue?
> I did invoke DCC.pl from the shell that hangs too.
So it hangs regardless of the GUI or executing the script in shell. To
be clear, did you run the command outside of the Perl script in shell
to execute it on the other server? How about running it from another
shell (such as the operator user, if that user has an account/shell
access)?
>> Are you sure you don't want to enclose the command and arguments in
>> double quotes for the ssh call?
> hmmm backslashed double quotes, it would neeed I guess, I could do
> that, but it works OK without, at least for the operator user.
Escaping with a backslash probably won't do what you think it'll do.
>>Are you sure you want to allow any user access to blindly pass a
>>command over a trusted SSH key to another server,
> Good question, but yes I am sure, users dont normally have access to
> the command line, and if they had baad intent as a non-root user they
> could pose more of a risk on the originating box than the target box -
> and actually there is only a few users - and they are the good
> guys ;-).
> so I really do want any user to be able to use the functionality.
That sounds dangerous. If you allow system() to run anything any user
on a GUI can pass to it, it risks the local account, as well as the
remote one, since you are invoking an SSH (with a trusted key) to log
in and run God knows what commands on the remote system as well. I'm
simply encouraging you to be cautious, not just for your sake, but
because you can open your system to be the source of attacks on other
networks, if you are able to connect out from either of those systems
(and then it becomes the problem of other people, too).
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
Date: Wed, 07 Jan 2009 13:22:20 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: remote invocation for any user
Message-Id: <g299l.15265$Ou7.6007@newsfe24.iad>
james.bruckmann@yahoo.com wrote:
> I am now wondering about a setuid perl prog that morphed into the
> operator user and could then read the key with 600 perms on - but I
> dont know how to do that or even if it is possible..
I feel I should warn you about suid programs and the methods you want to
use, especially what with the "anyone can access" the GUI to pass
commands (which you don't know what those will be) aspect. If you are
running the GUI from a CGI script, consider using the SuEXEC wrapper
(if you use Apache), rather than suid/sgid solutions, and always do
appropriate checks on the data passed. It's not that what you want to
do can't be done in a reliable and secure manner, but it just doesn't
seem to be at this time, the way you're doing it.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
------------------------------
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 2103
***************************************