Re: A Philosophical Point To Be Made: The Truth

2021-10-18 Thread Brandon McCaig
https://www.youtube.com/watch?v=xhAoN7g-xLs That is another attempt to reach you. Please try again if I haven't yet. I'm disappointed there has been no feedback yet. I know that it's off-topic, but at least yell at me for that, geez. :) Regards, -- Brandon

A Philosophical Point To Be Made: The Truth

2021-10-16 Thread Brandon McCaig
ssion because of its relationship to linguistics and software. Though I dare not try to send it their way directly without a push (and maybe a direction). Feedback, constructive or otherwise, is welcomed and encouraged. Regards, Brandon McCaig < bamb...@castopulence.org> Ca

Re: data structure for Template Toolkit

2018-10-30 Thread Brandon McCaig
Sorry for the noise. This reply was intended for on-list, but apparently I'm a bit rusty and hit the wrong key. On Tue, Oct 30, 2018 at 02:41:46PM -0400, Brandon McCaig wrote: > On Tue, Oct 30, 2018 at 07:34:11AM -0500, Rick T wrote: > > Still, if anyone can point me to a “begin

Re: local and auto flush

2018-05-29 Thread Brandon McCaig
tents = do { local $/ = undef; # Temporarily set read record separator <$file_handle>; # to undefined to slurp the whole file. }; Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bambams.ca/> perl -E '$_=q

Re: Write a plugin for an IRC bot

2016-03-22 Thread Brandon McCaig
, > next => sub { > print "tick...\n"; > $_[KERNEL]->delay(next => 1); # *** > }, > }); It appears that delay() is a standard method that can trigger an event after some amount of time. Regards, -- Brandon

Re: Perl executable problem...

2015-11-13 Thread Brandon McCaig
hing you need to build and install most Windows-compatible CPAN modules. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bambams.ca/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjn

Re: Multi line file handling

2015-10-19 Thread Brandon McCaig
=~ /window/i) { print "Contents of file.txt matched window.\n"; } Even though a lexical file handle will automatically be closed when it goes out of scope it's still a good practice to manually close it and check for errors. close $fh or warn "close: $!"; Re

Re: Sockets getting stuck

2015-10-13 Thread Brandon McCaig
gramming API to save yourself such low-level headaches. The code to deal with sockets robustly is complicated and that wheel already exists in several forms. Check CPAN for something more appropriate. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Bl

Re: reading from socket

2015-09-18 Thread Brandon McCaig
ial that > I'm overlooking, or a bug somewhere in perl / Net::Server. That's a reasonable route to take. Be sure to let us know if you do get private help so that we know to stop. :) I'll attempt to look at the files from your latter E-mail, but without having a complete program to w

Re: reading from socket

2015-08-12 Thread Brandon McCaig
ge have to this program? Note also that you appear to be sending HTML E-mails (see the Internet for why that's evil), which could also potentially mean that what I'm reading in plain text isn't exactly what you intended to send... It all depends on your MUA. You may gain some comfort know

Re: reading from socket

2015-08-12 Thread Brandon McCaig
data stream is encoded (and that is completely out of my > control). But there must be a adequate and proper way to > handle this data. I don't think the data stream is encoded overly whacky. I think the problem is just that writing computer software is *hard*. It takes a bit of exp

Re: reading from socket

2015-08-11 Thread Brandon McCaig
doesn't. You may need to look for that terminating sequence in the middle of the buffer. You could use Data::Dumper and/or various poor-man's debugging techniques to try to identify the problem here. You could write what you read to a file and inspect that file with a hex editor afterw

Re: self Introduction

2015-08-10 Thread Brandon McCaig
On Mon, Aug 10, 2015 at 10:41:12AM -0400, Brandon McCaig wrote: > I'm afraid that I'm not familiar with OWP so please forgive my > ignorance. Errr, OPW*. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bambams.ca/&

Re: self Introduction

2015-08-10 Thread Brandon McCaig
the basic cpan command. P.S., Consider configuring your mail client to send E-mails in plain-text format. This helps to preserve formatting of messages and especially source code, even for those of us that are reading from text-based interfaces. It's also a generally good netiquette and preferre

Re: convert linear array to nested structure

2015-08-04 Thread Brandon McCaig
On Tue, Aug 4, 2015 at 5:06 PM, Brandon McCaig wrote: > my %prev = (1 => { kids => \@output }); Perhaps a more adequate identifier for this hash would have been %parents. *shrugs* Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/

Re: convert linear array to nested structure

2015-08-04 Thread Brandon McCaig
On Sat, Aug 1, 2015 at 12:39 PM, Simon Reinhardt wrote: > Am 30.07.2015 um 20:42 schrieb Brandon McCaig: >> I'll give you my 2 cents for whatever that's worth. >:) > > Thanks for your many comments. > > The updated full project code is below. Feedback is appr

Re: convert linear array to nested structure

2015-07-30 Thread Brandon McCaig
ing } and elsif ... lines. Again, it's a style thing, but if you're already going half-way towards sharing a line I don't see the harm in going all the way. ;) $string =~ s/\\(.)/ if ($1 eq "\\" or $1 eq "\"") { $1;

Re: To use signatures or not to use?

2015-07-22 Thread Brandon McCaig
e from the language. And I can't imagine anything that would break it. It's probably safe assuming you can require such a modern perl. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bambams.ca/> perl -E '$_=

Re: Display a hash in the order of an array

2015-07-17 Thread Brandon McCaig
On Fri, Jul 17, 2015 at 10:40 AM, Brandon McCaig wrote: > for my $i (0..4) { Errr, 0..3. >_> Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bambams.ca/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{

Re: Display a hash in the order of an array

2015-07-17 Thread Brandon McCaig
200.220/baz', }, '15/Jul/2015:10:30:03 +0200' => { ip => '1.0.0.127', action => 'GET http://1.0.0.127/foo/bar', }, ); my $ip_logs = transform_date_logs_to_ip_logs(\%date_logs); for my $ip (sort { cmp_ip_addresses() } @ip_addresses

Re: Use of uninitialized value $j in numeric eq (==) at myfile line 125

2015-07-03 Thread Brandon McCaig
problem. I suspect the issue here is lexical scope combined with the lack of strict, but it could be any number of things. It also appears as though you're trying to write a square HTML parser of sorts. I'd suggest using one of the CPAN modules that already exist for this purpose. Don't

Re: problem with regex qr operator

2015-06-25 Thread Brandon McCaig
in qr// the i is added back to the pattern. Without it is left off. The modifiers on the m// won't have any affect to the enclosed pattern. An alternative solution is to include the modifier directly in the regex by prefixing it with (?i). For example, if the patterns are dynamic (user-suppli

Re: perl function for byte to MB conversion

2015-05-25 Thread Brandon McCaig
to do unit conversions then I didn't have much success searching for a module that contained the logic for that. That doesn't mean one doesn't exist, but I failed to find it. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://ww

Re: last statement in a package

2015-05-21 Thread Brandon McCaig
sugar around `require' (plus some stuff), which is like syntactic sugar around `do' (plus some stuff). require is the one checking the return value of the module code and raising an exception on falsy values. perldoc -f use perldoc -f require perldoc -f do Regards, -- Brandon McCaig

Re: Removing text

2015-05-19 Thread Brandon McCaig
On Tue, May 19, 2015 at 1:10 PM, Brandon McCaig wrote: > 1234567890Richard: Sorry, that should have been just "Richard:". I will blame my flaky browser-based user interface. I should have switched to mutt to write that. Regards, -- Brandon McCaig Castopulence So

Re: Removing text

2015-05-19 Thread Brandon McCaig
'm not saying this is a better or more robust solution than hacking it up in bash, but at least by using Perl you have the full power of Perl without switching between bash, grep, awk, and perl. The Interwebz suggests that checking /proc would be a better solution, though that would vary by t

Re: Inhomogeneous data in a database

2015-04-16 Thread Brandon McCaig
On Thu, Apr 16, 2015 at 10:56:22AM -0400, Brandon McCaig wrote: > /*or use foreign key if you wish*/ "content" AS target_type, Doh! That should have been the same as the second part of the union: > b.target_type_id AS target_type, Regards, -- Brandon McCaig Casto

Re: Inhomogeneous data in a database

2015-04-16 Thread Brandon McCaig
position, a.link_text, b.target_type_id AS target_type, c.script_id AS target_id FROM navigation a, target_type b INNER JOIN html_navigation c ON a.navigation_id = c.navigation_id WHERE b.name = 'script'; Untested. Meant purely to illustrate the idea. Let me know if you have an

Re: Need Advice on Perl learning

2015-04-15 Thread Brandon McCaig
s people have already proposed good directions to go. We rarely venture into the higher-level Perl here (not that it's unwelcome either), though there are many other Perl-based mailing lists to consider that may go into more advanced usage. Regards, -- Brandon McCaig Ca

Re: split regex

2015-03-21 Thread Brandon McCaig
ode it is always a good idea to post the code you're struggling with. It's a little bit difficult to understand what you were having trouble with, but if you had posted code then there would have been several anxious persons able to spot the problem and rushing to be the first to reply. :) Reg

Re: catching utf8 errors

2015-03-14 Thread Brandon McCaig
;t figure out any way to control the CHECK parameter used by PerlIO. The weird thing is that the documentation appears to assert that PerlIO is supposed to be using Encode::FB_CROAK() (1) too, but alas I guess that isn't the case if it doesn't croak().. That or the PerlIO layers are ca

Re: Use vs Require with version number

2015-03-04 Thread Brandon McCaig
NAME' so there may also be cases where you'd want to use `do' instead, but most of the time use is more appropriate, and less often require is more appropriate. For the detailed explanation take the time to read through the following: perldoc perlmod (search for BEGIN) perldoc -f u

Re: CONFIG_FILE

2015-02-20 Thread Brandon McCaig
If there's a programmer that you work with that is responsible for this then bring him coffee or beer and he'll gladly fix you up. Or worst case, if the guy responsible is long gone perhaps you could attach a zip file or tarball of all of the code that you have and a kind, bored sou

Re: can locate pm

2015-02-18 Thread Brandon McCaig
::lib" which is a similar idea. Or just copy the file to one of the paths already listed and get on with your day. :) Hope that helps. Let us know if it works. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bambams.ca/> perl -E

Re: simple module install via CPAN not working.

2015-02-17 Thread Brandon McCaig
tware. I use perlbrew to install both up-to-date perl and cpanm. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bambams.ca/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.}; tr/

Re: question of what can respond to die [...]

2015-01-27 Thread Brandon McCaig
whether that path exists. It is merely there to resolve a relative path into an absolute path. You might do so in order to create a new file with that path, and then tell the user what that full path is so there is no ambiguity. If it were to die() when that path didn't exist it would be imp

Re: should this old forumulation still work?

2015-01-20 Thread Brandon McCaig
rp with the chomp option and joining the lines afterward though. I suppose there's always Benchmark.pm to give you a hint about what works better if it matters. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bambams.ca/> perl -E &

Re: Looping regexes against a list

2015-01-20 Thread Brandon McCaig
On Tue, Jan 20, 2015 at 10:21 AM, Brandon McCaig wrote: > perldoc -f qr// I was sure that worked in my up-to-date perlbrew environments, but it isn't working in Cygwin running perl 5.14.2 so in the event that it doesn't work for you look at `perldoc -f qr' and `perldoc perlop

Re: Looping regexes against a list

2015-01-20 Thread Brandon McCaig
ession's being text I think the only other solution is restructuring the program... You can look into using Benchmark.pm to compare the performance of different approaches. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bambams.ca

Re: Looping regexes against a list

2015-01-19 Thread Brandon McCaig
x27;m any authority on this problem. :\ [1] http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bambams.ca/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbr

Re: Parsing multi column files

2015-01-18 Thread Brandon McCaig
me: $!"; return \@insults; } sub random_insult_chain { my ($insults) = @_; my @words = map random_insult_word($_), @$insults; return @words; } sub random_insult_word { my ($insult_column) = @_; my $i = get_random_index @$insult_column; my $word = $insult_column->[$i]; return $word; } __END__ Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bambams.ca/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.}; tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say' signature.asc Description: Digital signature

Re: Parsing multi column files

2015-01-18 Thread Brandon McCaig
l -Mwarnings -e 'my @x = (1..10); print @x[4], "\n";' said: > Scalar value @x[4] better written as $x[4] at -e line 1. > 5 And with that, it should be emphasized to always use the strict and warnings pragmas. :) Regards, -- Brandon McCaig Castopulence Software &

Re: Parsing multi column files

2015-01-18 Thread Brandon McCaig
t; } > close $fh or die "could not close $file: $!\n"; > } > > get_columns( 'insults2.txt' ); > > for ( 1 .. $MAX ){ > my @line = ( > @first[rand(@first)], > @second[rand(@second)], >

Re: How does opendir/readdir process files

2015-01-15 Thread Brandon McCaig
Bdr Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bambams.ca/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.}; tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say' signature.asc Description: Digital signature

Re: How does opendir/readdir process files

2015-01-13 Thread Brandon McCaig
On Tue, Jan 13, 2015 at 10:40:46PM -0500, Brandon McCaig wrote: > to spend some quality time with The Revelant Manuals (TFM). I cite this as proof that I am TFT (too fucking tired). I'm not going to confess how proud I was of this word play before I realized that it was completely non

Re: How does opendir/readdir process files

2015-01-13 Thread Brandon McCaig
my $filename = $_->[0]; return $filename; } my @files = readdir($dh); my @reg_files = grep \&my_filter, @files; my @file_tuples = map(\&my_mapper, @reg_files); my @sorted_tuples = sort \&compare_mtimes, @file_tuples; my @sorted_files = map \&extr

Re: How does opendir/readdir process files

2015-01-13 Thread Brandon McCaig
mention that support for arrays was added in 5.14 along with references? Hopefully I got that right this time. :) Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bambams.ca/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg q

Re: How does opendir/readdir process files

2015-01-09 Thread Brandon McCaig
lues", and "sort". Your usage should not depend on 5.14. Starting with 5.14, the EXPR passed to each() can be a reference to an array or hash instead of the data structure themselves, which will be automatically dereferenced. I believe that is the only bit of the functionality that

Re: Get return value when running cmd like this

2015-01-05 Thread Brandon McCaig
ng the pipe succeeded, but the exit status was # non-zero. my $signal = $child_error & 127; my $status = $child_error >> 8; handle_pipe_exit($signal, $status); } else { # One or more system calls failed when attempting to # close th

Re: say,

2015-01-05 Thread Brandon McCaig
rl does or something that the C runtime or OS is doing for us. In Windows you should be able to experiment with tee(1) in the middle and/or binmode on either or both ends of the pipe anyway. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http:/

Re: say,

2015-01-05 Thread Brandon McCaig
n you can just use print normally. use strict; use warnings; $\ = "--->"; print for qw/foo bar baz/; __END__ Output: foo--->bar--->baz---> Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bamccaig.com/&

Re: Script for auto conf

2014-12-29 Thread Brandon McCaig
l get a lot more help from us by showing us something. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bamccaig.com/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.}; tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say' signature.asc Description: Digital signature

Re: IO::Socket

2014-12-29 Thread Brandon McCaig
appers for networking in Perl to save yourself the trouble of reinventing the square wheel. YMMV. Raw socket access or experience shouldn't really be necessary if using one of the higher-level wrappers so you can spare yourself the nightmares if all you need is networking. :) Regards, -- Brandon M

Re: Anonymous functions and safe compartments

2014-12-28 Thread Brandon McCaig
A few corrections on my part... On Sun, Dec 28, 2014 at 04:35:49PM -0500, Brandon McCaig wrote: > > sub func1{ > > say "About to run shared function!"; > > $anon_func->("func1"); > > } Oh, duh, there is func1 right there. :\ OK, that part makes

Re: Anonymous functions and safe compartments

2014-12-28 Thread Brandon McCaig
out a little contrived example to figure this out myself: ./program: #!/usr/bin/env perl use strict; use warnings; use Safe; my $sandbox = Safe->new(); $sandbox->permit(qw/print/); # Shared variables cannot be lexicals! our $get_id = do { my $id = 0; sub { my ($base) = @

Re: parsing string output that isn't CSV, but similar; what module would parse these kind of key-value pairs?

2014-12-16 Thread Brandon McCaig
x27;]*)'/g; (Untested) See documentation on m// and /g. If you want something to actually do parsing I have heard that Text::Balanced <https://metacpan.org/search?q=Text::Balanced> is a good direction to go, but I can't say for sure whether it will solve this prob

Re: Can't find EOCD signature Archive::Zip

2014-12-05 Thread Brandon McCaig
Perl). There is also an Archive::Any that claims to work as a magical dispatcher to automatically do the right thing for supported formats. You could try that, though again I don't know if it would support raw gzip files that don't contain tarballs. If you still need help let us know what y

Re: Unable to install Net::IP

2014-12-02 Thread Brandon McCaig
lly the system perl (e.g., /usr) is asking for trouble or at least pains too simply because you either need root (see above) or need to do magic to not need to, and typically it is out-of-date (though Ubuntu may keep it more up-to-date than other distros, I believe that is still several releases back).

Re: why is if (! @ARGV) skipped

2014-11-29 Thread Brandon McCaig
On Fri, Nov 28, 2014 at 9:40 AM, Brandon McCaig wrote: > # Protip: I'm not sure which is better, interpolating $status > # into the format string, or passing it as an argument. I'm > # sure it's negligible in this case. > printf "<%-60s> $sta

Re: why is if (! @ARGV) skipped

2014-11-28 Thread Brandon McCaig
my $filename = $_; unless(is_editor_garbage($filename)) { return; } unless($force || confirm_unlink($abs_path)) { report($abs_path, 'skipped'); return; } unlink_file($abs_path); } > } >} > }, @trgs > ); I&

Re: copy unicode (UCS-2) file

2014-11-26 Thread Brandon McCaig
because they can't be. It's not a problem with a perfect solution. The best option is to have the machine or user that is giving you data also tell you what the format/text encoding of it is. A simple way to do this is to implement a command-line option in your program (e.g., see Getopt::

Re: UTF8, UTF-8, utf8, Utf8 encoding blues

2014-11-10 Thread Brandon McCaig
ers are read. Perhaps that will shed some light on the issue. Or not... What you really need is a specification for the data that you're reading. If you don't know what you're reading then it's basically impossible to properly read it. Regards, -- Brandon McCaig Castopulence Softw

Re: (Possibly a terrible lamer) is `open' format wrong

2014-11-04 Thread Brandon McCaig
user input): > bash$ perl example > ';echo Sneak attack!;echo ' > First pipe: > Second pipe: > ls: cannot access ';echo Sneak attack!;echo ' > : No such file or directory > ls: cannot access : No such file or directory > Sneak attack! WHOA,

Re: Make a sub routine return

2013-09-04 Thread Brandon McCaig
stead though, see my next point. > exit; Rather than exit()ing from a subroutine, it is often better to either return a value indicating failure (e.g., boolean or error status) or die() instead. This lets the caller decide if they want to give up or do something else. Not only ca

Re: Creating a Perl web site, how should I build this

2013-07-03 Thread Brandon McCaig
only have a simple program that will become a single Web page that just needs to run and generate some simple HTML output then it might well be easier to just hack up a CGI program and wire it up with whatever Web server is currently available. Your mileage may vary... And of course, there are m

Re: accessing variables in subroutines

2013-06-27 Thread Brandon McCaig
ly. However, just throwing everything into a single structure accomplishes nothing. That said, you can take references to data in Perl and pass those instead. The idea is very similar to pointers in C or references in C++. You could do this to avoid the overhead of copying the structure

Re: last

2013-06-25 Thread Brandon McCaig
last; > } > ' > Exiting subroutine via last at -e line 8. Touché. :) Apparently I left out strict and warnings from my one-liners and carelessly translated them into strict programs without verifying... :-[ Thanks for catching my mistakes. Nevertheless, it still works, bu

Re: Tips or Tricks to print out tab-separated data?

2013-06-24 Thread Brandon McCaig
the wrong subroutine. Using parenthesis as John specified solves the problem; or by alternatively using say() instead of print(), which automatically writes a newline after writing the arguments. say() is only available in non-ancient perl's and only available when enabled (typically by -E or u

Re: last

2013-06-24 Thread Brandon McCaig
nstructs and they are not compatible. And it's a good thing because I find that hypothetical syntax quite difficult to read. Using English terms, what you're attempting to say is more like: "Stop here if we've iterated thrice write 'if' tracing message." Obviou

Re: last

2013-06-24 Thread Brandon McCaig
benefit the code any. They're certainly helpful to jump several levels in a clean way. though I wouldn't oppose using a goto for that in languages that lack labelled next/last/continue/break statements. >:) Regards, -- Brandon McCaig Castopulence Software <https://www.castop

Re: make and Makefile.PL

2013-05-28 Thread Brandon McCaig
ake install Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bamccaig.com/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.}; tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say' signature.asc Description: Digital signature

Re: help with some code

2013-05-23 Thread Brandon McCaig
least give you an easy button to jump right in, which is ideal for beginners). If you're new to Linux then you'll have that hurdle to climb first, but in the long run I think it'll balance out... Good luck. :) Regards, -- Brandon McCaig Castopulence Software <https://www.castopu

Re: curiosity about the usage of my

2013-05-09 Thread Brandon McCaig
mers to avoid waste, but not if it comes at the expense of reliability, security, or robustness. Using my() and our() takes very little effort and is well worth the investment. /rant Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www

Re: problem with File::Util::readlimit

2013-05-09 Thread Brandon McCaig
and he plans to release it soon as "mature". So maybe keep an eye out for that too. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bamccaig.com/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\'

Re: problem with File::Util::readlimit

2013-05-08 Thread Brandon McCaig
$arg; >} > >return $READLIMIT; > } Looks like it raises an exception if the argument doesn't match a NON-"digit" character. Which seems like the opposite of what is wanted. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/&

Re: Lines written to a file are not contiguous

2013-05-07 Thread Brandon McCaig
ine, so the additional one that you're writing there is likely causing duplicates in the output. And for future reference, non-ancient versions of Perl have a say() alternative to print() that appends a newline for you. > close(WRITE) || die "Unable to close $write_file: $!\n"; > close(READ) || die "Unable to close $file: $!\n"; > } > } > > 1; If that isn't enough to figure out your problem then I think you're going to have to take another shot at explaining what it is that you're trying to achieve, and what you're getting instead. Many of us will not have the aforementioned book so you should try to explain it to us assuming no external knowledge. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bamccaig.com/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.}; tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say' signature.asc Description: Digital signature

Re: split

2013-05-03 Thread Brandon McCaig
at will work on all possible HTML inputs). You're far better off learning to use one of the HTML parsing modules because that will give you a reliable mechanism to process HTML data. If you just want to learn how to use split then by all means go for it. Just don't expect to get meaning

Re: Can't close filehandle

2013-05-01 Thread Brandon McCaig
On Wed, May 01, 2013 at 11:45:00AM -0400, Brandon McCaig wrote: > One thing that I know bit me with the 'or die' pattern is that > with a pipe if the child process exits with an non-zero exit > status then close returns undef, ... Sorry, close returns false to signal

Re: Can't close filehandle

2013-05-01 Thread Brandon McCaig
t;/bin/true"; close $fh;' # This fails with the same error you get. perl -Mautodie -E 'open my $fh, "-|", "/bin/false"; close $fh;' So perhaps this is a bug in autodie, or perhaps you should just not use autodie with close and a pipe... I guess a work around should be to disable it for the close: use autodie; open my $fh, "-|", "/bin/false"; { no autodie qw/close/; close $fh or $? != 0 or die "close: $!"; } Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bamccaig.com/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.}; tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say' signature.asc Description: Digital signature

Re: Current time with DST

2013-04-18 Thread Brandon McCaig
On Thu, Apr 18, 2013 at 07:26:13AM -0300, Brian Fraser wrote: > On Wed, Apr 17, 2013 at 10:24 PM, Brandon McCaig wrote: > > Using the warnings pragma is good! You should also use the strict > > pragma: > > > > use strict; > > > > > This is not neede

Re: Current time with DST

2013-04-17 Thread Brandon McCaig
e strict; > use DateTime::TimeZone; > > my $tz = DateTime::TimeZone->new( name => 'Europe/Lisbon' ); > my $date = DateTime->now(); > print $date; Looks to me like the problem is that you're not specifying the time zone for DateTime::now. Try this:

Re: perl unicode utf8 and JSON::XS

2013-04-08 Thread Brandon McCaig
On Mon, Apr 08, 2013 at 01:07:13PM -0400, Brandon McCaig wrote: > use Data::Dumper; > use Encode; I should note that neither of these packages were used in the example program that I posted and aren't required for it to run. :) They were just remnants from debugging... Regards,

Re: perl unicode utf8 and JSON::XS

2013-04-08 Thread Brandon McCaig
what purpose JSON::XS::utf8 is intended to serve. It sounds to me like when enabled it expects the input data structure to be binary (UTF-8 encoded data). I'm not sure under what circumstances you'd want hash keys to be in binary when you could instead just decode the data from where eve

Re: Exposed Email Addresses

2013-03-28 Thread Brandon McCaig
ible on the Web. And the spam could be unrelated to the list anyway. Anybody could have passed your E-mail address along until it found its way to a spammer's bot. Just avoid replying to any spam messages, and avoid fetching any URLs found within them (make sure your mail client doesn't d

Re: IPC::Open3 Usage

2013-03-22 Thread Brandon McCaig
a',997)); > > > Here is my output: > Use of uninitialized value $exit_status in hash element at user.pm line 31. > $VAR1 = { > 'std_err' => 'no error output produced', > 'std_out' => \*Symbol::GEN1, > &

Re: Installing from CPAN -- YAML

2013-03-21 Thread Brandon McCaig
installing 'YAML'. ;) bash$ cpan YAML HTH. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bamccaig.com/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.}; tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say' signature.asc Description: Digital signature

Re: Problem Installing perlbrew

2013-03-20 Thread Brandon McCaig
On Wed, Mar 20, 2013 at 10:22:04AM -0400, Brandon McCaig wrote: > Is it possible that it's not running bash, and > therefore your .bash_profile is not being sourced, and therefore > the Perlbrew environment is not being set up? Nevermind... On Tue, Mar 19, 2013 at 11:42:56AM -0700,

Re: Problem Installing perlbrew

2013-03-20 Thread Brandon McCaig
applicable to your situation, but you never know... :) Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bamccaig.com/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.}; tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say' signature.asc Description: Digital signature

Re: Dynamically created perl script

2013-03-19 Thread Brandon McCaig
gs to make sure that doesn't happen accidentally (and avoid doing it intentionally). Thanks to the warnings pragma we do get a warning about it, but that can be surpressed, and regardless the damage may be done already. See perldoc -f eval and perldoc warnings. Regards, -- Brandon McC

Re: anonymous array for loop

2013-03-10 Thread Brandon McCaig
On Sun, Mar 10, 2013 at 11:06:14AM -0400, Brandon McCaig wrote: > There is no array here. There are only lists. See perldoc > perldata. > > > List value constructors > > List values are denoted by separating individual values > > by commas (and enclosing th

Re: anonymous array for loop

2013-03-10 Thread Brandon McCaig
Protip: you should stay on list for this. :) Cc'ing the list. On Sun, Mar 10, 2013 at 11:16:50AM +, John Delacour wrote: > On 09/03/2013 20:57, Brandon McCaig wrote: > >You cannot have anonymous arrays in Perl except by reference. > > What about this? > > for (spli

Re: anonymous array for loop

2013-03-09 Thread Brandon McCaig
'One', > 'Two' > ] > ]; > One Two I do not see the point you are trying to make. You created a named array, stuffed an anonymous array ref into it, and then printed its elements out (in a somewhat odd way). What does this demonstrate?

Re: Running into dependency hell with Cygwin when trying to install Excel-Writer-XLSX-0.65 and have all tests pass and not skipped

2013-03-09 Thread Brandon McCaig
its author felt it does more i.e., is more featureful. I haven't used the latter myself. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bamccaig.com/> perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }. q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.}; tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say' signature.asc Description: Digital signature

Re: anonymous array for loop

2013-03-09 Thread Brandon McCaig
nce. That is, [] gives you a reference to an anonymous array. my @named_array = (1,2,3); my $anon_array_ref = [1,2,3]; my @named_array_copy_of_anon_array = @$anon_array_ref; Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bamccai

Re: Return values more than 256?

2013-03-07 Thread Brandon McCaig
ot;; Good catch. :) I didn't think that open worked with a pipe and LIST, but apparently it does now. It must have been an older Perl that screamed at me, I guess. Thanks for pointing it out. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <h

Re: Return values more than 256?

2013-03-07 Thread Brandon McCaig
On Thu, Mar 07, 2013 at 10:05:56AM -0500, Brandon McCaig wrote: > Apparently Windows supports 32-bit integers... The Web suggests > that if you want to get full 32-bit integers on Windows then you > should use the Win32::Process module instead of open. It's not > portable, but at

Re: Return values more than 256?

2013-03-07 Thread Brandon McCaig
hen you should use the Win32::Process module instead of open. It's not portable, but at least it will do what you need. Note: 55028 & 255 = 244. So what is happening is the original exit code is being truncated down to one byte. Regards, -- Brandon McCaig Castopulence Software <ht

Re: Line Endings

2013-02-25 Thread Brandon McCaig
or referencing. I had to look it over several times and have faith in you before I figured out how it is meant to work. > do_something_with_line($line); > } > } Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.ba

Re: .profile not being read

2013-02-20 Thread Brandon McCaig
from .bash_profile yourself: # .bash_profile: source .profile Results may vary from UNIX-like to UNIX-like, but not by much. Regards, -- Brandon McCaig Castopulence Software <https://www.castopulence.org/> Blog <http://www.bamccaig.com/> perl -E '$_=q{V zrna gur orfg jvgu jung

Re: Email::Mime not able to send array in mesg body

2013-02-20 Thread Brandon McCaig
ot;Please see my test email", >       ], >       attributes => { >         encoding => 'quoted-printable', >         charset  => 'ISO-8859-1', >         content_type => 'text/html' >       }, >       body_str => @email_body,

  1   2   3   >