[29138] in Perl-Users-Digest
Perl-Users Digest, Issue: 382 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 26 11:10:34 2007
Date: Thu, 26 Apr 2007 08:09: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 Thu, 26 Apr 2007 Volume: 11 Number: 382
Today's topics:
Re: $ENV HOME on windows anno4000@radom.zrz.tu-berlin.de
Re: $ENV HOME on windows <1usa@llenroc.ude.invalid>
Re: [2] SQL error .... Can anyone tell me what's going <joe@inwap.com>
Could not find ParserDetails.ini... <dp_pearce@hotmail.com>
Re: FAQ 4.32 How do I strip blank space from the beginn anno4000@radom.zrz.tu-berlin.de
Re: How solve this error <joe@inwap.com>
Re: How to transparently download multiple files? <joe@inwap.com>
new CPAN modules on Thu Apr 26 2007 (Randal Schwartz)
Re: parse with multiple delimiter <josef.moellers@fujitsu-siemens.com>
Re: parse with multiple delimiter <nobull67@gmail.com>
Re: Read xml file and write data to a txt file using PE <tadmc@augustmail.com>
SQL statement in Perl doesn't work <"v.niekerk at hccnet.nl">
Re: SQL statement in Perl doesn't work <glennj@ncf.ca>
Re: SQL statement in Perl doesn't work <"v.niekerk at hccnet.nl">
Re: STDOUT redirection <klaus03@gmail.com>
use one subroutine's variable value in another subrouti <hara.acharya@gmail.com>
Re: use POSIX qw(ceil floor) <john.swilting@wanadoo.fr>
UTF8 European characters in MySQL <john1949@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Apr 2007 09:06:10 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: $ENV HOME on windows
Message-Id: <59b8c2F2ir6nuU2@mid.dfncis.de>
Petr Vileta <stoupa@practisoft.cz> wrote in comp.lang.perl.misc:
> "Ilya Zakharevich" <nospam-abuse@ilyaz.org> píše v diskusním příspěvku
> news:f0opmc$27r$1@agate.berkeley.edu...
> > What puzzles me deep is why Perl on Windows is not faking $ENV{HOME}
> > if $ENV{HOMEPATH} and $ENV{HOMEPATH} are both present... I think this
One of these should be $ENV{HOMEDRIVE}
> > would remove at least 10-20% of porting problems...
> >
> From which hell get you HOME variable? :-)
The suggestion is for Perl to *fake* it in %ENV, deriving the value
from $ENV{HOMEDRIVE} and $ENV{HOMEPATH}. The system environment
doesn't have to have HOME for that.
Anno
------------------------------
Date: Thu, 26 Apr 2007 13:25:39 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: $ENV HOME on windows
Message-Id: <Xns991E5FEC1439Casu1cornelledu@127.0.0.1>
anno4000@radom.zrz.tu-berlin.de wrote in news:59b8c2F2ir6nuU2
@mid.dfncis.de:
> Petr Vileta <stoupa@practisoft.cz> wrote in comp.lang.perl.misc:
>> "Ilya Zakharevich" <nospam-abuse@ilyaz.org> píše v diskusním
příspěvku
>> news:f0opmc$27r$1@agate.berkeley.edu...
>> > What puzzles me deep is why Perl on Windows is not faking $ENV
{HOME}
>> > if $ENV{HOMEPATH} and $ENV{HOMEPATH} are both present... I think
this
>
> One of these should be $ENV{HOMEDRIVE}
>
>> > would remove at least 10-20% of porting problems...
>> >
>> From which hell get you HOME variable? :-)
>
> The suggestion is for Perl to *fake* it in %ENV, deriving the value
> from $ENV{HOMEDRIVE} and $ENV{HOMEPATH}. The system environment
> doesn't have to have HOME for that.
Which might be a problem for those of us who create a D:\Home and move
users' 'My Documents' folders to directories under D:\Home\<userid> and
add a HOME variable to each user's environment. I am assuming such
problems can be avoided by checking for the existence of of $ENV{HOME}
before faking it. However, this means that the check and the decision as
to whether to fake $ENV{HOME} should not be done at install time but
each time a script is run.
I still do think it is a good idea to fake $ENV{HOME} using
$ENV{HOMEDRIVE} and $ENV{HOMEPATH}.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Wed, 25 Apr 2007 21:31:54 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: [2] SQL error .... Can anyone tell me what's going wrong please??
Message-Id: <1p-dnQeEuKnctq3bnZ2dnUVZ_u2mnZ2d@comcast.com>
Richard wrote:
> So I assume that the connection went ok.
That's an unfounded assumption.
> So what's the problem?
> Or *how* do I go about finding the cause of the problem?
Check that all function and method calls have indicated success.
> my $sth = $dbh->prepare(qq{select title from pages where PageID = $PageID});
# Put this in front of the prepare() statement:
unless ($dbh) {
die "Unable to create a DB handle. The error message is ",...;
}
# Put this after the prepare() and before the execute():
unless ($sth) {
die "Unable to create STH for $dbh (PageID=$PageID). The error is ",...;
}
You'll need to expand the ... parts to retrieve the error messages.
-Joe
------------------------------
Date: 26 Apr 2007 06:16:59 -0700
From: Devon_Dan <dp_pearce@hotmail.com>
Subject: Could not find ParserDetails.ini...
Message-Id: <1177593419.267574.299460@t39g2000prd.googlegroups.com>
Hello.
I am having a bit of a problem using Perl2exe and was wondering if
anyone can throw some light on how to resolve it.
My script runs perfectly from the command line so I know it works.
However when I try perl2exe myscript.pl I get the following
Warning: Can't locate VMS/Stdio.pm
at D:\Perl\lib\File\Temp line 139
@INC D:\Perl\lib , d:\Perl\Site
>From what I can see, the VMS::Stdio warning is only used on the VMS
platform and can be safely ignored. The .exe is still created but when
it is run, half way through execution I get this
could not find ParserDetails.ini in PERL_STORAGE/XML/SAX
can't locate object method 'new' via XML::SAX::PurePerl at
PERL_STORAGE/XML/SAX/ParserFactory.pm line 43
A bit of hunting turned up this http://johnbokma.com/perl/installing-xml-sax.html
but having tried both fixes, the problem persists. Has anyone had this
problem before? Perhaps I am missing something blindingly obvious?
Thanks for your time
Dan
------------------------------
Date: 26 Apr 2007 08:31:09 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: FAQ 4.32 How do I strip blank space from the beginning/end of a string?
Message-Id: <59b6adF2ir6nuU1@mid.dfncis.de>
Petr Vileta <stoupa@practisoft.cz> wrote in comp.lang.perl.misc:
> "Uri Guttman" <uri@stemsystems.com> píse v diskusním príspevku
> news:x74pn6ftfx.fsf@mail.sysarch.com...
> >>>>>> "PV" == Petr Vileta <stoupa@practisoft.cz> writes:
> >
> > >> 4.32: How do I strip blank space from the beginning/end of a string?
[...]
> is the same for human but different for machine. By this FAQ and your ansver
> I rewote my function to this (maybe some can use this too)
>
> sub normalize_string {
> my $string = shift;
> $string =~ s/^\s+//s;
> $string =~ s/\s+$//s;
> $string =~ s/\s+/ /sg;
> return $string;
> }
The squeezing of multiple blanks into one can also be done by tr///,
which is a little faster. Disadvantage: You can't specify "\s" but
must list the white space characters explicitly. If you do that first,
the regexes for trimming leading and trailing space have to deal with
at most one blank and can be simplified. So, alternatively:
sub normalize_string {
my $string = shift;
$string =~ tr/ \t\n//s;
$string =~ s/^\s//s;
$string =~ s/\s$//s;
return $string;
}
Anno
------------------------------
Date: Wed, 25 Apr 2007 21:46:41 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: How solve this error
Message-Id: <4O-dnb9ZU84us63bnZ2dnUVZ_umlnZ2d@comcast.com>
mukunthini@gmail.com wrote:
> it gives this error " [Wed Apr 25
> 21:51:00 2007] hi.pl: Cannot open counter.dat for reading: No such
> file or directory at hi.pl line 7.
>
> open (COUNT, "counter.dat") or warn "Cannot open counter.dat for
> reading: $!";
You're not using an absolute pathname for the file.
Since the CGI standard does _not_ specify what the current working directory
will be while the script is running, you need to use the full name.
my $file = "/home/mukinthini/public_html/counter.dat";
open my $COUNT,'<',$file or warn "Cannot open $file for reading: $!";
-Joe
------------------------------
Date: Wed, 25 Apr 2007 22:21:19 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: How to transparently download multiple files?
Message-Id: <fKednaE0fMlMq63bnZ2dnUVZ_o2vnZ2d@comcast.com>
foo bar baz qux wrote:
>>> { print "<BR><H2> FUBAR! </H2>"; }
>
> Note the useless use of double quotes.
You've got that wrong. Useless use of double quotes is
print "$string";
The difference between
print "<BR><H2> FUBAR! </H2>";
and
print '<BR><H2> FUBAR! </H2>';
is a matter of style, not an error that has to be corrected.
-Joe
------------------------------
Date: Thu, 26 Apr 2007 04:42:14 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Apr 26 2007
Message-Id: <JH392E.1xHM@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.
Acme-RFC4824-0.02
http://search.cpan.org/~alech/Acme-RFC4824-0.02/
Internet Protocol over Semaphore Flag Signaling System (SFSS)
----
Archive-Cpio-0.06
http://search.cpan.org/~pixel/Archive-Cpio-0.06/
module for manipulations of cpio archives
----
BitTorrent-V0.1
http://search.cpan.org/~qantins/BitTorrent-V0.1/
Perl extension for extracting, publishing and maintaining BitTorrent related things
----
CGI-Application-Plugin-Authentication-Driver-DBIC-0.01
http://search.cpan.org/~jaldhar/CGI-Application-Plugin-Authentication-Driver-DBIC-0.01/
DBIx::Class Authentication Driver
----
CPAN-Mini-0.560_01
http://search.cpan.org/~rjbs/CPAN-Mini-0.560_01/
create a minimal mirror of CPAN
----
Catalyst-Plugin-Authentication-Credential-AOL-0.01
http://search.cpan.org/~miyagawa/Catalyst-Plugin-Authentication-Credential-AOL-0.01/
AOL OpenAuth credential
----
Catalyst-Plugin-Log-Handler-0.02
http://search.cpan.org/~pepe/Catalyst-Plugin-Log-Handler-0.02/
Catalyst Plugin for Log::Handler
----
Catalyst-Plugin-Log-Handler-0.03
http://search.cpan.org/~pepe/Catalyst-Plugin-Log-Handler-0.03/
Catalyst Plugin for Log::Handler
----
Catalyst-Plugin-Log-Handler-0.04
http://search.cpan.org/~pepe/Catalyst-Plugin-Log-Handler-0.04/
Catalyst Plugin for Log::Handler
----
Catalyst-Plugin-Log-Handler-0.05
http://search.cpan.org/~pepe/Catalyst-Plugin-Log-Handler-0.05/
Catalyst Plugin for Log::Handler
----
Catalyst-View-JSON-0.17
http://search.cpan.org/~miyagawa/Catalyst-View-JSON-0.17/
JSON view for your data
----
Catalyst-View-TT-Filters-LazyLoader-0.01
http://search.cpan.org/~tomyhero/Catalyst-View-TT-Filters-LazyLoader-0.01/
TT View Class with Template::Filters::LazyLoader support.
----
Catalyst-View-TT-Filters-LazyLoader-0.02
http://search.cpan.org/~tomyhero/Catalyst-View-TT-Filters-LazyLoader-0.02/
TT View Class with Template::Filters::LazyLoader support.
----
Clutter-0.230
http://search.cpan.org/~ebassi/Clutter-0.230/
Simple GL-based canvas library
----
DBIx-Class-DateTime-Epoch-0.03
http://search.cpan.org/~bricas/DBIx-Class-DateTime-Epoch-0.03/
Automatic inflation/deflation of epoch-based DateTime objects for DBIx::Class
----
Devel-Backtrace-0.01
http://search.cpan.org/~pepe/Devel-Backtrace-0.01/
Object-oriented backtrace
----
GD-SecurityImage-1.64
http://search.cpan.org/~burak/GD-SecurityImage-1.64/
Security image (captcha) generator.
----
Gearman-Server-1.06
http://search.cpan.org/~bradfitz/Gearman-Server-1.06/
function call "router" and load balancer
----
Gtk2-Ex-PrintDialog-0.03
http://search.cpan.org/~gbrown/Gtk2-Ex-PrintDialog-0.03/
a simple, pure Perl dialog for printing PostScript data in GTK+ applications.
----
HTML-XHTML-DVSM-1.0
http://search.cpan.org/~dvsm/HTML-XHTML-DVSM-1.0/
Dynamic Visual Software Modelling, Story Board animation module for XML/XHTML
----
HTTP-Cookies-Find-1.410
http://search.cpan.org/~mthurn/HTTP-Cookies-Find-1.410/
Locate cookies for the current user on the local machine.
----
JQuery-1.05
http://search.cpan.org/~peterg/JQuery-1.05/
Interface to Jquery, a language based on Javascript
----
Linux-Taskstats-Read-3.05
http://search.cpan.org/~scottw/Linux-Taskstats-Read-3.05/
Read Linux taskstats structures
----
Log-Handler-0.15
http://search.cpan.org/~bloonix/Log-Handler-0.15/
A simple handler to log messages to log files.
----
MooseX-Params-Validate-0.02
http://search.cpan.org/~stevan/MooseX-Params-Validate-0.02/
an extension of Params::Validate for using Moose's types
----
Net-Connection-Sniffer-0.23
http://search.cpan.org/~miker/Net-Connection-Sniffer-0.23/
gather stats on network connections
----
Net-SFTP-Foreign-0.90_21
http://search.cpan.org/~salva/Net-SFTP-Foreign-0.90_21/
Secure File Transfer Protocol client
----
Object-eBay-0.0.3
http://search.cpan.org/~mndrix/Object-eBay-0.0.3/
Object-oriented interface to the eBay API
----
PDF-API2-0.60
http://search.cpan.org/~areibens/PDF-API2-0.60/
A Perl Module Chain to faciliate the Creation and Modification of High-Quality "Portable Document Format (aka. PDF)" Files.
----
Pad-Tie-0.004
http://search.cpan.org/~hdp/Pad-Tie-0.004/
tie an object to lexical contexts
----
Pad-Tie-0.005
http://search.cpan.org/~hdp/Pad-Tie-0.005/
tie an object to lexical contexts
----
Perl6-Perldoc-v0.0.5
http://search.cpan.org/~dconway/Perl6-Perldoc-v0.0.5/
Use Perl 6 documentation in a Perl 5 program
----
Proc-BackOff-0.01
http://search.cpan.org/~dlo/Proc-BackOff-0.01/
----
Sepia-0.70
http://search.cpan.org/~seano/Sepia-0.70/
Simple Emacs-Perl Interface
----
ShipIt-0.49
http://search.cpan.org/~bradfitz/ShipIt-0.49/
software release tool
----
Sprocket-0.02
http://search.cpan.org/~xantus/Sprocket-0.02/
A pluggable POE based Client / Server Library
----
String-MatchInterpolate-0.01
http://search.cpan.org/~pevans/String-MatchInterpolate-0.01/
perform named regexp capture and variable interpolation from the same template.
----
Template-Recall-0.08
http://search.cpan.org/~gilad/Template-Recall-0.08/
"Reverse callback" templating system
----
TheSchwartz-Worker-SendEmail-1.00
http://search.cpan.org/~bradfitz/TheSchwartz-Worker-SendEmail-1.00/
sends email using SMTP
----
Time-Elapsed-0.13
http://search.cpan.org/~burak/Time-Elapsed-0.13/
Displays the elapsed time as a human readable string.
----
WordPress-V1
http://search.cpan.org/~senger/WordPress-V1/
Perl extension for blah blah blah
----
XML-RPC-0.2
http://search.cpan.org/~daan/XML-RPC-0.2/
Pure Perl implementation for an XML-RPC client and server.
----
obfuscator-1.14
http://search.cpan.org/~gosha/obfuscator-1.14/
----
parsenative.070425_1
http://search.cpan.org/~gslondon/parsenative.070425_1/
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: Thu, 26 Apr 2007 08:49:36 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: parse with multiple delimiter
Message-Id: <f0pi22$1uk$1@nntp.fujitsu-siemens.com>
anitawa@gmail.com wrote:
> Hi,
What a coincidence!
Another poster, who imposes as "anitawa@gmail.com" posted exactly the=20
same question, but with a different subject "How to parse text file into =
hash table" only two days ago! Maybe you know him/her, so maybe you ask=20
this person how the answers given helped.
--=20
These are my personal views and not those of Fujitsu Siemens Computers!
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: 26 Apr 2007 01:12:56 -0700
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: parse with multiple delimiter
Message-Id: <1177575175.411048.267650@n15g2000prd.googlegroups.com>
On Apr 25, 8:40 pm, anit...@gmail.com wrote:
> Hi,
>
> I am new to perl and trying to parse a text file into a hash table.
> Could someone point me in the right direction?
>
> My text file:
> start -days 1,2,3,4,5 -month 2,4,8,10 -message "I want you to start
> this" -running -group "rungroup"
>
> Hash table should look like this:
>
> myhash(start) = ""
> myhash(days) = 1,2,3,4,5
> myhashh(month) = 2,4,8,10
> myhash(message) = "I want you to start this"
> myhash(running) = ""
> myhash(group) = "rungroup"
Please try to use Perl notation in your posts to Perl newsgroups.
$myhash{group} = "rungroup"
Your task shouldn't be too difficult but we need to know a couple of
things:
Where did the empty string in $myhash{start} come from?
What are the rules about quotes? For now I'll assume there can be no
quote characters in the data.
Do you want to validate the data or can we assume the input fits the
pattern?
use strict;
use warnings;
use Data::Dumper;
$_='start -days 1,2,3,4,5 -month 2,4,8,10 -message "I want you to
start this" -running -group "rungroup"';
my %myhash = /\G(?:^|-)(\w+)\s+("[^"]*"|(?=-)|[^" ]*)\s*/g;
tr/"//d for values %myhash;
print Dumper \%myhash;
------------------------------
Date: Thu, 26 Apr 2007 07:23:06 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Read xml file and write data to a txt file using PERL.... urgent
Message-Id: <slrnf316da.bpg.tadmc@tadmc30.august.net>
sl123@netherlands.area <sl123@netherlands.area> wrote:
> I use RXParse module.
There's one born every minute.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 26 Apr 2007 15:46:34 +0200
From: Huub <"v.niekerk at hccnet.nl">
Subject: SQL statement in Perl doesn't work
Message-Id: <4630ad3a$0$12209$e4fe514c@dreader25.news.xs4all.nl>
Hi,
I have written a script that reads from a MySQL database. It works fine,
except that the addition of one AND does not work while it does in Query
Browser:
select betaald2006 from hvw where lidnr = $record and naam != " " and
kenmerk2006 is null
works. The same statement via Perl:
$betaald2006 = "select betaald2006 from hvw where lidnr = $record and
naam != ' ' and kenmerk2006 is null";
does not work. When I remove "and kenmerk2006 is null", it works ok.
With it, I don't get a real error, just this message about $betaald2006:
"Use of uninitialized value in string eq"
in
"if ($betaald2006 eq $vergelijk)"
Any idea what I'm doing wrong?
Thanks
Huub
------------------------------
Date: 26 Apr 2007 14:30:34 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: SQL statement in Perl doesn't work
Message-Id: <slrnf31dsa.8fm.glennj@smeagol.ncf.ca>
At 2007-04-26 09:46AM, "Huub" wrote:
[...]
> $betaald2006 = "select betaald2006 from hvw where lidnr = $record and
> naam != ' ' and kenmerk2006 is null";
>
> does not work. When I remove "and kenmerk2006 is null", it works ok.
> With it, I don't get a real error, just this message about $betaald2006:
>
> "Use of uninitialized value in string eq"
>
> in
>
> "if ($betaald2006 eq $vergelijk)"
Are you sure that warning is about $betaald2006? What's the value of
$vergelijk?
--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry
------------------------------
Date: Thu, 26 Apr 2007 16:55:26 +0200
From: Huub <"v.niekerk at hccnet.nl">
Subject: Re: SQL statement in Perl doesn't work
Message-Id: <4630bd5d$0$8317$e4fe514c@dreader32.news.xs4all.nl>
>
> Are you sure that warning is about $betaald2006? What's the value of
> $vergelijk?
>
Yes, I'm sure that warning is about $betaald2006, because that's on the
line indicated with the warning. $vergelijk = "N". And $betaald2006 can
only be "Y" and "N".
------------------------------
Date: 26 Apr 2007 01:29:05 -0700
From: Klaus <klaus03@gmail.com>
Subject: Re: STDOUT redirection
Message-Id: <1177576145.572869.221680@n35g2000prd.googlegroups.com>
On Apr 25, 10:40 pm, para...@gmail.com wrote:
> Hi have a perl application in on suse64 bit OS, which internally
> redirects STDOUT to a $variable
> using
> This redirects STDOUT to a variable
>
> open OUT ,'>',\$variable
> *STDOUT = *OUT
>
> Now when run the tool
> e.g ./app <test>.txt > out.txt
>
> The application has two parts
> 1. returns all text data in the <test> input as is to STDOUT
> 2. returns function call with return values also to STDOUT
>
> Now what happens is that category 1 collects in out.txt
> while category 2 collects in the $variable
>
> my question is why does STDOUT get split into 2 places and how can I
> avoid it - I want all to goto the variable
I am guessing that your function call has external commands (for
example system(), `...`, qx(), etc...). If that is the case, then the
bad news is that the STDOUT of those external commands will not be
captured by *STDOUT = *OUT
I have never tried it myself, but PerlFaq8: "How can I capture STDERR
from an external command?" might give some ideas.
--
Klaus
------------------------------
Date: 26 Apr 2007 06:28:03 -0700
From: king <hara.acharya@gmail.com>
Subject: use one subroutine's variable value in another subroutine inside a module.
Message-Id: <1177594082.978081.67910@r30g2000prh.googlegroups.com>
I have a module named TPWizardMgr.pm as below.
========================================================================
package TPWizardMgr;
use strict;
use XML::DOM;
sub new
{
my $class = shift;
my $self = {};
bless $self, $class;
# reset all data
$self->{load_school_template} = {};
$self->{get_course_info} = {};
# load school types from config file
$self->{load_school_template} = [];
$self->{get_course_info} = [];
return $self;
}
sub load_school_template
{
my $self = shift;
my $len ;
my $item;
my @years;
my $periods;
my $subject_name;
my @template_subject_period;
my $parser = new XML::DOM::Parser;
my $doc = $parser->parsefile ("/usr/local/apache2/wizard_data/
liceo_classico.xml");
foreach my $school_template($doc-
>getElementsByTagName('subject-templates'))
{
$len = $school_template-
>getElementsByTagName('subject-template')->getLength() ;
@years =
('periods_1','periods_2','periods_3','periods_4','periods_5');
for(my $i = 0;$i<$len;$i++)
{
$item = $school_template-
>getElementsByTagName('subject-template')->item($i);
$subject_name = $item-
>getAttribute('name');
for my $count (0..4)
{
$periods = $item-
>getAttribute($years[$count]);
push
(@template_subject_period, [$subject_name,$years[$count], $periods]);
}
}
}
return @template_subject_period;
}
sub get_course_info
{
my $self = shift;
my $subject_name = shift;
my @years = shift;
my $periods = shift;
my $count = shift;
my @template_subject_period = shift;
print "Please enter period to get subject and number of
periods \n";
my $gotperiod = <>;
chomp($gotperiod);
for(my $i=0;$i <= $#template_subject_period;$i++)
{
print $#template_subject_period . "\n";
print "inside for loop\n";
if($template_subject_period[$i]->[1] eq $gotperiod)
{
push (@template_subject_period,
[$subject_name,$years[$count], $periods]);
print "Subject:\t" .
$template_subject_period[$i]->[0] . $template_subject_period[$i]-
>[2] . "\n";
}
}
return $self->{get_course_info};
}
1;
==================================================================
But I want to use the variable @template_subject_period in the
subroutine get_course_info( ).
I am not able to use this @template_subject_period variable value in
the get_course_info subroutine.
How I can do this.
Thanks in advance.
------------------------------
Date: Thu, 26 Apr 2007 14:12:18 +0200
From: "john.swilting" <john.swilting@wanadoo.fr>
Subject: Re: use POSIX qw(ceil floor)
Message-Id: <46309724$0$25946$ba4acef3@news.orange.fr>
Mark Clements wrote:
> john.swilting wrote:
>> what that wants to say
>> use POSIX qw(ceil floor);
> You're still using automatic translation software: it isn't helping you.
>
> Qu'est que ça veut dire = "what does that/this mean?" (or near enough)
>
> You need to read the docs.
>
> perldoc POSIX
>
> ceil This is identical to the C function "ceil()", returning the
> smallest integer value greater than or equal to the given numerical
> argument.
>
> floor This is identical to the C function "floor()", returning the
> largest integer value less than or equal to the numerical
> argument.
>
> in French:
>
>
http://perl.enstimac.fr/DocFr/perlfaq4.html#perl%20atil%20une%20fonction%20round()%20et%20ceil()%2
(majoration)%20et%20floor()%2
(minoration)%20et%20des%20fonctions%20trigonom%E9triques
>
> Mark
merci je lis un peu l'anglais mais je sais pas l ecrire
serge
------------------------------
Date: Thu, 26 Apr 2007 15:11:14 +0100
From: "John" <john1949@yahoo.com>
Subject: UTF8 European characters in MySQL
Message-Id: <cfudnXnrVqBjL63bnZ2dneKdnZydnZ2d@eclipse.net.uk>
Hi
I have created a table with
DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
However, the European accented characters appear incorrectly.
What is the standard accepted way to read/write European accented characters
in Perl using MySql database?
Regards
John
------------------------------
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 382
**************************************