Re: What is the substitute for $#?

2018-01-26 Thread sisyphus1


From: Chas. Owens
Sent: Saturday, January 27, 2018 9:04 AM
To: Peng Yu
Cc: Perl Beginners
Subject: Re: What is the substitute for $#?

...

You can find the exact value of DBL_DIG on your system with the following 
C code:


...

The POSIX module will also tell you the value of DBL_DIG.

perl -MPOSIX -le "print POSIX::DBL_DIG;"
15

In the event that 'perl -V:nvtype' reports that nvtype is long double, you 
would use the value output by running:


perl -MPOSIX -le "print POSIX::LDBL_DIG;"

and if 'perl -V:nvtype' reports __float128, then the POSIX module won't 
provide you with FLT128_DIG (which is 33).


Cheers,
Rob

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: On Windows 7: Strawberry Perl Portable + Glade + GTK ?

2017-12-06 Thread sisyphus1


From: Peter Schmitz
Sent: Thursday, December 07, 2017 9:29 AM
To: beginners@perl.org
Subject: On Windows 7: Strawberry Perl Portable + Glade + GTK ?

I am trying to set up a development environment on Windows 7, to use Perl 
and Glade.
This environment needs to reside as a collection of directories on a 
shared network drive (say e.g., X:) which can also be accessed by users of 
my code, and it must avoid using C: (as much as possible).


I have copied Strawberry Perl Portable 5.26.1.1 (64bit) 
(http://strawberryperl.com/releases.html) to, say, X:\Strawberry\, and my 
Perl code to X:\code\, and it all runs fine (in a .bat shell window).
I've installed Glade (Glade 3.8.5, 
http://ftp.gnome.org/pub/GNOME/binaries/win32/glade/3.8/) to X:\Glade\, 
and it runs okay and I can create the .glade file okay. (Only I will be 
using Glade, not my end users.)


Now the tricky part (for me at least).
I want to set up whatever else I need to be able to write Perl to add a 
GUI for my existing Perl code using the Glade file I created. (use Glib 
...; use Gtk2 ...; etc.)

(It's the setup part I need help with, not writing the Perl code.)
I have reviewed a lot of web pages that contain install guidance, but I am 
still a little lost about how to integrate GTK in this situation, and I am 
seeking any advice on the best way to proceed.
I guess I need (at least) a GTK+ or GTK2 runtime environment that works 
with Strawberry and Glade, plus setting up Windows environment variables 
properly. (?)


I would really like to stick with Strawberry and Glade if possible.
Strawberry has build tools, so I am not adverse to compiling if necessary, 
but I would prefer to avoid that if possible and to just get some 
appropriate GTK binaries, plus some set up guidance.
I need to avoid impact to C:, so e.g., installing MSYS2 is not feasible in 
this situation.

Thanks very much for any help.
- Peter


Hi Peter,

Not sure if it's what you're after, but I have ppm packages for a number of 
Glib, Gtk2 and Gtk3 modules at:


http://www.sisyphusion.tk/ppmindex.html

Looking at that list of available modules, I see:

Cairo-GObject-1.004
Cairo-1.106
Glib-IO-0.001
Glib-Object-Introspection-0.044
Glib-1.325
Gnome2-Canvas-1.002
Gtk2-GladeXML-1.007
Gtk2-WebKit-0.09
Gtk2-1.24992
Gtk3-0.033
HTTP-Soup-0.02
Image-LibRSVG-0.07
Pango-1.227

I think Strawberry's ppm utility is aware of this ppm repository, so you can 
install them with (eg) :


ppm install Glib

If Strawberry's ppm utility is unaware of that repo (and therefore can't 
find the ppm packages) just run"


ppm repo add http://www.sisyphusion.tk/ppm

These packages are built against Gtk2-2.24.28 (Glade-3.20.0), and they are 
set to ignore any Gtk2 and Glade installations on the local machine.


If, having installed them, they turn out to be unsuitable then you can 
remove them by running (eg):


ppm remove Glib

For some of those modules, "ppm install" will install additional files by 
running a post installation script, and I'm not sure that 'ppm remove' 
actually removes those "additional" files.
However, the packages install no files that will clash with other apps, so 
there's really no need to run 'ppm remove' anyway and, in any case, manual 
removal is a fairly simple process.


If you think this might be useful to you, but strike problems, just let me 
know and I'll help out where I can.


Cheers,
Rob

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: perl -e 'my $i = 0; $i = defined($i) ? (!!$i) : 0; print "i: $i\n";'

2017-07-06 Thread sisyphus1


From: David Mertens
Sent: Friday, July 07, 2017 12:07 PM
To: Sisyphus
Cc: Chas. Owens ; hw ; Perl Beginners
Subject: Re: perl -e 'my $i = 0; $i = defined($i) ? (!!$i) : 0; print "i: 
$i\n";'

On Thu, Jul 6, 2017 at 9:12 PM,  wrote:
I find it a little surprising that use of the '!' operator is all that's 
needed to add the stringification stuff:


...

If the '!' operator didn't do that, then I believe the OP would be seeing 
precisely what he expects.


So ... why should the '!' operator *not* respect the string/numeric 
context of the operand ?


Perl is highly unusual in that the operator, not the operand, dictates the 
context.


Good point - and one that I hadn't got around to noticing.

Therefore, the '!' operator has to be set up to either:
a) operate always in numeric context;
or
b) operate always in string context;
or
c) operate always in both contexts (as per the current behaviour).

Having an ambivalent '!' operator (where it  alternates between a) and b), 
according to the operand's flags) is therefore not an option.


If we wanted an operator for "logical string negation" and an operator for 
"logical numeric negation" we would need 2 different operators.


Have I got that  somewhere near right ?

Cheers,
Rob 


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: perl -e 'my $i = 0; $i = defined($i) ? (!!$i) : 0; print "i: $i\n";'

2017-07-06 Thread sisyphus1


From: Chas. Owens
Sent: Friday, July 07, 2017 12:34 AM
To: hw ; beginners@perl.org
Subject: Re: perl -e 'my $i = 0; $i = defined($i) ? (!!$i) : 0; print "i: 
$i\n";'

On Thu, Jul 6, 2017 at 9:38 AM hw  wrote:
Chas. Owens wrote:

$i started off as an IV, but gets promoted to a PVIV by being used in 
string context.


I find it a little surprising that use of the '!' operator is all that's 
needed to add the stringification stuff:


C:\>perl -MDevel::Peek -le "$i=0; Dump($i); Dump(!$i);"
SV = IV(0x93ece0) at 0x93ece4
 REFCNT = 1
 FLAGS = (IOK,pIOK)
 IV = 0
SV = PVNV(0xb0a934) at 0xb03090
 REFCNT = 2147483644
 FLAGS = (IOK,NOK,POK,READONLY,pIOK,pNOK,pPOK)
 IV = 1
 NV = 1
 PV = 0xb0330c "1"\0
 CUR = 1
 LEN = 12

If the '!' operator didn't do that, then I believe the OP would be seeing 
precisely what he expects.


So ... why should the '!' operator *not* respect the string/numeric context 
of the operand ?
Why does it insist on logically negating *both* the numeric and string slots 
of the variable, even when those slots are initially unset ?


Maybe it's just that that's the way it has always been done - or maybe 
there's a more convincing reason ?


Cheers,
Rob

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Where to put xs files?

2016-06-09 Thread sisyphus1

From: Alex Becker
Sent: Thursday, June 09, 2016 4:45 AM
To: beginners@perl.org
Subject: Where to put xs files?
Hi!


Where do I put xs files in a module distribution?

For example, the module Tk::IDElayout contains the following files:
* CaptureRelease.pm
* CaptureRelease.xs
* WmCaptureRelease.c
* WmCaptureRelease.h

They are currently all located in the root folder of the module dist.

If I would move the file CaptureRelease.pm to lib/Tk/CaptureRelease.pm, 
would I have to move the xs file, too?


No - I see other distros where the pm file is under lib/ but the xs file is 
still in the top level directory.
However, it may also work ok if you move the xs file to the same place as 
the pm file.
I don't know the rules involved here, and there might even be configuration 
options that provide additional flexibility.


I recommend testing any alterations you make to the layout as you go.

And ask again if you can't get your preferred layout to work.

Cheers,
Rob 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Will Strawberry Perl installation cause any conflicts with pre-existing Actoive State Perl on W2008 server?

2015-11-17 Thread sisyphus1



-Original Message- 
From: Kenneth Wolcott

Sent: Wednesday, November 18, 2015 5:23 AM
To: sisyph...@optusnet.com.au
Cc: Perl Beginners
Subject: Re: Will Strawberry Perl installation cause any conflicts with 
pre-existing Actoive State Perl on W2008 server?


Apparently Strawberry Perl did inject itself into the Windows PATH 
variable resulting in more than one Perl executable being found by the 
build process that builds the installer. (Not sure if Strawberry Perl was 
earlier in the path or not, but I suspect that it the fact that there were 
more than one location of "perl.exe" in the path that was the cause of the 
problem, not that Strawberry Perl was earlier in the path than Active 
State).


Sounds like you didn't install one of the "portable" versions, such as those 
named "PortableZIP" from http://strawberryperl.com/releases.html.


Those versions don't have an installer - you just unzip them to a location 
of your choice, and that's it.
In so doing, the StrawberryPerl perl.exe will be placed into a location that 
was previously non-existent - so it can't possibly be in the system path 
unless someone takes the (misguided) step of adding that location.


The only time it gets into the path is when you open a shell by executing 
portableshell.bat - whereupon it adds its own directories to the beginning 
of the PATH. But that setting affects only that specific shell - all other 
shells (eg those opened up by executing cmd.exe) will be unaffected.


If ActivePerl is in your system path, then it will also be in the PATH of 
the shell opened up by portableshell.bat, but it will occur after 
StrawberryPerl. I don't think that should be a problem  - but if it is, you 
could rewrite portableshell.bat such that ActivePerl is excluded from the 
path. (This might not be trivial if you're installing strawberry on multiple 
machines that have different layouts - would still be do-able, but.)


As well as there being a "perl.exe", strawberry also ships with "perl5.x.x". 
Other solutions would be to remove the StrawberryPerl "perl.exe" and invoke 
its perl instead as "perl5.22.0" (or whatever).
You could (untested) even rename "perl.exe" to (eg) "sperl.exe" to avoid 
name clashes.

Is there any imperative that Strawberry Perl *has* to be invoked as "perl" ?

Sorry - I probably should have explained a bit more in my initial reply, but 
I was relying more on follow-up questions rather than trying to cover in 
advance the various scenarios that might hypothetically arise.


Cheers,
Rob



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Will Strawberry Perl installation cause any conflicts with pre-existing Actoive State Perl on W2008 server?

2015-11-13 Thread sisyphus1
-Original Message- 
From: Kenneth Wolcott

Sent: Saturday, November 14, 2015 6:11 AM
To: Perl Beginners
Subject: Will Strawberry Perl installation cause any conflicts with 
pre-existing Actoive State Perl on W2008 server?


 Can I install Strawberry Perl on a W2008 Server without adversely 
affecting a currently installed Active State Perl?


Yes.

Best way, imo, is to install the "portable" edition of Strawberry Perl, as 
it doesn't make (nor does it need) any alterations to the path.
To run it, you just double-click on the portableshell.bat that ships with 
it, and use the shell that opens up.


Complete removal of the portable Strawberry Perl installation can be done 
easily at any time - just remove the entire directory in which it's 
installed.


Cheers,
Rob 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: can locate pm

2015-02-18 Thread sisyphus1


From: nicolas
Sent: Thursday, February 19, 2015 10:14 AM
To: beginners@perl.org
Subject: can locate pm
Hello,

I used to work with a perl script that contains (use vt.pm). (vt.pm are 
code that complement the script) I remember that I have to copy the vt.pm 
file in perl somewhere. Since I am not very familar with programming my 
question is where to excaclly copy this *.pm so I can use my script again.

Thanks

Can't locate lib/vt.pm in @INC (you may need to install the lib::vt 
module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 
/usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 
/usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at 
sequence.pm line 8.


You can place vt.pm in any of the @INC locations you've listed above.
The normal (default) location is the one specified by running:

 perl -V:sitelib

and that's where I would recommend putting it.

Cheers,
Rob



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Argument isn't numeric warning in if statement

2014-09-16 Thread sisyphus1
-Original Message- 
From: SSC_perl

Sent: Wednesday, September 17, 2014 10:37 AM
To: Perl Beginners
Subject: Argument isn't numeric warning in if statement

I just ran across something puzzling.  Why are these two statements not 
equivalent when it comes to warnings?


if ($item->{'optionprice'}) {
$item->{'unitprice'} += $item->{'optionprice'};
}

and

$item->{'unitprice'} += $item->{'optionprice'} if 
($item->{'optionprice'});


Given the following values:

$item->{'unitprice'}   = '12.16';
$item->{'optionprice'} = '';


the 2nd statement returns an "Argument '' isn't numeric in addition (+)" 
warning, while the 1st one doesn't.  I thought I read where Peal reads a 
statement like the 2nd one from right to left.  It looks like it doesn't, 
since $item->{'optionprice'} is evaluated in spite of the 'if'.  Am I 
mistaken?


Perl 5.10.1


Can't reproduce the anomaly here on 5.10.0 and 5.12.0 - I don't have 5.10.1.

##
C:\_32\pscrpt>type try.pl

use warnings;

$item->{'unitprice'}   = '12.16';
$item->{'optionprice'} = '';
$item->{'unitprice'} += $item->{'optionprice'} if ($item->{'optionprice'});

C:\_32\pscrpt>perl try.pl

C:\_32\pscrpt>
##

Are you sure you've quoted the code (that's producing the warning) correctly 
?


Cheers,
Rob



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: CPAN unavailable

2014-05-20 Thread sisyphus1


From: Yonghua Peng


Do you know why these days cpan.org has been unavailable?


I don't know why, but it has been down (often for lengthy periods) quite a 
bit lately.

Thankfully, https://metacpan.org seems to be always available.

Cheers,
Rob 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: List-AllUtils-0.07

2014-03-18 Thread sisyphus1


From: Yosef Levy


I can't find: List::Util 1.31 in CPAN distribute.


That's right - there is no distribution named List::Util.
Scalar::List::Utils is the name of the distribution that contains the module 
named List::Util.


Install Scalar::List::Utils and you'll be right :-)

(In general, if you can't find a "Distribution" of a certain name, try 
searching for a
"Module" of the same name ... better still, just search "All" to begin 
with.)


Cheers,
Rob 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Installing Module::Build::Tiny from CPAN fails . . . because it requires Module::Build::Tiny!?! WTF?

2014-02-15 Thread sisyphus1
Hi Marc,

Version 0.034 installed ok for me on Strawberry Perl.

The simple.t test script was unable to unlink a dll it had created and produced 
a few warnings in relation to that – but the tests still passed and the module 
installed.

(Strawberry Perl ships with Module-Build-Tiny, so in order to emulate your 
situation I removed it before trying to install the module using 
cpan.)

Cheers,
Rob

From: Marc Perry 
Sent: Sunday, February 16, 2014 8:34 AM
To: beginners@perl.org 
Subject: Installing Module::Build::Tiny from CPAN fails . . . because it 
requires Module::Build::Tiny!?! WTF?
Has anyone else encountered this?  I had to dig down deep in my testing lore 
and run 'prove -v t/simple.t' before I could find the STDERR that revealed 
this.  When I reviewed the files in the Module, sure enough:
use Module::Build::Tiny (which unfortunately I don't have and am trying to 
install).  Surely this is a bug?

--Marc

Re: REG: How to add perl repository in PPM

2013-06-28 Thread sisyphus1


From: Anitha Sreejith Victor
Please suggest with the steps to add number of available perl repositories 
in PPM->edit->preferences->repository.
I also tried to add the same , but ended up with 401 Authorization 
required.


Which repositories were you trying to add when you got the 401 error ?

If you're using ActivePerl, then their mailing lists 
(http://lists.perl.org/list/activeperl.html) might be a better place to ask 
about PPM.


Cheers,
Rob


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: dmake can't find config.h, and collector throws error when trying to compile perl-static.exe (perl-5.18.0 / mingw)

2013-05-26 Thread sisyphus1



-Original Message- 
From: R. S.



dmake -f makefile.mk
==
del /f config.h
Can not find D:\perl\win32\config.h.
copy config_H.gc config.h
Number of copied files: 1.


That looks pretty normal to me.
The 'del /f config.h' command is executed to remove any existing config.h - 
then config_H.gc is copied across to config.h.


At the time that 'del /f config.h' is run, 'config.h' does not exist, which 
produces the warning 'Can not find D:\perl\win32\config.h.'.


I get essentially the same:

#
C:\_32\comp\perl-5.18.0\win32>dmake -f makefile.mk
del /f config.h
Could Not Find C:\_32\comp\perl-5.18.0\win32\config.h
copy config_H.gc config.h
   1 file(s) copied.
#

Your problem is something else.
I haven't tried building a static perl for ages.

Btw, if you're intending to install your perl into D:/perl, it's not a good 
idea to compile perl in D:/perl. Better to place the source somewhere 
(anywhere) else and do the compiling there.


I think that the p5p (perl5 porters) mailing list would be a better forum 
for this. (The perlmonks web forum would also accommodate this quite 
happily.)


I use version 4.12 of dmake.

Cheers,
Rob




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: am I missing something?

2013-03-03 Thread sisyphus1



-Original Message- 
From: Chris Knipe 


my @array = (1..10);
foreach my $number (@array) {
  next if $number == 5;
  print $number;
}


I can't reproduce the problem.
Works as expected for me, and outputs:
1234678910

Cheers,
Rob

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/