[25743] in Perl-Users-Digest
Perl-Users Digest, Issue: 7983 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 17 00:05:29 2005
Date: Sat, 16 Apr 2005 21:05:08 -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 Sat, 16 Apr 2005 Volume: 10 Number: 7983
Today's topics:
Re: Creating a non-existing database through Perl ioneabu@yahoo.com
Re: Creating m3u list from opendir listing <tadmc@augustmail.com>
Re: Do You Want To Know For Sure That You Are Going To <wildwusel@gmx.de>
Re: Is Perl open source? <tassilo.von.parseval@rwth-aachen.de>
LWP <freedom@rogers.com>
Re: LWP <spamtrap@dot-app.org>
Re: LWP <freedom@rogers.com>
parsing directory <ozgur.teksin@rogers.com>
Re: parsing directory <spamtrap@dot-app.org>
Re: parsing directory <freedom@rogers.com>
Re: Parsing user-entered content to remove rude words <gmills@nilELEPHANTdram.com>
Re: Parsing user-entered content to remove rude words <gmills@nilELEPHANTdram.com>
Re: Parsing user-entered content to remove rude words <gmills@nilELEPHANTdram.com>
Re: Parsing user-entered content to remove rude words <sbryce@scottbryce.com>
Re: regex help <someone@example.com>
Re: regex help ioneabu@yahoo.com
Re: socket change from 5.8.4 to 5.8.6? <sisyphus1@nomail.afraid.org>
Re: trouble writting to file <joe@inwap.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 Apr 2005 12:25:03 -0700
From: ioneabu@yahoo.com
Subject: Re: Creating a non-existing database through Perl
Message-Id: <1113679503.774957.304160@o13g2000cwo.googlegroups.com>
beatnik wrote:
> ioneabu@yahoo.com wrote:
>
> > Is the problem that DBI requires you to specify an existing
database to
> > connect? Just use one that is always there, like 'test' or 'mysql'
and
> > then you can create your new one.
>
> Well i dont know what DBI requires, but what if there isnt such
> databases as test or mysql?
>
> Lets assume that there is no other database available. Then what?
>
> Iam tellign this because my webpage script runs in 2 different
machines.
> One has 'test' and 'mysql' other doesnt.
> So the aproach of connecting to a diff database wont work but even if
it
> did its other database dependant.
from perldoc DBD::mysql
connect
use DBI;
$dsn = "DBI:mysql:$database";
$dsn = "DBI:mysql:database=$database;host=$hostname";
$dsn =
"DBI:mysql:database=$database;host=$hostname;port=$port";
$dbh = DBI->connect($dsn, $user, $password);
A "database" must always be specified.
It looks like you are stuck having to specify a database to get in. I
am no expert on mysql, but isn't it true that when the grant tables are
set up, there must be a database named 'mysql' present? The one that
does not have it is not set up securely for production use anyway. You
should be able to rely on properly setup mysql installations to have
the 'mysql' database present.
I think that the mysql_install_db script sets it up.
Good luck!
wana
------------------------------
Date: Sat, 16 Apr 2005 16:31:59 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Creating m3u list from opendir listing
Message-Id: <slrnd6312f.hln.tadmc@magna.augustmail.com>
Seansan <sheukels=cuthere=@yahooo.co.uk> wrote:
> Does anyone know why the following code doenst force a download of a m3u
> list (winamp playlist) when called directly?
Yes, anyone who reads the documentation for the functions that
they use knows why your program is failing.
> Am I forgetting something?
You are forgetting to read the documentation for the functions
that you use.
> opendir(D, $mp3_dir);
You should test to see if you actually got what you asked for:
opendir(D, $mp3_dir) or die "could not open '$mp3_dir' dir $!";
> my @f = readdir(D);
> next if (-d $file);
perldoc -f readdir
...
If you're planning to filetest the return values out of a
"readdir", you'd better prepend the directory in question.
Otherwise, because we didn't "chdir" there, it would have been
testing the wrong file.
--
Tad McClellan slumming in killfiled score range today
tadmc@augustmail.com
Fort Worth, Texas
------------------------------
Date: Sun, 17 Apr 2005 02:46:37 +0200
From: inge <wildwusel@gmx.de>
Subject: Re: Do You Want To Know For Sure That You Are Going To Heaven?
Message-Id: <4261B1EC.8134C94D@gmx.de>
RonGrossi382594@yahoo.com wrote:
>
> The reason some people don't know for sure
> if they are going to Heaven when they die
> is because they just don't know.
To be sure that you are going to heaven means you are second-guessing
God and commit the deadly sin of pride.
inge
--
It is easier to stay out than get out.
- Mark Twain
===
<http://home.foni.net/~lyorn> -- Stories, RPG & stuff.
===
To send me priority mail, replace 'wildwusel' with 'lyorn'.
------------------------------
Date: Sun, 17 Apr 2005 00:12:24 +0200
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: Is Perl open source?
Message-Id: <slrnd633e8.1am.tassilo.von.parseval@localhost.localdomain>
Also sprach brian d foy:
> In article <ctednT0c5q66nsLfRVn-3w@comcast.com>, Chris Mattern
><matternc@comcast.net> wrote:
>> I did say *often*, not *always*. Of course, anybody doing tasks
>> with hard real-time requirements in Perl is certifiable.
>
> Certifiably what? I do things with hard real-time requirements
> in Perl.
I strongly doubt that. Perl is inherently unsuitable for those kind of
tasks. Most languages and environments in fact are.
The requirements of real-time computing are predictability in terms of
latency, timing and synchronicity. Note how this has nothing to do with
the actual speed of execution or the seemingly prompt responsiveness of
an application.
Tassilo
--
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);
------------------------------
Date: Sat, 16 Apr 2005 23:19:28 -0400
From: "freedom" <freedom@rogers.com>
Subject: LWP
Message-Id: <LpydnTgq8exdSPzfRVn-tQ@rogers.com>
hello
is there anyway to get url whatever the user entered in the field.
example
in the script
instead of
my $url = "http://www.whatever.com";
my $page = get( $url );
how can we get the url without declaring the url in the script.
------------------------------
Date: Sat, 16 Apr 2005 23:45:15 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: LWP
Message-Id: <pPGdnZmpM4lWRvzfRVn-iQ@adelphia.com>
freedom wrote:
> is there anyway to get url whatever the user entered in the field.
>
> example
>
> in the script
> instead of
>
> my $url = "http://www.whatever.com";
> my $page = get( $url );
>
> how can we get the url without declaring the url in the script.
It depends. What kind of field? An HTML form? A Tk interface? Curses,
Gtk, Qt, Cocoa... what?
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Sun, 17 Apr 2005 00:02:06 -0400
From: "freedom" <freedom@rogers.com>
Subject: Re: LWP
Message-Id: <lsednf7L-aoiQvzfRVn-og@rogers.com>
it is an html form
"Sherm Pendley" <spamtrap@dot-app.org> wrote in message
news:pPGdnZmpM4lWRvzfRVn-iQ@adelphia.com...
> freedom wrote:
>
>> is there anyway to get url whatever the user entered in the field.
>>
>> example
>>
>> in the script
>> instead of
>>
>> my $url = "http://www.whatever.com";
>> my $page = get( $url );
>>
>> how can we get the url without declaring the url in the script.
>
> It depends. What kind of field? An HTML form? A Tk interface? Curses, Gtk,
> Qt, Cocoa... what?
>
> sherm--
>
> --
> Cocoa programming in Perl: http://camelbones.sourceforge.net
> Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Sat, 16 Apr 2005 23:03:59 -0400
From: "ozgur teksin" <ozgur.teksin@rogers.com>
Subject: parsing directory
Message-Id: <cI-dnVQwxYawT_zfRVn-vw@rogers.com>
hi
i m newbie in perl so i was trying to figure out how to parse filename
directory in the form field when the user submit it.
thanks
------------------------------
Date: Sat, 16 Apr 2005 23:43:11 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: parsing directory
Message-Id: <pPGdnZ6pM4nSRvzfRVn-iQ@adelphia.com>
ozgur teksin wrote:
> i m newbie in perl so i was trying to figure out how to parse filename
> directory in the form field when the user submit it.
It depends. What kind of form field? An HTML form? A Tk interface?
Curses, Gtk, Qt, Cocoa... what?
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Sun, 17 Apr 2005 00:03:14 -0400
From: "freedom" <freedom@rogers.com>
Subject: Re: parsing directory
Message-Id: <fuGdnViY5aecffzfRVn-ig@rogers.com>
html form
"Sherm Pendley" <spamtrap@dot-app.org> wrote in message
news:pPGdnZ6pM4nSRvzfRVn-iQ@adelphia.com...
> ozgur teksin wrote:
>
>> i m newbie in perl so i was trying to figure out how to parse filename
>> directory in the form field when the user submit it.
>
> It depends. What kind of form field? An HTML form? A Tk interface? Curses,
> Gtk, Qt, Cocoa... what?
>
> sherm--
>
> --
> Cocoa programming in Perl: http://camelbones.sourceforge.net
> Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Sat, 16 Apr 2005 19:59:41 +0100
From: Greg <gmills@nilELEPHANTdram.com>
Subject: Re: Parsing user-entered content to remove rude words
Message-Id: <u_KdnTo37aMI_fzfRVnytg@pipex.net>
Tad McClellan wrote:
> Greg <gmills@nilELEPHANTdram.com> wrote:
>
>
>> if ($input =~ s/$rudeword/i) {
>
>
>
> The s/// operator has *two* parts.
I put the word "Pseudocode" for a reason :P Well done for noticing :)
>
> You realize that automating this accurately is nearly impossible?
Oh yes. I just want to catch as many as I can automatically before
resorting to manual approaches
>
> You should probably have word boundaries in your pattern.
Cheers!
>
> Does the word list contain all of the ways that folks will
> use to circumvent censorship?
I've considered this. As I mention above, I just want to catch the
"Usual suspects" :D
> Will it generate "false hits" and delete messages that don't
> really contain the "bad words"?
Could do, - I don't want to upset the residents of the lovely UK town of
Scunthorpe :D
>
>>more optimised way of doing this?
>
> Your Question is Asked Frequently:
>
> perldoc -q match
>
> How do I efficiently match many regular expressions at once?
You're a star! Thank you :D
------------------------------
Date: Sat, 16 Apr 2005 20:00:22 +0100
From: Greg <gmills@nilELEPHANTdram.com>
Subject: Re: Parsing user-entered content to remove rude words
Message-Id: <u_KdnTU37aMg_fzfRVnytg@pipex.net>
> You could check out Regexp::Common, specifically Regexp::Common::profanity.
>
> Mark
Brilliant! I didn't even know it existed - time for me to start googling!
Cheers Mark!
------------------------------
Date: Sat, 16 Apr 2005 20:03:11 +0100
From: Greg <gmills@nilELEPHANTdram.com>
Subject: Re: Parsing user-entered content to remove rude words
Message-Id: <u_KdnTQ37aP6_PzfRVnytg@pipex.net>
> Not quite -- some points, though:
> - s// is substituting, whereas you only need matching (m//, or just //)
Yeah, It's <cough> pseudocode - just a typo on my part - but thanks for
noticing :D
> - you realize you're playing 'catch' -- the rude words can be altered
> enough to make your filter fail, yet have the result be readable for
> users - then, of course, you can add these alterations to your word
> list after you see them in use -- but, read on..
You're absolutely right - It's just like trying to write a piece of code
to catch people entering silly names and addresses - almost impossible.
I just want to catch the "Usual Suspects"
> - if you still want to do this, use word boundaries around your regular
> expressions -- otherwise (remembering the above), you'll trigger
> a false positive with just 'AMD Sempron'
Good point!
>
> You might consider using a soundex algorithm, but that's also prone
> to false positives - it's somewhat just an automated way to match
> a set of alterations at a single go.
Ahhh! That's what it was called... I remembered reading about it a few
months ago, but couldn't think of the name :)
Cheers Juha and thank you for the advise!
------------------------------
Date: Sat, 16 Apr 2005 13:35:16 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: Parsing user-entered content to remove rude words
Message-Id: <Ws2dnYdRFatp9fzfRVn-rA@comcast.com>
Greg wrote:
> Brilliant! I didn't even know it existed - time for me to start googling!
Not googling, cpaning.
http://cpan.uwinnipeg.ca/search?query=profanity&mode=dist
http://search.cpan.org/~tbone/Regexp-Common-profanity_us-2.2/lib/Regexp/Profanity/US.pm
http://search.cpan.org/~abigail/Regexp-Common-2.120/lib/Regexp/Common/profanity.pm
http://search.cpan.org/~tbone/Regexp-Common-profanity_us-2.2/lib/Regexp/Common/profanity_us.pm
------------------------------
Date: Sat, 16 Apr 2005 20:35:05 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: regex help
Message-Id: <ZFe8e.41350$jR3.26222@edtnps84>
ioneabu@yahoo.com wrote:
> John W. Krahn wrote:
>
>>Scott Bryce wrote:
>>
>>>my %hash = split / */, $string;
>>
>>ioneabu@yahoo.com wrote:
>>
>>>my %hash = split / /, $str;
>>
>>Is someone actually teaching people to use split() like this?
>>There must be a lot of bad examples out there on the web. :-)
>
> yes, the documentation that comes with Perl. From perlfunc:
>
> split /PATTERN/,EXPR,LIMIT
> split /PATTERN/,EXPR
> split /PATTERN/
You missed one:
perldoc -f split
split /PATTERN/,EXPR,LIMIT
split /PATTERN/,EXPR
split /PATTERN/
split
> Both examples above fit the format. What is your problem with them?
Do you know the difference between:
split;
split //, $_;
split / /, $_;
split / */, $_;
split / +/, $_;
split /\s/, $_;
split /\s*/, $_;
split /\s+/, $_;
split ' ', $_;
John
--
use Perl;
program
fulfillment
------------------------------
Date: 16 Apr 2005 16:24:24 -0700
From: ioneabu@yahoo.com
Subject: Re: regex help
Message-Id: <1113693864.791188.96010@l41g2000cwc.googlegroups.com>
John W. Krahn wrote:
> ioneabu@yahoo.com wrote:
> > John W. Krahn wrote:
> >
> >>Scott Bryce wrote:
> >>
> >>>my %hash = split / */, $string;
> >>
> >>ioneabu@yahoo.com wrote:
> >>
> >>>my %hash = split / /, $str;
> >>
> >>Is someone actually teaching people to use split() like this?
> >>There must be a lot of bad examples out there on the web. :-)
> >
> > yes, the documentation that comes with Perl. From perlfunc:
> >
> > split /PATTERN/,EXPR,LIMIT
> > split /PATTERN/,EXPR
> > split /PATTERN/
>
> You missed one:
>
> perldoc -f split
> split /PATTERN/,EXPR,LIMIT
> split /PATTERN/,EXPR
> split /PATTERN/
> split
>
You're right. But, there is no:
split EXPR
because it would be ambiguous, so if you don't want to use $_, you have
to specify a /PATTERN/.
>
> > Both examples above fit the format. What is your problem with
them?
>
> Do you know the difference between:
I think I do
>
split; #like split ' ', $_ which has special complex properties
split //, $_; #split into all individual characters
split / /, $_; #split on spaces
split / */, $_; #split on 0 or more spaces
split / +/, $_; #split on 1 or more spaces
split /\s/, $_; #split on single spaces
split /\s*/, $_; #split on 0 or more spaces
split /\s+/, $_; #split on 1 or more spaces
split ' ', $_; #split on space but with special properties (like awk,
refer to perldocs)
------------------------------
Date: Sun, 17 Apr 2005 13:32:17 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: socket change from 5.8.4 to 5.8.6?
Message-Id: <4261d8af$0$29867$afc38c87@news.optusnet.com.au>
"news" <bit@bucket.com> wrote in message
news:Tna8e.5656$qO6.2059@okepread03...
> I am on Windows 2000:
> When I upgraded from 5.8.4 to 5.8.6, I can no longer create an ICMP
> socket...
> (io/socket/inet.pm is the same between versions 8.4 and 8.6)
>
> I also tried using Net::Ping, which works in 5.8.4, but not 5.8.6
>
I'm also unable to create an icmp socket using IO::Socket with perl 5.8.6
(mingw-built) on Windows 2000.
With perl 5.8.5 and perl 5.8.4 (both also built using mingw compiler)
there's no problem.
Socket, IO::Socket, IO::Handle, IO::Socket::INET, and IO::Socket::UNIX all
report the same version number between 5.8.5 and 5.8.6 - so it looks like
the explanation is to be found elsewhere within the perl 5.8.6 source
(possibly win32sck.c, which *has* changed).
When I try to run the code you provided on linux, the icmp socket also fails
to be created (perl 5.8.3, 5.8.4 and 5.8.6). However, if (on linux) I run
your code as root, the creation of the icmp socket succeeds. On Windows 2000
I find it
makes no difference whether I run your code as user or administrator.
If you take a look at t\110_icmp_inst.t in Net-Ping-2.31, you'll see that
the second test will inevitably be skipped on Windows 2000 with the message
"icmp ping requires root privileges". Even if you run as administrator the
test is skipped and that message is displayed.
I deduce that creation of an icmp socket is something that should not be
achievable without root privileges - and that, in the past it *has* been
achievable on Windows 2000 without root privileges - and that, somehow, it
has now become unachievable on Windows 2000 under any circumstances ......
but I can't find anything about this in either 'perldoc perldelta' or
'perldoc perlport' or in the 'Changes' file in the perl 5.8.6 source. The
'Changes' file does mention a change to win32sck.c - but no mention of icmp
concerns.
Looks like a bug to me - perhaps the p5p list would be able to shed more
light on this.
Cheers,
Rob
------------------------------
Date: Sat, 16 Apr 2005 18:47:41 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: trouble writting to file
Message-Id: <WeydnWXZ0tqmXfzfRVn-rA@comcast.com>
Ian Wilson wrote:
> Understand the difference between "test,test,test" and 'test,test,test'.
There is none.
The example you have given does not use $ or \, so what point are you
trying to make?
-Joe
------------------------------
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 V10 Issue 7983
***************************************