[29590] in Perl-Users-Digest
Perl-Users Digest, Issue: 834 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 9 14:09:45 2007
Date: Sun, 9 Sep 2007 11:09:04 -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, 9 Sep 2007 Volume: 11 Number: 834
Today's topics:
Re: A flexible multi-level UL/LI constructor <rvtol+news@isolution.nl>
Re: A flexible multi-level UL/LI constructor <tuxedo@mailinator.com>
APL2007 reminder: early (cheaper) registration ends Th <mkent@acm.org>
new CPAN modules on Sun Sep 9 2007 (Randal Schwartz)
req.in Unix/SQL/Oracle/JAVA - Work Location US <techrecruit07@hotmail.com>
Re: Switching with case in perl ? <mritty@gmail.com>
Re: Switching with case in perl ? <stoupa@practisoft.cz>
Re: Switching with case in perl ? <ben@morrow.me.uk>
Re: Switching with case in perl ? <dummy@example.com>
Re: Switching with case in perl ? <stoupa@practisoft.cz>
Re: Switching with case in perl ? <lerameur@yahoo.com>
Re: Switching with case in perl ? <mritty@gmail.com>
Re: Switching with case in perl ? <rkb@i.frys.com>
Re: Switching with case in perl ? <lerameur@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 9 Sep 2007 14:05:32 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: A flexible multi-level UL/LI constructor
Message-Id: <fc0uqr.1a0.1@news.isolution.nl>
Tuxedo schreef:
> Ultimately, the list will be converted by CSS and Javascript into a
> typical drop-menu.
That can also be done without Javascript:
http://www.cssplay.co.uk/menus/
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Sun, 09 Sep 2007 14:58:44 -0400
From: Tuxedo <tuxedo@mailinator.com>
Subject: Re: A flexible multi-level UL/LI constructor
Message-Id: <fc0qm3$o6$01$1@news.t-online.com>
Dr.Ruud wrote:
> That can also be done without Javascript:
> http://www.cssplay.co.uk/menus/
Yes, you are right! But with the exception of some IE fallback procedures,
where "JScript" may patch a few minor holes.
I'm aware of cssplay.co.uk - an excellent collection of CSS examples!
Tx
--
Everyone who comes in here wants three things:
1. They want it quick.
2. They want it good.
3. They want it cheap.
I tell 'em to pick two and call me back.
-- sign on the back wall of a small printing company in Delaware
------------------------------
Date: Sat, 08 Sep 2007 22:53:10 -0400
From: Mike Kent <mkent@acm.org>
Subject: APL2007 reminder: early (cheaper) registration ends Thursday 9/13
Message-Id: <46E36016.1020803@acm.org>
On-line registration is through the OOPSLA registrar
http://www.regmaster.com/conf/oopsla2007.html
APL 2007 home page
http://www.sigapl.org/apl2007.html
------------------------------
Date: Sun, 9 Sep 2007 04:42:25 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sun Sep 9 2007
Message-Id: <Jo33qp.180z@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.
Alzabo-GUI-Mason-0.12
http://search.cpan.org/~drolsky/Alzabo-GUI-Mason-0.12/
A GUI for Alzabo using Mason
----
Alzabo-GUI-Mason-0.1201
http://search.cpan.org/~drolsky/Alzabo-GUI-Mason-0.1201/
A GUI for Alzabo using Mason
----
Attribute-Overload-0.03
http://search.cpan.org/~marcel/Attribute-Overload-0.03/
Attribute that makes overloading easier
----
Attribute-TieClasses-0.02
http://search.cpan.org/~marcel/Attribute-TieClasses-0.02/
attribute wrappers for CPAN Tie classes
----
CPAN-Reporter-0.99_08
http://search.cpan.org/~dagolden/CPAN-Reporter-0.99_08/
Adds CPAN Testers reporting to CPAN.pm
----
CSS-Moonfall-0.02
http://search.cpan.org/~sartak/CSS-Moonfall-0.02/
port of Lua's Moonfall for dynamic CSS generation
----
Class-Null-1.05
http://search.cpan.org/~marcel/Class-Null-1.05/
Implements the Null Class design pattern
----
Crypt-UnixCrypt_XS-0.07
http://search.cpan.org/~borisz/Crypt-UnixCrypt_XS-0.07/
perl xs interface for a portable traditional crypt function.
----
DBIx-Class-HTMLWidget-0.11
http://search.cpan.org/~andremar/DBIx-Class-HTMLWidget-0.11/
Like FromForm but with DBIx::Class and HTML::Widget
----
Data-Inherited-1.01
http://search.cpan.org/~marcel/Data-Inherited-1.01/
hierarchy-wide accumulation of list and hash results
----
Date-Darian-Mars-0.001
http://search.cpan.org/~zefram/Date-Darian-Mars-0.001/
the Darian calendar for Mars
----
Date-ISO8601-0.002
http://search.cpan.org/~zefram/Date-ISO8601-0.002/
the three ISO 8601 numerical calendars
----
Date-JD-0.002
http://search.cpan.org/~zefram/Date-JD-0.002/
conversion between flavours of Julian Date
----
Date-MSD-0.001
http://search.cpan.org/~zefram/Date-MSD-0.001/
conversion between flavours of Mars Sol Date
----
DateTime-Format-Natural-0.39
http://search.cpan.org/~schubiger/DateTime-Format-Natural-0.39/
Create machine readable date/time with natural parsing logic
----
Dockhand-0.1
http://search.cpan.org/~delon/Dockhand-0.1/
----
File-Path-2.00_11
http://search.cpan.org/~dland/File-Path-2.00_11/
Create or remove directory trees
----
Getopt-Attribute-1.41
http://search.cpan.org/~marcel/Getopt-Attribute-1.41/
Attribute wrapper for Getopt::Long
----
Gravatar-URL-0.01
http://search.cpan.org/~mschwern/Gravatar-URL-0.01/
Make URLs for Gravatars from an email address
----
Log-Dispatch-Buffer-0.02
http://search.cpan.org/~elizabeth/Log-Dispatch-Buffer-0.02/
Base class for collecting logged messages
----
Log-Dispatch-Configurator-YAML-0.03
http://search.cpan.org/~fmerges/Log-Dispatch-Configurator-YAML-0.03/
Configurator implementation with YAML
----
Log-WarnDie-0.05
http://search.cpan.org/~elizabeth/Log-WarnDie-0.05/
Log standard Perl warnings and errors on a log handler
----
Net-IDN-tools-0.90_20070909
http://search.cpan.org/~cfaerber/Net-IDN-tools-0.90_20070909/
----
Net-MAC-1.2
http://search.cpan.org/~karlward/Net-MAC-1.2/
Perl extension for representing and manipulating MAC addresses
----
Object-Exercise-1.12
http://search.cpan.org/~lembark/Object-Exercise-1.12/
Generic execution & benchmark harness for method calls.
----
SMS-Send-TW-emome-0.01
http://search.cpan.org/~snowfly/SMS-Send-TW-emome-0.01/
SMS::Send driver for www.emome.net
----
Speech-eSpeak-0.2
http://search.cpan.org/~hgneng/Speech-eSpeak-0.2/
Perl extension for eSpeak text to speech
----
Speech-eSpeak-0.21
http://search.cpan.org/~hgneng/Speech-eSpeak-0.21/
Perl extension for eSpeak text to speech
----
Spreadsheet-Perl-0.08
http://search.cpan.org/~nkh/Spreadsheet-Perl-0.08/
Pure Perl implementation of a spreadsheet engine
----
Template-Plugin-Gravatar-0.05
http://search.cpan.org/~ashley/Template-Plugin-Gravatar-0.05/
configurable TT2-based generation of Gravatar URLs from email addresses.
----
Test-MockFile-Light-0.2.0
http://search.cpan.org/~mutoguz/Test-MockFile-Light-0.2.0/
provides a mechanism for mocking files to support testing file operations in a way transparent to the file-processing-module(s).
----
Tk-RotatingGauge-0.20
http://search.cpan.org/~jquelin/Tk-RotatingGauge-0.20/
a rotating gauge for Tk
----
WWW-Spamla-0.03
http://search.cpan.org/~gray/WWW-Spamla-0.03/
interface to Spam.la
----
WWW-Spyder-0.23
http://search.cpan.org/~ashley/WWW-Spyder-0.23/
a simple non-persistent web crawler.
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: Sat, 08 Sep 2007 21:13:40 -0700
From: TechRecruit Consultants <techrecruit07@hotmail.com>
Subject: req.in Unix/SQL/Oracle/JAVA - Work Location US
Message-Id: <1189311220.567843.134390@o80g2000hse.googlegroups.com>
Hi
Greets!
This is sandy,Working in TechRecruit Consultants,Chennai as Head
Operaitons - Recruitment.
Currently we have openning in Unix/SQL/Oracle/JAVA for ISO 9001:2000/
CMM LEVEL 5 Company in US.
About the company:An ISO 9001:2000 /SEI-CMM Level 5 accreditation.
Experience:4 - 7 Years
Positions:Senior Level
JOB LOCATION - US
Candidate must also have experience in Unix, SQL, Oracle, and JAVA.
Experience with Weblogic and scripting is also highly desirable. Must
be a self-starter and have good communication skills. Sound procedures
for debugging, coding and testing of changes is needed due to the
criticality of the applications supported.
Kindly forward your updated profile in Word doc. to
sandy@techrecruit.net
Please fill the following details and revertback to me.
Current CTC:
Expected CTC:
Notice Period:
DOB:
Marital Status:
Convenient time for Telephonic Interview:
With Thanks and Regards,
Sandy,
Head Operations - Recruitment
TechRecruit Consultants,
India.
------------------------------
Date: Sat, 08 Sep 2007 19:12:52 -0700
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Switching with case in perl ?
Message-Id: <1189303972.710448.90460@o80g2000hse.googlegroups.com>
On Sep 8, 8:15 pm, lerameur <leram...@yahoo.com> wrote:
> open (FILE_1,"</*$year$month$day$hours$minute*/");
You're trying to open a file in the root directory that starts with an
asterisk and that ends with an asterisk and a slash. I'm willing to
bet no such file exists. Of course, Perl would tell you that if you
bothered asking. You're not bothering - you're not checking the
return value of open() to see if it succeeded.
open my $fh, '<', "filename" or die "Could not open file: $!";
If you're attempting to open any file that matches that pattern, you
need to use the glob() function to get a list of all matching files:
my @files = glob("*$year$month$day$hours$minute*");
for my $file (@files) {
open my $fh, '<', $file or die "Could not open $file: $!";
while (my $line = <$fh>) {
#...
}
}
Paul Lalli
------------------------------
Date: Sun, 9 Sep 2007 04:20:19 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: Switching with case in perl ?
Message-Id: <fbvl9q$epv$1@ns.felk.cvut.cz>
lerameur wrote:
>
> for my $minute (0..59) {
> my $logtime = strftime("%y%m%d%H%M", 0, $minute, $hours, $day, $month
> -1, $year + 100), "\n"; #line 20
> print $logtime,"\n";
> }
>
> error: Useless use of constant in void context at line 20.
>
Maybe you have format or parameters in reverse order :-)
You can write this
my $logtime = strftime("%y%m%d%H%M\n", $year + 100, $month -1, $day, $hours,
$minute);
or this
my $logtime = strftime("%y%m%d%H%M", $year + 100, $month -1, $day, $hours,
$minute) . "\n";
# use dot for concate instead comma operator
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
------------------------------
Date: Sun, 9 Sep 2007 05:14:47 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Switching with case in perl ?
Message-Id: <ni8cr4-cp5.ln1@osiris.mauzo.dyndns.org>
Quoth "Petr Vileta" <stoupa@practisoft.cz>:
> lerameur wrote:
> >
> > for my $minute (0..59) {
> > my $logtime = strftime("%y%m%d%H%M", 0, $minute, $hours, $day, $month
> > -1, $year + 100), "\n"; #line 20
> > print $logtime,"\n";
> > }
> >
> > error: Useless use of constant in void context at line 20.
Not an error: a warning. The distinction is important.
> Maybe you have format or parameters in reverse order :-)
>
> You can write this
>
> my $logtime = strftime("%y%m%d%H%M\n", $year + 100, $month -1, $day, $hours,
> $minute);
I think you're confusing strftime with sprintf. The former does not
expect its parameters in the order they are used, it expects a whole
broken-out 'struct tm' (second, minute, hour, day, month, year in that
order). See perldoc POSIX.
> my $logtime = strftime("%y%m%d%H%M", $year + 100, $month -1, $day, $hours,
> $minute) . "\n";
> # use dot for concate instead comma operator
The comma operator never concatenates... the mystery is why the OP
thought it did :).
Ben
------------------------------
Date: Sun, 09 Sep 2007 08:16:15 GMT
From: "John W. Krahn" <dummy@example.com>
Subject: Re: Switching with case in perl ?
Message-Id: <jZNEi.25152$bO6.16489@edtnps89>
Paul Lalli wrote:
> On Sep 8, 3:09 pm, "John W. Krahn" <du...@example.com> wrote:
>> The ', "\n"' at the end of line 20 is the problem. You are
>> assigning "\n" to $logtime because of the comma opertor.
>
> No he's not. = has a higher precedence than ,. He's assigning the
> results of strftime(...) to $logtime, and then that assignment and the
> "\n" are both evaluated by the , operator.
Yes, thank you. I realised my mistake a while after posting but then I wasn't
near the computer to correct it.
:-)
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
------------------------------
Date: Sun, 9 Sep 2007 15:10:36 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: Switching with case in perl ?
Message-Id: <fc0t78$10a2$1@ns.felk.cvut.cz>
Ben Morrow wrote:
> Quoth "Petr Vileta" <stoupa@practisoft.cz>:
>> Maybe you have format or parameters in reverse order :-)
>>
>> You can write this
>>
>> my $logtime = strftime("%y%m%d%H%M\n", $year + 100, $month -1, $day,
>> $hours, $minute);
>
> I think you're confusing strftime with sprintf.
Eh, yes ;-)
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
------------------------------
Date: Sun, 09 Sep 2007 08:38:57 -0700
From: lerameur <lerameur@yahoo.com>
Subject: Re: Switching with case in perl ?
Message-Id: <1189352337.624928.156680@g4g2000hsf.googlegroups.com>
Paul I used your glob function, I think this is sweet function.
I tried using it with no success, I modified a little bit and still no
success. Basically it is not creating the output file, and gives me an
error when I try closing the file I am using to read.
here is the original:
my @files = glob("*$year$month$day$hours$minute*"); #looking at all
files in the directory
for my $file (@files) {
open my $fh, '<', $file or die "Could not open $file: $!";
while (my $line = <$fh>) {
if ($line =~ m/beth/) {
open (FILE, ">>Loog_rr.txt"); #this line is not creating the
file
@items = split(",",$line);
print FILE $items[0], ",", $items[1], ",", $items[2],",",
$items[3], ";" . "\n";
close(FILE);
}
}
}
}#closing for my minute loop
#close ($fh);
*******************************
and here is the modified version
while ($filename = glob("*$year$month$day$hours$minute*") ){ #looking
at all files in the directory
open (wordlisting1, $filename) or die "Could not open wordlisting:
";
while ($filename ne " " ) {
if ($line =~ m/beth/) {
open (FILE, ">>Loooooog_rr.txt");
@items = split(",",$line);
print FILE $items[0], ",", $items[1], ",", $items[2],",",
$items[3], ";" . "\n";
close(FILE)|| die "couldn't close FILE: $!";;
}
}
}
}#closing for my minute loop
close (wordlisting1) || die "couldn't close wordlisting: ";
------------------------------
Date: Sun, 09 Sep 2007 09:56:52 -0700
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Switching with case in perl ?
Message-Id: <1189357012.524877.130360@d55g2000hsg.googlegroups.com>
On Sep 9, 11:38 am, lerameur <leram...@yahoo.com> wrote:
> Paul I used your glob function, I think this is sweet function.
> I tried using it with no success, I modified a little bit and still no
> success. Basically it is not creating the output file, and gives me an
> error when I try closing the file I am using to read.
You are *still* not checking open for errors, you are *still* not
including $! in the error message for the close.
If you refuse to ask Perl for help, why should any actual human beings
continue to help you?
Paul Lalli
------------------------------
Date: Sun, 09 Sep 2007 10:03:42 -0700
From: Ron Bergin <rkb@i.frys.com>
Subject: Re: Switching with case in perl ?
Message-Id: <1189357422.089294.298050@57g2000hsv.googlegroups.com>
On Sep 9, 8:38 am, lerameur <leram...@yahoo.com> wrote:
> Paul I used your glob function, I think this is sweet function.
> I tried using it with no success, I modified a little bit and still no
> success. Basically it is not creating the output file, and gives me an
> error when I try closing the file I am using to read.
> here is the original:
>
> my @files = glob("*$year$month$day$hours$minute*"); #looking at all
> files in the directory
> for my $file (@files) {
> open my $fh, '<', $file or die "Could not open $file: $!";
> while (my $line = <$fh>) {
> if ($line =~ m/beth/) {
> open (FILE, ">>Loog_rr.txt"); #this line is not creating the
> file
> @items = split(",",$line);
> print FILE $items[0], ",", $items[1], ",", $items[2],",",
> $items[3], ";" . "\n";
> close(FILE);
> }
> }
> }
> }#closing for my minute loop
> #close ($fh);
>
> *******************************
> and here is the modified version
>
> while ($filename = glob("*$year$month$day$hours$minute*") ){ #looking
> at all files in the directory
> open (wordlisting1, $filename) or die "Could not open wordlisting:
> ";
> while ($filename ne " " ) {
> if ($line =~ m/beth/) {
> open (FILE, ">>Loooooog_rr.txt");
> @items = split(",",$line);
> print FILE $items[0], ",", $items[1], ",", $items[2],",",
> $items[3], ";" . "\n";
> close(FILE)|| die "couldn't close FILE: $!";;
> }
> }
> }
> }#closing for my minute loop
> close (wordlisting1) || die "couldn't close wordlisting: ";
It doesn't appear that you're using the strict or warnings pragmas.
It would help if you ask Perl why it can't open the Loog_rr.txt file.
It would also be better to put that open call prior to the glob.
You also need to make your code easier to read/maintain by reducing
the amount of indentation.
open(my $out_file, '>>', 'Loog_rr.txt') or die "Can't open Loog_rr.txt
$!";
while (my $filename = glob("*$year$month$day$hours$minute*") ){
open($wordlisting1, '<', $filename) or die "Could not open
wordlisting: $!";
while (my $line = <$wordlisting1> ) {
if ($line =~ m/beth/) {
@items = (split(",",$line))[0..3];
print $out_file join(',', @items) , ";\n";
}
}
close($wordlisting1) || die "couldn't close wordlisting: $!";
}
close $out_file or die "Can't close out_file $!";
------------------------------
Date: Sun, 09 Sep 2007 10:04:12 -0700
From: lerameur <lerameur@yahoo.com>
Subject: Re: Switching with case in perl ?
Message-Id: <1189357452.669541.325460@k79g2000hse.googlegroups.com>
On Sep 9, 7:56 pm, Paul Lalli <mri...@gmail.com> wrote:
> On Sep 9, 11:38 am,lerameur<leram...@yahoo.com> wrote:
>
> > Paul I used your glob function, I think this is sweet function.
> > I tried using it with no success, I modified a little bit and still no
> > success. Basically it is not creating the output file, and gives me an
> > error when I try closing the file I am using to read.
>
> You are *still* not checking open for errors, you are *still* not
> including $! in the error message for the close.
>
> If you refuse to askPerlfor help, why should any actual human beings
> continue to help you?
>
> Paul Lalli
I added them for the close and missed one for the open.
i added -or die "Could not open file: $!"; -
I am not getting any error on opening files though.
k
------------------------------
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 834
**************************************