App-Cheats
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
#############################################################
# Send a post request (LWP)
u="http://pythonscraping.com/pages/files/processing.php"
perl -MLWP -le '$u=shift; $ua=LWP::UserAgent->new; $ua->env_proxy; $rc=$ua->post($u,{qw/^Crstname FIRST lastname LAST/}); print $rc->content' $u
#############################################################
## Perl Modules - LWP::UserAgent
#############################################################
# Get http request. practice using LWP::UserAgent
perl -MLWP::UserAgent -MData::Dumper -le '$u="http://www.google.com"; $ua=LWP::UserAgent->new; $ua->env_proxy; $r=$ua->get($u); print $r->header("Server")'
#############################################################
## Perl Modules - Mail::Address
#############################################################
# Example of using Mail::Address.
perl -Mojo -MMail::Address -E 'say r $_ for Mail::Address->parse("First Last email\@localhost")'
bless( [
"",
"First",
""
], 'Mail::Address' )
bless( [
"",
"Last",
""
], 'Mail::Address' )
bless( [
"",
"email\@localhost",
""
], 'Mail::Address' )
#############################################################
## Perl Modules - Math::Combinatorics
#############################################################
# Get permutations of lists (make a table).
perl -lE '$_="{0,1}"x3; say for glob'
perl -E 'say for glob "{A,B}{1,2}"'
perl -lE 'say for glob "{0,1}{0,1}{0,1}{0,1}"'
perl -MMath::Combinatorics=permute -lE 'say for map{"@$_"} permute(qw/a b c/)'
#############################################################
## Perl Modules - Math::Factoring
#############################################################
# Factoring a number to get the prime numbers
perl -MMath::Factoring=factor -E "say for factor 666"
#############################################################
## Perl Modules - Modern::Perl
#############################################################
# Modern::Perl defaults to v5.12 (bug!?)
perl -E 'say $^V'
v5.36.0
perl -Modern::Perl -e 'say Modern::Perl::validate_date(2022)'
:5.34
perl -Modern::Perl -e 'say Modern::Perl::validate_date()'
:5.12
perl -E 'sub abc ($n) {$n}'
perl -Modern::Perl=2022 -e 'sub abc ($n) {$n}'
perl -Modern::Perl -e 'sub abc ($n) {$n}'
Illegal character in prototype for main::abc : $n at -e line 1.
Global symbol "$n" requires explicit package name (did you forget to declare "my $n"?) at -e line 1.
Execution of -e aborted due to compilation errors.
#############################################################
## Perl Modules - Module::CoreList, corelist
#############################################################
# Find perl module
perl -MModule::CoreList -le 'print for Module::CoreList->find_modules("Class")'
cpan -l | grep -e '^Class'
# Find all available modules for a certain version
perl -MModule::CoreList -le 'print for Module::CoreList->find_modules(/5.010/)'
# Find find release of a perl module
corelist Data::Dumper
# Find all release versions of a perl module
corelist -a Data::Dumper
#############################################################
## Perl Modules - Module::Starter
#############################################################
# Create a new distribution in perl abd run it.
x2hs -X Example # Pure Perl
h2xs -A -n Example # XS
perl Makefile.PL
make
perl -Mblib -MExample2 -E 'Example2::print_hello()'
# Using -Mblib is similar to using:
perl -Iblib/lib -Iblib/arch -MExample2 -e 'Example2b::print_hello'
# Create a new distribution in perl.
module-starter --module=My::Test --distro=my-test --author="AUTHOR" --email="EMAIL" --mb --verbose
# Additional folder preparation (module-starter)
mv App-Pod/* .
rmdir App-Pod
mv ignore.txt .gitignore
echo "*.swp" >> .gitignore
chmod +x Build.PL
# Remove MYMETA.* and META.*
#
# Prepend to Build.PL
"#!/bin/env perl
"
# Additional folder preparation (module-starter)
# Add to Build.PL
meta_merge => {
resources => {
bugtracker => 'https://github.com/poti1/data-trace/issues',
repository => 'https://github.com/poti1/data-trace',
},
},
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.722 second using v1.00-cache-2.02-grep-82fe00e-cpan-f5108d614456 )